[nycbug-talk] anyone know why install functions this way?

Isaac Levy ike at blackskyresearch.net
Mon Dec 12 12:09:30 EST 2011

To interrupt the chirping crickets,

On Dec 9, 2011, at 8:08 PM, Matthew Story wrote:

> install -o root -d foo/
> Will create the directory with my user and effective group id, and my umask ... and yield an error message ... but still exit 0 (success).  At the very least I would expect the directory to linger with these permissions and exit non-zero (failure) ... this is also not consistant with the behavior of files.
> Anyway ... anyone know a historical reason for this, or have a good hack around this ... getting patches into section 1 to trickle down into my world takes a while, assuming the behavior is even a bug ...

yadda yadda ancient 4.2BSD specific implementation of install(1) over gnu make builtin...

On Dec 12, 2011, at 11:58 AM, Matthew Story wrote:

> For anyone interested, there does actually seem to be a valid reason for this behavior, the reason is that you can `install' an existing directory with owner/group flags set.  This means that if you are installing to an existing directory, and it fails ... unlink would remove the directory and any contents ... hardly desirable.  install -d does the following:
> 1. byte-wise walk path, stopping at each '/' character
>   +-> for each sub-path
>   +----> stat sub-path
>   +--------> doesn't exist (ENOENT)
>   +-------------> mkdir with file mode 755 || exit error
>   +--------> exists but is not a directory && exit error
> 2. if gid or uid is specified and not equal to effective uid/gid:
>   +-> chown leaf directory || warn
> 3. chmod leaf directory || warn
> Might be interesting to make this a little more robust for "new" directories, and to exit non-0 even for existing dirs, while preserving content.  Will take this up on bugs list for FreeBSD.  Thanks for playing along all.

Without inferring you go elsewhere, (I want to know what happens with this one), may I point you at the following lists:

FreeBSD bugs:

FreeBSD ports and ports-bugs:
(packagers there could be very interested...)

As a last resort, the RELENG team listed here may be able to engage this, (but hit the lists first!):

This however may not be a FreeBSD issue in particular…


More information about the talk mailing list