bug#79072: install -d onto readonly fs prints the wrong error
From:
Collin Funk
Subject:
bug#79072: install -d onto readonly fs prints the wrong error
Date:
Mon, 21 Jul 2025 23:10:09 -0700
User-agent:
Gnus/5.13 (Gnus v5.13)
Hi Lauri,
Lauri Tirkkonen via GNU coreutils Bug Reports <bug-coreutils@gnu.org>
writes:
> saw this on coreutils 9.7 on Alpine Linux, but it also reproduces on
> commit 027855dcad52d718927c3405bc7d605143e2a625.
>
> # mount -t tmpfs -o ro none /mnt
> # ./src/ginstall -d /mnt/foo
> ginstall: cannot change permissions of ‘/mnt/foo’: No such file or
> directory
>
> I would expect the error to be EROFS for creating the directory, not
> changing permissions of the directory that was not able to be created.
> strace confirms mkdir() returns EROFS, but install tries to open() and
> stat() the not-created directory afterward.
Thanks for the report.
It looks like the Gnulib mkdir-p module does not fail when 'mkdir' fails
with EROFS. And it looks like it has always behaved this way.
Paul, you are certainly more familiar with gnulib's mkdir-p and savewd
modules than I am. Can you check that the attached patch is correct
before I commit it?
Here is the new error based on Lauri's example:
$ ./src/ginstall -d /mnt/foo
ginstall: cannot create directory ‘/mnt/foo’: Read-only file system
Thanks,
Collin