Subject: bug#79072: install -d onto readonly fs prints the wrong error

From: Lauri Tirkkonen <[email-masked]>
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