Sylvestre Ledru <[email protected]> writes:

> Hello
>
> Adding another case that wasn't covered in the install testsuite!
>
> Thanks
> Sylvestre
>
> From 6882a006f9a9ec882b4cd46a1fb4adf6f6d18b4d Mon Sep 17 00:00:00 2001
> From: Sylvestre Ledru <[email protected]>
> Date: Sun, 16 Nov 2025 23:19:14 +0100
> Subject: [PATCH] tests: install supports comma-separated mode strings
>
> Identified here:
> <https://github.com/uutils/coreutils/pull/9298>
>
>   * tests/install/basic-1.sh: Add the check.
> ---
>  tests/install/basic-1.sh | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/tests/install/basic-1.sh b/tests/install/basic-1.sh
> index 741de7aef..64636e591 100755
> --- a/tests/install/basic-1.sh
> +++ b/tests/install/basic-1.sh
> @@ -168,4 +168,17 @@ ginstall file1 file2 --mode=+w || fail=1
>  mode=$(ls -l file2|cut -b-10)
>  test "$mode" = --w--w--w- || fail=1
>  
> +# Test comma-separated mode strings (like chmod)
> +touch file3 || framework_failure_
> +ginstall file3 file4 --mode='ug+rw,o+r' || fail=1
> +# Check that file4 has permissions -rw-rw-r--
> +mode=$(ls -l file4|cut -b-10)
> +test "$mode" = -rw-rw-r-- || fail=1
> +
> +# Test comma-separated mode with directory creation
> +ginstall -d testdir --mode='u+rwx,g+rx,o+r' || fail=1
> +# Check that testdir has permissions drwxr-xr--
> +mode=$(ls -ld testdir|cut -b-10)
> +test "$mode" = drwxr-xr-- || fail=1
> +
>  Exit $fail

Thanks.

This is also the case for mknod, mkfifo, and mkdir. So I added tests for
those as well with the attached patch.

I'll push them both in a bit to allow others a chance to review.

Collin

>From 5673a0fd574716016cba2e2731e9a30b098ea5a6 Mon Sep 17 00:00:00 2001
Message-ID: <5673a0fd574716016cba2e2731e9a30b098ea5a6.1763357148.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Sun, 16 Nov 2025 21:23:18 -0800
Subject: [PATCH] tests: check that mknod, mkfifo, and mkdir handle
 comma-separated modes

* tests/misc/mknod.sh: Test that mknod, mkfifo, and mkdir parse
comma-separated mode strings.
---
 tests/misc/mknod.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/misc/mknod.sh b/tests/misc/mknod.sh
index 24ba8f1eb..28453791e 100755
--- a/tests/misc/mknod.sh
+++ b/tests/misc/mknod.sh
@@ -36,4 +36,16 @@ mkdir -m 734 f3   || fail=1
 mode=$(ls -dgo f3|cut -b-10)
 test $mode = drwx-wxr-- || test $mode = drwx-wsr-- || fail=1
 
+mknod --mode='ug+rw,o+r' f4 p || fail=1
+mode=$(ls -dgo f4 | cut -b-10)
+test "$mode" = prw-rw-rw- || fail=1
+
+mkfifo --mode='ug+rw,o+r' f5 || fail=1
+mode=$(ls -dgo f5 | cut -b-10)
+test "$mode" = prw-rw-rw- || fail=1
+
+mkdir --mode='ug+rw,o+r' f6 || fail=1
+mode=$(ls -dgo f6 | cut -b-10)
+test "$mode" = drwxrwxrwx || fail=1
+
 Exit $fail
-- 
2.51.1

Reply via email to