4
0
Эх сурвалжийг харах

Fix interaction between --listed-incremental and -C

* src/incremen.c (read_directory_file): Execute eventual -C dir
after opening the snapshot file.
(collect_and_sort_names): Remove call to chdir_do
* tests/incr05.at, tests/incr06.at: Use relative file names for
snapshot files.
Sergey Poznyakoff 15 жил өмнө
parent
commit
006c1efbe8
4 өөрчлөгдсөн 14 нэмэгдсэн , 11 устгасан
  1. 7 0
      src/incremen.c
  2. 1 1
      src/names.c
  3. 2 4
      tests/incr05.at
  4. 4 6
      tests/incr06.at

+ 7 - 0
src/incremen.c

@@ -1324,6 +1324,13 @@ read_directory_file (void)
       return;
     }
 
+  /* Consume the first name from the name list and reset the
+     list afterwards.  This is done to change to the new
+     directory, if the first name is a chdir request (-C dir),
+     which is necessary to recreate absolute file names. */
+  name_from_list ();
+  blank_name_list ();
+  
   if (0 < getline (&buf, &bufsize, listed_incremental_stream))
     {
       char *ebuf;

+ 1 - 1
src/names.c

@@ -903,7 +903,7 @@ collect_and_sort_names (void)
 			_("Only one -C option is allowed with "
 			  "--listed-incremental")));
 	}
-      chdir_do (namelist->change_dir);
+
       read_directory_file ();
     }
   

+ 2 - 4
tests/incr05.at

@@ -25,14 +25,12 @@ mkdir dir/sub
 genfile --file dir/file1
 genfile --file dir/sub/file2
 
-dbfile=`pwd`/db
-
 echo Level 0
-tar -c -f archive.tar -g $dbfile -C dir -v --warning=no-new-dir .
+tar -c -f archive.tar -g db -C dir -v --warning=no-new-dir .
 
 genfile --file dir/file3
 echo Level 1
-tar -c -f archive.tar -g $dbfile -C dir -v --warning=no-new-dir .
+tar -c -f archive.tar -g db -C dir -v --warning=no-new-dir .
 ],
 [0],
 [Level 0

+ 4 - 6
tests/incr06.at

@@ -28,20 +28,18 @@ genfile --file dir/file1
 genfile --file dir/sub/file2
 genfile --file dir/sub/a/file3
 
-dbfile=`pwd`/db
-
 echo Level 0 . sub
-tar -c -f archive-0.1.tar -g $dbfile.1 -C dir -v --warning=no-new-dir . sub
+tar -c -f archive-0.1.tar -g db.1 -C dir -v --warning=no-new-dir . sub
 echo Level 0 sub .
-tar -c -f archive-0.2.tar -g $dbfile.2 -C dir -v --warning=no-new-dir sub .
+tar -c -f archive-0.2.tar -g db.2 -C dir -v --warning=no-new-dir sub .
 
 mkdir dir/c
 genfile --file dir/sub/b/file4
 
 echo Level 1 . sub
-tar -c -f archive-1.1.tar -g $dbfile.1 -C dir -v --warning=no-new-dir . sub
+tar -c -f archive-1.1.tar -g db.1 -C dir -v --warning=no-new-dir . sub
 echo Level 1 sub .
-tar -c -f archive-1.2.tar -g $dbfile.2 -C dir -v --warning=no-new-dir sub .
+tar -c -f archive-1.2.tar -g db.2 -C dir -v --warning=no-new-dir sub .
 ],
 [0],
 [Level 0 . sub