[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestion for mkdir

From: Bob Proulx
Subject: Re: Suggestion for mkdir
Date: Wed, 20 Nov 2013 16:28:55 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

Eric Blake wrote:
> Renich Bon Ciric wrote:
> > I'd like to suggest that:
> > mkdir -m 2771 -p /tmp/some/nonexistent/dir
> > sets 2751 to all created dirs; not just the last one.
> Such a change would require a new command line option, because the
> current behavior is mandated by POSIX:

I thought I would say a few words in defense of POSIX.  Why is it this
way?  Because the that was the way the command was originally written
to work.  There are a zillion small behaviors like this from when
people wrote a tool (mkdir, mv, cp, etc.) each of the different times
any of the tools were written.  Every time someone wrote a new version
of one of the Unix utilities (because the original was closed and
proprietary) then it would have its own different quirks.  This led to
every Unix-like system being different from each other in the zillion
different ways.  The classic case being SysV versus BSD but now that
would include GNU too.  It was very hard to write a script that would
run the same on different systems.

The purpose of POSIX was to say enough was enough.  Stop the
proliferation of differences.  Document the existing behavior and
standardize upon it so that scripts could be written portably.  As
long as they only used the standard behavior then they could count on
being able to operate the same on every standard platform.

And so we have things like mkdir.  It conforms to the standard because
that is a good thing.  The standard says what it says because
originally it documented the existing behavior of the then current
systems.  And this is good because the alternative of having divergent
behavior everywhere is worse.


Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]