GNU bug report logs - #79072
install -d onto readonly fs prints the wrong error

Previous Next

Package: coreutils;

Reported by: Lauri Tirkkonen <lauri <at> hacktheplanet.fi>

Date: Tue, 22 Jul 2025 05:20:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 79072 <at> debbugs.gnu.org (full text, mbox):

From: Collin Funk <collin.funk1 <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Lauri Tirkkonen <lauri <at> hacktheplanet.fi>, 79072 <at> debbugs.gnu.org
Subject: Re: bug#79072: install -d onto readonly fs prints the wrong error
Date: Mon, 21 Jul 2025 23:10:09 -0700
[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)]

This bug report was last modified 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.