On 06/11/2026 19:29, Rob Landley wrote:
Trying to get my toybox tests to pass with TEST_HOST=1 I encountered
regressions in mv between the coreutils 9.1 in Devuan Daedalus (fork of
Debian Bookworm) and the coreutils 9.7 in Devuan Excalibur (Debian
Trixie). Both changes violate posix 2024 from
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/mv.html

1) touch file1 file2; mv -i file1 file2 < /dev/null; ls file1

On Bookworm file1 is still there, in Trixie it's gone. "Lack of no" is
taken as yes. This violates this part of posix-2024:

the mv utility shall write a prompt to standard error and read a line
from standard input. If the response is not affirmative, mv shall do
nothing more with the current source_file and go on to any remaining
source_files.

I can't repro the file1 source file being moved on any upstream version.
Nor can I repro on mv 9.7 from trixie ?

2) touch file1 file2; echo n | mv -i file1 file2 && echo yes

The return code of mv -i when given "n" was 0 in Bookworm and 1 in
Trixie. This violates this part of posix-2024:

EXIT STATUS

      The following exit values shall be returned:

       0
          All requested files (excluding files where a non-affirmative
response was given to a request for confirmation) were successfully moved.
      >0
          An error occurred.

Again, both tests passed on Devuan Daedalus (I.E. Bookworm/9.1) but not
Excalibur (Trixie/9.7).
Right the exit status changed on purpose in coreutils 9.2 with:
https://github.com/coreutils/coreutils/commit/7a69df889
and that was discussed in:
https://bugs.gnu.org/61105

The relevant part from that thread (mainly about cp -n) was Paul saying:

"
  Better, I think, would be to change cp -n to be compatible with FreeBSD,
  where 'cp -n A B' exits with status 1 if B exists. This matches what
  FreeBSD 'cp -i A B' does when you say "no". This would be more useful
  than what GNU cp does, and the FreeBSD cp -i behavior conforms to POSIX
  whereas GNU cp -i (I think accidentally) does not. This would be simpler
  than adding a fatal --no-clobber, and would encourage portability a bit.

  The reason it's a POSIX conformance issue is that POSIX says exit status
  zero means "All files were copied successfully." which "cp -n A B" does
  not do when B exists.

  Similarly for 'mv' (though FreeBSD mv -i does not conform to POSIX here,
  unfortunately).
"

The corresponding patch changed the exit status for -n, -i and --update.
The --update bit was reverted right after, so according to this report
the -i portion should perhaps be similarly reverted.

cheers,
Padraig

Reply via email to