]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
chore: remove default argument to cp
authorJo Zzsi <jozzsicsataban@gmail.com>
Sun, 14 Dec 2025 03:06:07 +0000 (22:06 -0500)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Sun, 14 Dec 2025 22:32:54 +0000 (17:32 -0500)
Adding argument processing for arguments that are the default
anyways just adds to cognitive load of reading the code and
a little bit of performance overhead.

--sparse=auto is the default. There is no need to re-specify it.

dracut.sh
src/install/dracut-install.c

index b3b3833dffce9db58af01c87f46595d2307a3964..5a0cfbefb473b9dc5d97aeb1703a375484f780c1 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1471,9 +1471,9 @@ fi
 export LC_MESSAGES=C kernel
 
 if [[ $EUID == "0" ]] && ! [[ ${DRACUT_NO_XATTR-} ]]; then
-    export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr"
+    export DRACUT_CP="cp --reflink=auto --preserve=mode,timestamps,xattr,links -dfr"
 else
-    export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
+    export DRACUT_CP="cp --reflink=auto --preserve=mode,timestamps,links -dfr"
 fi
 
 if ! [[ ${dracutbasedir-} ]]; then
index 41c4c566d4c58eaf30aa32d554a2b54c48a303d1..1052d3c527581607d6c2e4a0783b31a80515a899 100644 (file)
@@ -440,7 +440,7 @@ normal_copy:
         const char *preservation = (geteuid() == 0
                                     && no_xattr == false) ? "--preserve=mode,xattr,timestamps,ownership" : "--preserve=mode,timestamps,ownership";
         if (pid == 0) {
-                execlp("cp", "cp", "--reflink=auto", "--sparse=auto", preservation, "-fL", src, dst, NULL);
+                execlp("cp", "cp", "--reflink=auto", preservation, "-fL", src, dst, NULL);
                 _exit(errno == ENOENT ? 127 : 126);
         }
 
@@ -452,7 +452,7 @@ normal_copy:
         }
         ret = WIFSIGNALED(ret) ? 128 + WTERMSIG(ret) : WEXITSTATUS(ret);
         if (ret != 0)
-                log_error("ERROR: 'cp --reflink=auto --sparse=auto %s -fL %s %s' failed with %d", preservation, src, dst, ret);
+                log_error("ERROR: 'cp --reflink=auto %s -fL %s %s' failed with %d", preservation, src, dst, ret);
         log_debug("cp ret = %d", ret);
         return ret;
 }