coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

touch: "setting times of" instead of "cannot touch" for an existing file the user cannot write

Open abendrothj opened this issue 2 months ago • 1 comments

# f is root:root, mode 644; run as nobody
$ touch f
touch: setting times of 'f': Permission denied

GNU 9.12 (built from source) prints touch: cannot touch 'f': Permission denied. uutils uses "cannot touch" only when it fails to create a missing file; for an existing file any failure is reported as "setting times of".

uutils main at 2b85f6f12, Linux.

abendrothj avatar Oct 01 '26 20:10 abendrothj

Thanks for reporting this. I reproduced the error and opened #15161 with a fix. The PR changes the message to cannot touch for these access failures and adds tests for both an unwritable existing file and an inaccessible parent directory. I also checked that the existing wording for -c and -h stays as it is.

danielsyauqi avatar Oct 07 '26 17:10 danielsyauqi