On 2026-11-16 14:44, Geoff Clare wrote:
> Janis Papanagnou wrote:
>
>> What I lazily did was, say, touch name*.pdf but while the shell's
>> file expansion lists sequentially name1.pdf name2.pdf ... name8.pdf
>> the 'touch' command seems to _operate_ arguments in *reverse* order.
>
> Which version of touch?
$ whence touch
/usr/bin/touch
$ touch --version
touch (GNU coreutils) 9.4
...
>
> POSIX requires that touch processes the files in the order they are
> given. (XCU 1.4 Utility Description Defaults, under "OPERANDS":
> "Unless otherwise stated, the standard utilities that accept operands
> shall process those operands in the order specified in the command
> line." The OPERANDS section for touch does not state otherwise.)
Thanks.
>
> Running GNU touch from coreutils 9.1 under strace on Linux shows it
> processes the files in the correct order...
>
> [...]
>
> If your version of touch really is processing them in reverse, you
> should report it as a bug.
Just noticed it's even worse than that. Incidentally I was able to
cross the resolution boundary (which seems to be 8 ns on my system)
by a single touch command which was
$ touch 6 7 8 9
and the 'stat' command for these four files shows
2026-11-16 16:13:47.212143070 +0100 7
2026-11-16 16:13:47.212143070 +0100 8
2026-11-16 16:13:47.212143070 +0100 9
2026-11-16 16:13:47.211143078 +0100 6 <<< ...78 ns
$ ls -ltr 6 7 8 9
-rw-rw-r-- 1 xyz xyz 0 Nov 16 16:13 6
-rw-rw-r-- 1 xyz xyz 0 Nov 16 16:13 9
-rw-rw-r-- 1 xyz xyz 0 Nov 16 16:13 8
-rw-rw-r-- 1 xyz xyz 0 Nov 16 16:13 7
Janis