Hello

Two more tests for behavior aren't tested currently!

chmod: check exit code with multiple files when there is a failure

mv: check broken symlink cross-filesystem move

Cheers
Sylvestre

From d12447ac117a3dbb74a425fd635ef356ac05f7c0 Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <[email protected]>
Date: Thu, 1 Jan 2026 13:20:39 +0100
Subject: [PATCH 1/2] tests: chmod: check exit code with multiple files

Identified here:
<https://github.com/uutils/coreutils/issues/9790>

* tests/chmod/multi-file-exit-code.sh: Add the check.
---
 tests/chmod/multi-file-exit-code.sh | 36 +++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 tests/chmod/multi-file-exit-code.sh

diff --git a/tests/chmod/multi-file-exit-code.sh b/tests/chmod/multi-file-exit-code.sh
new file mode 100644
index 000000000..8473ace3b
--- /dev/null
+++ b/tests/chmod/multi-file-exit-code.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Test chmod exit code with multiple files when some operations fail
+
+# Copyright (C) 2026 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ chmod
+
+skip_if_not_root_
+
+# Test chmod exit code with mixed success/failure on multiple files
+
+mkdir -p chmod-bug/user chmod-bug/root || framework_failure_
+touch chmod-bug/user/user_owned chmod-bug/root/root_owned || framework_failure_
+
+if ! sudo chown root:root chmod-bug/root/root_owned 2>/dev/null; then
+  skip_ "cannot create root-owned file for testing"
+fi
+
+# Should return 1 even though last operation succeeds
+returns_ 1 chmod -R 0755 chmod-bug/root chmod-bug/user 2>/dev/null || fail=1
+
+Exit $fail
-- 
2.47.3

From 4b2c0332ce88ec3af5dccf8e07ac4b2161e8fdbd Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <[email protected]>
Date: Thu, 1 Jan 2026 13:20:52 +0100
Subject: [PATCH 2/2] tests: mv: check broken symlink cross-filesystem move

Identified here:
<https://github.com/uutils/coreutils/issues/8586>

* tests/mv/mv-special-2.sh: Add the check.
---
 tests/mv/mv-special-2.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/mv/mv-special-2.sh b/tests/mv/mv-special-2.sh
index f77e32323..7c12adb8e 100755
--- a/tests/mv/mv-special-2.sh
+++ b/tests/mv/mv-special-2.sh
@@ -59,6 +59,12 @@ mv --verbose blah xdev &&
 returns_ 1 test -L blah &&
 test -L xdev/blah || fail=1
 
+# Test moving a broken symlink to another filesystem
+ln -nsf nonexistent broken_symlink || framework_failure_
+mv --verbose broken_symlink xdev &&
+returns_ 1 test -L broken_symlink &&
+test -L xdev/broken_symlink || fail=1
+
 if python -c "import socket as s; s.socket(s.AF_UNIX).bind('test.sock')" &&
    test -S 'test.sock'; then
   mv --verbose test.sock xdev &&
-- 
2.47.3

Reply via email to