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


View this message in rfc822 format

From: Lauri Tirkkonen <lauri <at> hacktheplanet.fi>
To: Collin Funk <collin.funk1 <at> gmail.com>
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 79072 <at> debbugs.gnu.org
Subject: bug#79072: install -d onto readonly fs prints the wrong error
Date: Tue, 22 Jul 2025 15:23:16 +0900
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




This bug report was last modified 29 days ago.

Previous Next


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