]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ensure tests/cp/preserve-gid.sh works with single binary
authorKamil Dudka <kdudka@redhat.com>
Fri, 7 Feb 2020 16:05:06 +0000 (17:05 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 9 Feb 2020 14:19:35 +0000 (14:19 +0000)
* tests/cp/preserve-gid.sh: If configured with --enable-single-binary
copy the coreutils single binary, instead of the cp one-line launcher.

Discussed at https://bugzilla.redhat.com/1800597
Fixes https://bugs.gnu.org/39485

tests/cp/preserve-gid.sh

index e48584c1e98ad8d47a4bf08241de5f3792b61467..bba09df098ff44616536891f97b8fa0bd5da90e1 100755 (executable)
@@ -110,7 +110,14 @@ cleanup_() { rm -rf "$tmp_path"; }
 # is not readable by our nameless IDs.
 test -d /tmp && TMPDIR=/tmp
 tmp_path=$(mktemp -d) || fail_ "failed to create temporary directory"
-cp "$abs_path_dir_/cp" "$tmp_path"
+if test -x "$abs_path_dir_/coreutils" &&
+   { test -l "$abs_path_dir_/cp" ||
+     test $(wc -l < "$abs_path_dir_/cp") = 1; } then
+  # if configured with --enable-single-binary we need to use the single binary
+  cp "$abs_path_dir_/coreutils" "$tmp_path/cp" || framework_failure_
+else
+  cp "$abs_path_dir_/cp" "$tmp_path"
+fi
 chmod -R a+rx "$tmp_path"
 
 t1() {