On 15/11/2025 21:48, Collin Funk wrote:
Sylvestre Ledru <[email protected]> writes:

Hello

Adding a case that wasn't covered in the install testsuite!

Thanks
Sylvestre

 From d6d9927ad760c55b55056c89b2a97f274087dd57 Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <[email protected]>
Date: Sat, 15 Nov 2025 22:24:04 +0100
Subject: [PATCH] tests: install should ignore umask

Identified here:
<https://github.com/uutils/coreutils/pull/9254>

   * tests/install/basic-1.sh: Add the check.
---
  tests/install/basic-1.sh | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/tests/install/basic-1.sh b/tests/install/basic-1.sh
index b529f2af9..824a9ce91 100755
--- a/tests/install/basic-1.sh
+++ b/tests/install/basic-1.sh
@@ -160,4 +160,12 @@ if ! mkdir sub-ro/d; then
    grep 'cannot create directory' err || { cat err; fail=1; }
  fi
+# Test install with --mode=+w (relative mode)
+umask 0022 || framework_failure_
+touch file1 || framework_failure_
+ginstall file1 file2 --mode=+w || fail=1
+# Check that file2 has permissions --w--w--w-
+mode=$(ls -l file2|cut -b-10)
+test "$mode" = --w--w--w- || fail=1
+
  Exit $fail

Thanks!

I think this test should go in a seperate file with
"working_umask_or_skip_" called at the start.

Pádraig, WDYT?

Good point, and it wasn't obvious to me, but after looking at
https://github.com/coreutils/coreutils/commit/a240b4123
I think the umask verification is really checking that
defaults ACLs are not in play.

Since install(1) explicitly sets modes irrespective of umask (or default ACLs),
then it's probably OK to leave the test as is.  In other words, for tests
where we want umask ignored, there isn't a need for calling 
working_umask_or_skip_

For example, see:

  $ mkdir testmask
  $ cd testmask

  $ umask 0022
  $ touch file1
  $ install file1 install1
  $ install file1 installmode1 --mode=+w
  $ setfacl -d -m u::rwx,g::r-x,o::--- .
  $ touch fileacl1
  $ install file1 installacl1
  $ install file1 installmodeacl1 --mode=+w

  $ ls -lUg
  -rw-r--r--. 1 padraig 0 Nov 15 22:56 file1
  -rwxr-xr-x. 1 padraig 0 Nov 15 22:56 install1
  --w--w--w-. 1 padraig 0 Nov 15 22:56 installmode1
  -rw-r-----. 1 padraig 0 Nov 15 22:57 fileacl1
  -rwxr-xr-x. 1 padraig 0 Nov 15 22:57 installacl1
  --w--w--w-. 1 padraig 0 Nov 15 22:57 installmodeacl1

So I've pushed the test as is.

cheers,
Padraig

Reply via email to