On Sun, 22 Mar 2020 11:41:55 +0100, Marc Espie wrote:

> If tar can't create intermediate directories due to permission
> issues, the resulting message is confusing:
>
> ./tar xf gcc.tar gcc-8.3.0/include/obstack.h 
> tar: Unable to create gcc-8.3.0/include/obstack.h: No such file or directory
>
> (here I have gcc-8.3.0 owned by root and no permissions)
>
> The following patch changes this to:
>
> ./tar xf gcc.tar gcc-8.3.0/include/obstack.h 
> tar: Unable to create gcc-8.3.0/include: Permission denied
> tar: Unable to create gcc-8.3.0/include/obstack.h: No such file or directory
>
> okay ? or a better way to do this ?

I think that is the best way to accomplish this.  GNU tar does
something similar except they are a bit more explicit.  E.g.

    gtar: gcc-8.3.0/include: Cannot mkdir: Permission denied

You might consider:

    syswarn(1, errno, "Unable to mkdir %s", name);

instead so it is clear exactly what is failing.

Either way, OK millert@

 - todd

Reply via email to