266f737
commit 41c2d9b1fbcece4b0890ab92e9f5817621917ad3 (from 23977a19101b6e6eaeebbe8ce013332ddf9ea517)
266f737
Merge: 23977a19 686012cb
30a06e7
Author: Johannes Meixner <jsmeix@suse.com>
30a06e7
Date:   Thu Jul 20 15:11:52 2023 +0200
30a06e7
30a06e7
    Merge pull request #3027 from rmetrich/shrinking_file
30a06e7
    
30a06e7
    In build/GNU/Linux/100_copy_as_is.sh
30a06e7
    ensure to really get all COPY_AS_IS files copied by using
30a06e7
    'tar ... -i' when extracting to avoid a false regular exit of 'tar'
30a06e7
    in particular when padding zeroes get added when a file being read shrinks
30a06e7
    because for 'tar' (without '-i') two consecutive 512-blocks of zeroes mean EOF,
30a06e7
    cf. https://github.com/rear/rear/pull/3027
30a06e7
30a06e7
diff --git a/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh b/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
266f737
index e8f2be20..2169efaa 100644
30a06e7
--- a/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
30a06e7
+++ b/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
266f737
@@ -110,9 +110,13 @@ done >$copy_as_is_exclude_file
30a06e7
 # COPY_AS_IS+=( /path/to/directory/* )
30a06e7
 # which are used in our scripts and by users in their etc/rear/local.conf
30a06e7
 # cf. https://github.com/rear/rear/pull/2405#issuecomment-633512932
30a06e7
+# Using '-i' when extracting is necessary to avoid a false regular exit of 'tar'
30a06e7
+# in particular when padding zeroes get added when a file being read shrinks
30a06e7
+# because for 'tar' (without '-i') two consecutive 512-blocks of zeroes mean EOF,
30a06e7
+# cf. https://github.com/rear/rear/pull/3027
30a06e7
 # FIXME: The following code fails if file names contain characters from IFS (e.g. blanks),
30a06e7
 # cf. https://github.com/rear/rear/issues/1372
30a06e7
-if ! tar -v -X $copy_as_is_exclude_file -P -C / -c ${COPY_AS_IS[*]} 2>$copy_as_is_filelist_file | tar $v -C $ROOTFS_DIR/ -x 1>/dev/null ; then
30a06e7
+if ! tar -v -X $copy_as_is_exclude_file -P -C / -c ${COPY_AS_IS[*]} 2>$copy_as_is_filelist_file | tar $v -C $ROOTFS_DIR/ -x -i 1>/dev/null ; then
30a06e7
     Error "Failed to copy files and directories in COPY_AS_IS minus COPY_AS_IS_EXCLUDE"
30a06e7
 fi
30a06e7
 Log "Finished copying files and directories in COPY_AS_IS minus COPY_AS_IS_EXCLUDE"