GNU bug report logs -
#79072
install -d onto readonly fs prints the wrong error
Previous Next
To reply to this bug, email your comments to 79072 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#79072
; Package
coreutils
.
(Tue, 22 Jul 2025 05:20:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Lauri Tirkkonen <lauri <at> hacktheplanet.fi>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Tue, 22 Jul 2025 05:20:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
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.
--
Lauri Tirkkonen | lotheac @ IRCnet
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#79072
; Package
coreutils
.
(Tue, 22 Jul 2025 06:11:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 79072 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Lauri,
Lauri Tirkkonen via GNU coreutils Bug Reports <bug-coreutils <at> 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
[0001-mkdir-p-Diagnose-read-only-file-systems.patch (text/x-patch, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#79072
; Package
coreutils
.
(Tue, 22 Jul 2025 06:24:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 79072 <at> debbugs.gnu.org (full text, mbox):
Hi Collin,
On Mon, Jul 21 2025 23:10:09 -0700, Collin Funk wrote:
> diff --git a/lib/mkdir-p.c b/lib/mkdir-p.c
> index f5df9843e4..fc83434655 100644
> --- a/lib/mkdir-p.c
> +++ b/lib/mkdir-p.c
> @@ -182,8 +182,8 @@ make_dir_parents (char *dir,
> return true;
>
> if (mkdir_errno == 0
> - || (mkdir_errno != ENOENT && make_ancestor
> - && errno != ENOTDIR))
> + || (mkdir_errno != ENOENT && mkdir_errno != EROFS
> + && make_ancestor && errno != ENOTDIR))
> {
> error (0, errno,
> _(keep_owner
Oh... looks like there is a list of errors that are reported from mkdir,
and all other errors are considered success? This being the case, even
with your patch, it's not difficult to find another scenario where we
hit the same problem (just with a different original errno). For
example, as a user without permissions to write to /:
$ ./src/ginstall -d /foo
ginstall: cannot change permissions of ‘/foo’: No such file or directory
--
Lauri Tirkkonen | lotheac @ IRCnet
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Tue, 22 Jul 2025 19:19:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Lauri Tirkkonen <lauri <at> hacktheplanet.fi>
:
bug acknowledged by developer.
(Tue, 22 Jul 2025 19:19:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 79072-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thanks for reporting that inaccurate diagnostic. Sorry about the tricky
code; it's a tricky situation. Looks like Collin's patch is not quite right.
I installed the attached patches into Gnulib. The first one fixes the
two cases you mentioned, the second an unlikely bug I discovered in the
neighborhood. Please give the patches a try. As they fix the bugs for me
I am boldly closing the Coreutils bug report; we can reopen it if I'm wrong.
[0001-mkdir-p-better-diagnostics.patch (text/x-patch, attachment)]
[0002-mkdir-p-ENOENT-ENOTDIR-safety-and-consistency.patch (text/x-patch, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#79072
; Package
coreutils
.
(Tue, 22 Jul 2025 20:28:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 79072 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 22/07/2025 20:17, Paul Eggert wrote:
> Thanks for reporting that inaccurate diagnostic. Sorry about the tricky
> code; it's a tricky situation. Looks like Collin's patch is not quite right.
>
> I installed the attached patches into Gnulib. The first one fixes the
> two cases you mentioned, the second an unlikely bug I discovered in the
> neighborhood. Please give the patches a try. As they fix the bugs for me
> I am boldly closing the Coreutils bug report; we can reopen it if I'm wrong.
Seems to work with the attached coreutils patch
to add NEWS and a test.
thanks!
Padraig
[install-d-diag.patch (text/x-patch, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#79072
; Package
coreutils
.
(Tue, 22 Jul 2025 22:53:14 GMT)
Full text and
rfc822 format available.
Message #22 received at 79072 <at> debbugs.gnu.org (full text, mbox):
Pádraig Brady <P <at> draigBrady.com> writes:
> Seems to work with the attached coreutils patch
> to add NEWS and a test.
Looks good, thanks.
And thanks Paul for the fix.
Collin
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.