[Bug 2131117] Re: Rust coreutils test command doesn't report existing file is newer than non-existent file
Julian Andres Klode
2131117 at bugs.launchpad.net
Tue Dec 2 10:15:53 UTC 2025
** Changed in: rust-coreutils (Ubuntu)
Status: New => Triaged
** Changed in: rust-coreutils (Ubuntu)
Importance: Undecided => Critical
** Changed in: rust-coreutils (Ubuntu)
Status: Triaged => In Progress
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rust-coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/2131117
Title:
Rust coreutils test command doesn't report existing file is newer than
non-existent file
Status in rust-coreutils package in Ubuntu:
In Progress
Bug description:
The -nt operator in the /usr/bin/test command does not handle non-
existent files correctly.
The OpenGroup standard says:
pathname1 -nt pathname2
True if pathname1 resolves to an existing file and pathname2
cannot be resolved, or if both resolve to existing files and pathname1
is newer than pathname2 according to their last data modification
timestamps; otherwise, false.
So given:
root at b78766553a96:~# touch foo
root at b78766553a96:~# rm -f bar
root at b78766553a96:~# ls -ld foo bar
ls: cannot access 'bar': No such file or directory
-rw-r--r-- 1 root root 0 Nov 12 01:58 foo
The command test foo -nt bar should succeed.
For the bash builtin, it does:
root at b78766553a96:~# test foo -nt bar; echo $?
0
But the /usr/bin/test command fails:
root at b78766553a96:~# /usr/bin/test foo -nt bar; echo $?
1
Package versions are:
root at b78766553a96:~# dpkg -S /usr/bin/test
coreutils-from-uutils: /usr/bin/test
root at b78766553a96:~# ls -l /usr/bin/test
lrwxrwxrwx 1 root root 31 Sep 26 18:16 /usr/bin/test -> ../lib/cargo/bin/coreutils/test
root at b78766553a96:~# dpkg -S /usr/lib/cargo/bin/coreutils/test
rust-coreutils: /usr/lib/cargo/bin/coreutils/test
root at b78766553a96:~# dpkg -l coreutils-from-uutils rust-coreutils
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================-================-============-==========================================
ii coreutils-from-uutils 0.0.0~ubuntu24 all coreutils from the uutils project
ii rust-coreutils 0.2.2-0ubuntu2.1 amd64 Universal coreutils utils, written in Rust
Ubuntu version:
root at b78766553a96:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=25.10
DISTRIB_CODENAME=questing
DISTRIB_DESCRIPTION="Ubuntu 25.10"
(Note: Tested this in a docker image. This is a hard blocker for me to
update my WSL.)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2131117/+subscriptions
More information about the foundations-bugs
mailing list