bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#39485: [PATCH] make tests/cp/preserve-gid work with single binary


From: Pádraig Brady
Subject: bug#39485: [PATCH] make tests/cp/preserve-gid work with single binary
Date: Sat, 8 Feb 2020 11:53:52 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Thunderbird/73.0

On 07/02/2020 16:05, Kamil Dudka wrote:
* tests/cp/preserve-gid.sh: If configured with --enable-single-binary
copy the coreutils single binary, instead of the cp one-line launcher.

Bug: https://bugzilla.redhat.com/1800597
---
  tests/cp/preserve-gid.sh | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/cp/preserve-gid.sh b/tests/cp/preserve-gid.sh
index e48584c1e..41cdbc6ca 100755
--- a/tests/cp/preserve-gid.sh
+++ b/tests/cp/preserve-gid.sh
@@ -110,7 +110,13 @@ 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"; then
+  # if configured with --enable-single-binary we need to use the single binary
+  cp "$abs_path_dir_/coreutils" "$tmp_path"
+  echo "#!$tmp_path/coreutils --coreutils-prog-shebang=cp" > "$tmp_path/cp"
+else
+  cp "$abs_path_dir_/cp" "$tmp_path"
+fi
  chmod -R a+rx "$tmp_path"
t1() {


Considering --enable-single-binary-exceptions may exclude cp,
and also that coreutils(1) may be compiled during
non --enable-single-binary build when building
all programs for `make syntax-check` etc.
we should add an extra guard.

Also we can simplify by just copying coreutils to cp.

I'll amend your change with the following and push later.
Marking this as done.

thanks!
Pádraig

diff --git a/tests/cp/preserve-gid.sh b/tests/cp/preserve-gid.sh
index 41cdbc6ca..bba09df09 100755
--- a/tests/cp/preserve-gid.sh
+++ b/tests/cp/preserve-gid.sh
@@ -110,10 +110,11 @@ 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"
-if test -x "$abs_path_dir_/coreutils"; then
+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"
-  echo "#!$tmp_path/coreutils --coreutils-prog-shebang=cp" > "$tmp_path/cp"
+  cp "$abs_path_dir_/coreutils" "$tmp_path/cp" || framework_failure_
 else
   cp "$abs_path_dir_/cp" "$tmp_path"
 fi





reply via email to

[Prev in Thread] Current Thread [Next in Thread]