GNU bug report logs - #8749
mkdir: feature request --reference

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Severity: wishlist; Reported by: Shaun Jackman <sjackman@HIDDEN>; dated Fri, 27 May 2011 23:32:03 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 1 Jun 2011 00:30:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 31 20:30:07 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QRZK3-0008Tl-7Z
	for submit <at> debbugs.gnu.org; Tue, 31 May 2011 20:30:07 -0400
Received: from joseki.proulx.com ([216.17.153.58])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <bob@HIDDEN>) id 1QRZK1-0008T1-GD
	for 8749 <at> debbugs.gnu.org; Tue, 31 May 2011 20:30:06 -0400
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id 97BD321310;
	Tue, 31 May 2011 18:29:59 -0600 (MDT)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id 5FD702DC67; Tue, 31 May 2011 18:29:59 -0600 (MDT)
Date: Tue, 31 May 2011 18:29:59 -0600
From: Bob Proulx <bob@HIDDEN>
To: Shaun Jackman <sjackman@HIDDEN>
Subject: Re: bug#8749: mkdir: feature request --reference
Message-ID: <20110601002959.GA4165@HIDDEN>
References: <1306538729.7120.42.camel@HIDDEN>
	<20110529014652.GA3698@HIDDEN>
	<1306776550.4741.4.camel@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1306776550.4741.4.camel@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Spam-Score: -2.4 (--)
X-Debbugs-Envelope-To: 8749
Cc: "8749 <at> debbugs.gnu.org" <8749 <at> debbugs.gnu.org>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.4 (--)

Shaun Jackman wrote:
> I was using exactly that shell function that you described, but it
> doesn't work for
> 	mkdir -p foo/bar

Since we are talking about shell aliases and functions here is a
simple shell snippet that can create the directories with the modes
explicitly.

  #!/bin/sh
  mkdir_px() {
    case $1 in */*) mkdir_px $(dirname "$1") ;; esac
    test -d "$1" || mkdir -m $(stat -c %a .) "$1"
  }
  mkdir_px "$@"
  exit $?

It is a little bit long but not unduly so.

> I've noticed one issue, which I feel is a bug in mkdir. When using mkdir
> -pm, the specified mode is applied only to the final directory and not
> the parent directories:
> 
> $ mkdir -pm 775 foo/bar
> $ ls -ld foo foo/bar
> drwxr-xr-x 3 sjackman assembly 4096 May 30 10:27 foo
> drwxrwxr-x 2 sjackman assembly 4096 May 30 10:27 foo/bar
> 
> I would expect both foo and foo/bar to have mode 775.

That is the original traditional behavior of 'mkdir -p'.  As Paul
pointed out in his follow-up that behavior has been in use and is now
standardized by POSIX lest some new implementation decides to do
something different from the previously implemented behavior.  It is
unfortunate that it was originally implemented that way but having
done so and gotten into common use it is too late to change it now.
That is why POSIX exists is to prevent the proliferation of different
features on every system when corner case behavior like this is
found.  You can pretty much guarentee that someone is counting on that
behavior if for no other reason than just by accident.

Bob




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 31 May 2011 23:10:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 31 19:10:32 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QRY51-0006ph-TC
	for submit <at> debbugs.gnu.org; Tue, 31 May 2011 19:10:32 -0400
Received: from mail.bcgsc.ca ([134.87.4.13])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <sjackman@HIDDEN>) id 1QRY50-0006pU-4m
	for 8749 <at> debbugs.gnu.org; Tue, 31 May 2011 19:10:31 -0400
Received: from MORBO.phage.bcgsc.ca (morbo.bcgsc.ca [10.9.208.112])
	by mail.bcgsc.ca (Postfix) with ESMTP id B429B1AF292;
	Tue, 31 May 2011 16:09:24 -0700 (PDT)
Received: from [10.9.202.58] (10.9.202.58) by morbo.phage.bcgsc.ca
	(10.9.208.112) with Microsoft SMTP Server id 8.1.436.0; Tue, 31 May 2011
	16:11:11 -0700
Subject: Re: bug#8749: mkdir: feature request --reference
From: Shaun Jackman <sjackman@HIDDEN>
To: Bob Proulx <bob@HIDDEN>
In-Reply-To: <20110531224944.GA20129@HIDDEN>
References: <1306538729.7120.42.camel@HIDDEN>
	<20110529014652.GA3698@HIDDEN>
	<1306776550.4741.4.camel@HIDDEN>
	<4DE476C1.8070004@HIDDEN>
	<1306865559.4526.15.camel@HIDDEN>
	<20110531224944.GA20129@HIDDEN>
Content-Type: text/plain
Date: Tue, 31 May 2011 16:10:11 -0700
Message-ID: <1306883411.4526.91.camel@HIDDEN>
MIME-Version: 1.0
X-Mailer: Evolution 2.12.3 (2.12.3-19.el5) 
Content-Transfer-Encoding: 7bit
X-Spam-Score: -3.0 (---)
X-Debbugs-Envelope-To: 8749
Cc: "8749 <at> debbugs.gnu.org" <8749 <at> debbugs.gnu.org>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.0 (---)

On Tue, 2011-05-31 at 15:49 -0700, Bob Proulx wrote:
> Shaun Jackman wrote:
> > My use case is working in a directory shared amongst a group of users.
> > My umask is 022. I run
> 
> If you are working among a group of users then you should set your
> umask to be 02 instead of 022.  That is probably the point where you
> diverged from common practice and started to have these problems with
> mkdir.
> 
> Have you looked at the any of the User Private Group documentation
> yet?  If not then please do so.  Good stuff there.
> 
> > mkdir -pm775 project/subproject
> > and I'd like both project and project/subproject to be group-writable.
> 
> If you set your umask to be 02 then you no longer need to explicitly
> set the mode bits to ug=rwx,o=rx anymore.
> 
> Bob

Hi Bob,

It looks like User Private Groups and setgid directories would solve
most of my issues except for one. I'd like directories to be
group-writable (775) by default and files to group-read-only (644) by
default. Andreas suggested using ACL (setfacl -m d:g::rwx), but my file
system sadly does not support ACL. Any suggestions?

I'm using the following alias for directories that are created
interactively:
alias mkdir='mkdir -m $(stat -c%a .)'

Cheers,
Shaun






Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 31 May 2011 22:56:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 31 18:56:51 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QRXrm-0006Xf-IV
	for submit <at> debbugs.gnu.org; Tue, 31 May 2011 18:56:50 -0400
Received: from mail.bcgsc.ca ([134.87.4.13])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <sjackman@HIDDEN>) id 1QRXrk-0006XS-Uy
	for 8749 <at> debbugs.gnu.org; Tue, 31 May 2011 18:56:49 -0400
Received: from MORBO.phage.bcgsc.ca (morbo.bcgsc.ca [10.9.208.112])
	by mail.bcgsc.ca (Postfix) with ESMTP id 9C2281AF29B;
	Tue, 31 May 2011 15:55:49 -0700 (PDT)
Received: from [10.9.202.58] (10.9.202.58) by morbo.phage.bcgsc.ca
	(10.9.208.112) with Microsoft SMTP Server id 8.1.436.0; Tue, 31 May 2011
	15:57:36 -0700
Subject: Re: bug#8749: mkdir: feature request --reference
From: Shaun Jackman <sjackman@HIDDEN>
To: Bob Proulx <bob@HIDDEN>
In-Reply-To: <20110531224944.GA20129@HIDDEN>
References: <1306538729.7120.42.camel@HIDDEN>
	<20110529014652.GA3698@HIDDEN>
	<1306776550.4741.4.camel@HIDDEN>
	<4DE476C1.8070004@HIDDEN>
	<1306865559.4526.15.camel@HIDDEN>
	<20110531224944.GA20129@HIDDEN>
Content-Type: text/plain
Date: Tue, 31 May 2011 15:56:36 -0700
Message-ID: <1306882596.4526.85.camel@HIDDEN>
MIME-Version: 1.0
X-Mailer: Evolution 2.12.3 (2.12.3-19.el5) 
Content-Transfer-Encoding: 7bit
X-Spam-Score: -3.1 (---)
X-Debbugs-Envelope-To: 8749
Cc: "8749 <at> debbugs.gnu.org" <8749 <at> debbugs.gnu.org>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.0 (---)

On Tue, 2011-05-31 at 15:49 -0700, Bob Proulx wrote:
> Shaun Jackman wrote:
> > My use case is working in a directory shared amongst a group of users.
> > My umask is 022. I run
> 
> If you are working among a group of users then you should set your
> umask to be 02 instead of 022.  That is probably the point where you
> diverged from common practice and started to have these problems with
> mkdir.
> 
> Have you looked at the any of the User Private Group documentation
> yet?  If not then please do so.  Good stuff there.
> 
> > mkdir -pm775 project/subproject
> > and I'd like both project and project/subproject to be group-writable.
> 
> If you set your umask to be 02 then you no longer need to explicitly
> set the mode bits to ug=rwx,o=rx anymore.
> 
> Bob

Hi Bob,

Yes, I have read the documentation on User Private Group. It makes a lot
of sense. Currently all the users of my team are in one group, and so my
umask is 022. I'll have to talk to my systems group about changing our
practice.

Cheers,
Shaun






Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 31 May 2011 22:49:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 31 18:49:53 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QRXl3-0006OK-22
	for submit <at> debbugs.gnu.org; Tue, 31 May 2011 18:49:53 -0400
Received: from joseki.proulx.com ([216.17.153.58])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <bob@HIDDEN>) id 1QRXl0-0006O7-Ji
	for 8749 <at> debbugs.gnu.org; Tue, 31 May 2011 18:49:51 -0400
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id 7C73721310;
	Tue, 31 May 2011 16:49:44 -0600 (MDT)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id 473DF2DC67; Tue, 31 May 2011 16:49:44 -0600 (MDT)
Date: Tue, 31 May 2011 16:49:44 -0600
From: Bob Proulx <bob@HIDDEN>
To: Shaun Jackman <sjackman@HIDDEN>
Subject: Re: bug#8749: mkdir: feature request --reference
Message-ID: <20110531224944.GA20129@HIDDEN>
References: <1306538729.7120.42.camel@HIDDEN>
	<20110529014652.GA3698@HIDDEN>
	<1306776550.4741.4.camel@HIDDEN>
	<4DE476C1.8070004@HIDDEN>
	<1306865559.4526.15.camel@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1306865559.4526.15.camel@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Spam-Score: -2.4 (--)
X-Debbugs-Envelope-To: 8749
Cc: 8749 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.4 (--)

Shaun Jackman wrote:
> My use case is working in a directory shared amongst a group of users.
> My umask is 022. I run

If you are working among a group of users then you should set your
umask to be 02 instead of 022.  That is probably the point where you
diverged from common practice and started to have these problems with
mkdir.

Have you looked at the any of the User Private Group documentation
yet?  If not then please do so.  Good stuff there.

> mkdir -pm775 project/subproject
> and I'd like both project and project/subproject to be group-writable.

If you set your umask to be 02 then you no longer need to explicitly
set the mode bits to ug=rwx,o=rx anymore.

Bob




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 31 May 2011 22:21:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 31 18:21:20 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QRXJP-0005kL-Od
	for submit <at> debbugs.gnu.org; Tue, 31 May 2011 18:21:19 -0400
Received: from mail-out.m-online.net ([212.18.0.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <whitebox@HIDDEN>) id 1QRXJO-0005k9-6M
	for 8749 <at> debbugs.gnu.org; Tue, 31 May 2011 18:21:19 -0400
Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net
	[192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id AECAF188B5A1;
	Wed,  1 Jun 2011 00:21:09 +0200 (CEST)
Received: from localhost (dynscan1.mnet-online.de [192.168.8.164])
	by mail.m-online.net (Postfix) with ESMTP id A0B3B1C00087;
	Wed,  1 Jun 2011 00:21:09 +0200 (CEST)
X-Virus-Scanned: amavisd-new at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.180])
	by localhost (dynscan1.mail.m-online.net [192.168.8.164]) (amavisd-new,
	port 10024)
	with ESMTP id LUIzOtb7O5FD; Wed,  1 Jun 2011 00:21:09 +0200 (CEST)
Received: from igel.home (ppp-93-104-136-200.dynamic.mnet-online.de
	[93.104.136.200]) by mail.mnet-online.de (Postfix) with ESMTP;
	Wed,  1 Jun 2011 00:21:08 +0200 (CEST)
Received: by igel.home (Postfix, from userid 501)
	id 7329DCA29C; Wed,  1 Jun 2011 00:21:08 +0200 (CEST)
From: Andreas Schwab <schwab@HIDDEN>
To: Shaun Jackman <sjackman@HIDDEN>
Subject: Re: bug#8749: mkdir: feature request --reference
References: <1306538729.7120.42.camel@HIDDEN>
	<20110529014652.GA3698@HIDDEN>
	<1306776550.4741.4.camel@HIDDEN>
	<4DE476C1.8070004@HIDDEN>
	<1306865559.4526.15.camel@HIDDEN>
X-Yow: LBJ, LBJ, how many JOKES did you tell today??!
Date: Wed, 01 Jun 2011 00:21:08 +0200
In-Reply-To: <1306865559.4526.15.camel@HIDDEN> (Shaun
	Jackman's message of "Tue, 31 May 2011 11:12:39 -0700")
Message-ID: <m2zkm2fr57.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 8749
Cc: Paul Eggert <eggert@HIDDEN>,
	"8749 <at> debbugs.gnu.org" <8749 <at> debbugs.gnu.org>, Bob Proulx <bob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

Shaun Jackman <sjackman@HIDDEN> writes:

> My use case is working in a directory shared amongst a group of users.
> My umask is 022. I run
> mkdir -pm775 project/subproject
> and I'd like both project and project/subproject to be group-writable.

If the filesystem supports ACLs then you can add a default ACL to the
project directory with `setfacl -m d:g::rwx'.  This will arrange to
grant group write access by default to all newly created
files/directories in that directory.

Andreas.

-- 
Andreas Schwab, schwab@HIDDEN
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 31 May 2011 20:38:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 31 16:38:15 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QRVhf-00011Q-IW
	for submit <at> debbugs.gnu.org; Tue, 31 May 2011 16:38:15 -0400
Received: from mail.bcgsc.ca ([134.87.4.13])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <sjackman@HIDDEN>) id 1QRVhd-00011C-K9
	for 8749 <at> debbugs.gnu.org; Tue, 31 May 2011 16:38:14 -0400
Received: from MORBO.phage.bcgsc.ca (morbo.bcgsc.ca [10.9.208.112])
	by mail.bcgsc.ca (Postfix) with ESMTP id E5CF91AF28E;
	Tue, 31 May 2011 13:37:19 -0700 (PDT)
Received: from [10.9.202.58] (10.9.202.58) by morbo.phage.bcgsc.ca
	(10.9.208.112) with Microsoft SMTP Server id 8.1.436.0; Tue, 31 May 2011
	13:39:06 -0700
Subject: Re: bug#8749: mkdir: feature request --reference
From: Shaun Jackman <sjackman@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <4DE54A48.9000805@HIDDEN>
References: <1306538729.7120.42.camel@HIDDEN>
	<20110529014652.GA3698@HIDDEN>
	<1306776550.4741.4.camel@HIDDEN>
	<4DE476C1.8070004@HIDDEN>
	<1306865559.4526.15.camel@HIDDEN>
	<4DE54A48.9000805@HIDDEN>
Content-Type: text/plain
Date: Tue, 31 May 2011 13:38:06 -0700
Message-ID: <1306874286.4526.29.camel@HIDDEN>
MIME-Version: 1.0
X-Mailer: Evolution 2.12.3 (2.12.3-19.el5) 
Content-Transfer-Encoding: 7bit
X-Spam-Score: -3.3 (---)
X-Debbugs-Envelope-To: 8749
Cc: "8749 <at> debbugs.gnu.org" <8749 <at> debbugs.gnu.org>, Bob Proulx <bob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.2 (---)

On Tue, 2011-05-31 at 13:06 -0700, Paul Eggert wrote:
> On 05/31/11 11:12, Shaun Jackman wrote:
> 
> > My use case is working in a directory shared amongst a group of users.
> > My umask is 022. I run
> > mkdir -pm775 project/subproject
> 
> You're typing stuff like that by hand?  I'd expect that sort of
> thing to be in a script.  Either way, you can do this instead:
> 
> (umask g+w; mkdir -p project/subproject)
> 
> This is portable and doesn't require any changes to mkdir.

Hi Paul,

I'm using an alias so that a directory is created with the same
permissions as its parent:
alias mkdir='mkdir -m $(stat -c%a .)'

By hand I'm typing
mkdir -p project/subproject

Your umask suggestion is good. I hadn't thought of changing the umask in
a subshell.

Cheers,
Shaun






Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 31 May 2011 20:06:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 31 16:06:53 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QRVDJ-0000LX-94
	for submit <at> debbugs.gnu.org; Tue, 31 May 2011 16:06:53 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@HIDDEN>) id 1QRVDG-0000LI-74
	for 8749 <at> debbugs.gnu.org; Tue, 31 May 2011 16:06:51 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id 6E26D39E80F9;
	Tue, 31 May 2011 13:06:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
	by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id rOt8ME8IcEpC; Tue, 31 May 2011 13:06:43 -0700 (PDT)
Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 18FF839E80F0;
	Tue, 31 May 2011 13:06:43 -0700 (PDT)
Message-ID: <4DE54A48.9000805@HIDDEN>
Date: Tue, 31 May 2011 13:06:32 -0700
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US;
	rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10
MIME-Version: 1.0
To: Shaun Jackman <sjackman@HIDDEN>
Subject: Re: bug#8749: mkdir: feature request --reference
References: <1306538729.7120.42.camel@HIDDEN>	<20110529014652.GA3698@HIDDEN>	<1306776550.4741.4.camel@HIDDEN>	<4DE476C1.8070004@HIDDEN>
	<1306865559.4526.15.camel@HIDDEN>
In-Reply-To: <1306865559.4526.15.camel@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Spam-Score: -3.2 (---)
X-Debbugs-Envelope-To: 8749
Cc: "8749 <at> debbugs.gnu.org" <8749 <at> debbugs.gnu.org>, Bob Proulx <bob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.2 (---)

On 05/31/11 11:12, Shaun Jackman wrote:

> My use case is working in a directory shared amongst a group of users.
> My umask is 022. I run
> mkdir -pm775 project/subproject

You're typing stuff like that by hand?  I'd expect that sort of
thing to be in a script.  Either way, you can do this instead:

(umask g+w; mkdir -p project/subproject)

This is portable and doesn't require any changes to mkdir.




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 31 May 2011 18:13:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 31 14:13:01 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QRTR6-0006MS-OE
	for submit <at> debbugs.gnu.org; Tue, 31 May 2011 14:13:01 -0400
Received: from mail.bcgsc.ca ([134.87.4.13])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <sjackman@HIDDEN>) id 1QRTR4-0006ME-JI
	for 8749 <at> debbugs.gnu.org; Tue, 31 May 2011 14:12:59 -0400
Received: from MORBO.phage.bcgsc.ca (morbo.bcgsc.ca [10.9.208.112])
	by mail.bcgsc.ca (Postfix) with ESMTP id 25B551AF28E;
	Tue, 31 May 2011 11:11:53 -0700 (PDT)
Received: from [10.9.202.58] (10.9.202.58) by morbo.phage.bcgsc.ca
	(10.9.208.112) with Microsoft SMTP Server id 8.1.436.0; Tue, 31 May 2011
	11:13:39 -0700
Subject: Re: bug#8749: mkdir: feature request --reference
From: Shaun Jackman <sjackman@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <4DE476C1.8070004@HIDDEN>
References: <1306538729.7120.42.camel@HIDDEN>
	<20110529014652.GA3698@HIDDEN>
	<1306776550.4741.4.camel@HIDDEN>
	<4DE476C1.8070004@HIDDEN>
Content-Type: text/plain
Date: Tue, 31 May 2011 11:12:39 -0700
Message-ID: <1306865559.4526.15.camel@HIDDEN>
MIME-Version: 1.0
X-Mailer: Evolution 2.12.3 (2.12.3-19.el5) 
Content-Transfer-Encoding: 7bit
X-Spam-Score: -3.6 (---)
X-Debbugs-Envelope-To: 8749
Cc: "8749 <at> debbugs.gnu.org" <8749 <at> debbugs.gnu.org>, Bob Proulx <bob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.4 (---)

Hi Paul,

My use case is working in a directory shared amongst a group of users.
My umask is 022. I run
mkdir -pm775 project/subproject
and I'd like both project and project/subproject to be group-writable.

Cheers,
Shaun

On Mon, 2011-05-30 at 22:04 -0700, Paul Eggert wrote:
> On 05/30/11 10:29, Shaun Jackman wrote:
> > When using mkdir
> > -pm, the specified mode is applied only to the final directory and not
> > the parent directories
> 
> That behavior is required by POSIX; see
> <http://pubs.opengroup.org/onlinepubs/9699919799/utilities/mkdir.html>.
> 
> Perhaps an argument could be made for a new option, which would
> have the behavior you'd prefer; it'd be nice to see use cases.





Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 31 May 2011 05:04:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 31 01:04:21 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QRH7q-0003aV-2N
	for submit <at> debbugs.gnu.org; Tue, 31 May 2011 01:04:21 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@HIDDEN>) id 1QRH7l-0003aF-2Y
	for 8749 <at> debbugs.gnu.org; Tue, 31 May 2011 01:04:17 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id 9509039E8100;
	Mon, 30 May 2011 22:04:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
	by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id bKbfbyrTFOIl; Mon, 30 May 2011 22:04:02 -0700 (PDT)
Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net
	[71.189.109.235])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 2807739E80E0;
	Mon, 30 May 2011 22:04:02 -0700 (PDT)
Message-ID: <4DE476C1.8070004@HIDDEN>
Date: Mon, 30 May 2011 22:04:01 -0700
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10
MIME-Version: 1.0
To: Shaun Jackman <sjackman@HIDDEN>
Subject: Re: bug#8749: mkdir: feature request --reference
References: <1306538729.7120.42.camel@HIDDEN>	<20110529014652.GA3698@HIDDEN>
	<1306776550.4741.4.camel@HIDDEN>
In-Reply-To: <1306776550.4741.4.camel@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Spam-Score: -3.0 (---)
X-Debbugs-Envelope-To: 8749
Cc: "8749 <at> debbugs.gnu.org" <8749 <at> debbugs.gnu.org>, Bob Proulx <bob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.0 (---)

On 05/30/11 10:29, Shaun Jackman wrote:
> When using mkdir
> -pm, the specified mode is applied only to the final directory and not
> the parent directories

That behavior is required by POSIX; see
<http://pubs.opengroup.org/onlinepubs/9699919799/utilities/mkdir.html>.

Perhaps an argument could be made for a new option, which would
have the behavior you'd prefer; it'd be nice to see use cases.




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 30 May 2011 17:29:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 30 13:29:31 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QR6HT-0005Wj-GI
	for submit <at> debbugs.gnu.org; Mon, 30 May 2011 13:29:31 -0400
Received: from mail.bcgsc.ca ([134.87.4.13])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <sjackman@HIDDEN>) id 1QR6HR-0005WX-LV
	for 8749 <at> debbugs.gnu.org; Mon, 30 May 2011 13:29:30 -0400
Received: from MORBO.phage.bcgsc.ca (morbo.bcgsc.ca [10.9.208.112])
	by mail.bcgsc.ca (Postfix) with ESMTP id A95A01AF29B;
	Mon, 30 May 2011 10:28:24 -0700 (PDT)
Received: from [10.9.202.58] (10.9.202.58) by morbo.phage.bcgsc.ca
	(10.9.208.112) with Microsoft SMTP Server id 8.1.436.0; Mon, 30 May 2011
	10:30:09 -0700
Subject: Re: bug#8749: mkdir: feature request --reference
From: Shaun Jackman <sjackman@HIDDEN>
To: Bob Proulx <bob@HIDDEN>
In-Reply-To: <20110529014652.GA3698@HIDDEN>
References: <1306538729.7120.42.camel@HIDDEN>
	<20110529014652.GA3698@HIDDEN>
Content-Type: text/plain
Date: Mon, 30 May 2011 10:29:10 -0700
Message-ID: <1306776550.4741.4.camel@HIDDEN>
MIME-Version: 1.0
X-Mailer: Evolution 2.12.3 (2.12.3-19.el5) 
Content-Transfer-Encoding: 7bit
X-Spam-Score: -4.6 (----)
X-Debbugs-Envelope-To: 8749
Cc: "8749 <at> debbugs.gnu.org" <8749 <at> debbugs.gnu.org>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.9 (---)

Hi Bob,

I was using exactly that shell function that you described, but it
doesn't work for
	mkdir -p foo/bar

I'm using the alias you gave, which works better. Thanks.

I've noticed one issue, which I feel is a bug in mkdir. When using mkdir
-pm, the specified mode is applied only to the final directory and not
the parent directories:

$ mkdir -pm 775 foo/bar
$ ls -ld foo foo/bar
drwxr-xr-x 3 sjackman assembly 4096 May 30 10:27 foo
drwxrwxr-x 2 sjackman assembly 4096 May 30 10:27 foo/bar

I would expect both foo and foo/bar to have mode 775.

Cheers,
Shaun

On Sat, 2011-05-28 at 18:46 -0700, Bob Proulx wrote:
> Shaun Jackman wrote:
> > My primary use case for this feature is to create a shell alias:
> > 	alias mkdir='mkdir --reference=.'
> > so that in interactive shells, new directories are created with the same
> > permissions as their parent directory.
> 
> If your primary purpose is for an alias then you can do it this way:
> 
>   alias mkdirchmod='mkdir -m $(stat -c %a .)'
> 
>   alias mkdirchmod='install -d -m $(stat -c %a .)'
> 
> However a shell function might serve you better:
> 
>   mkdirchmod() { mkdir "$@" ; chmod --reference=. "$@" ;}
> 
> But I think this task is better served by not doing it all and instead
> using the technique of User Private Groups.
> 
> > My goal is to have directories in my personal home directory to have
> > permission 755 and directories in my shared work space to have
> > permission 775, so that other members of my group may create new files
> > in shared directories. Files should have permission 755 so that members
> > of my group cannot modify files that I've created.
> 
> The UPG (User Private Group) technique works very well in this
> situation.  There is a lot of documentation available on UPG on the
> net and so I won't include a specific pointer.  Search for it and you
> will find a lot of information on it.  And different operating systems
> deal with configuring it differently and so you would want to look at
> documentation for your particular system.  But I highly recommend
> using the technique.
> 
> I generally dislike combining the functionality of several different
> commands into one command.  In this case combining mkdir and chmod and
> I don't see any reason they can't be used individually.  Plus mkdir
> already allows you to create directories with a specified permission
> and this is feature creep into the area of the 'install' command which
> also already allows creating directories of specified permissions.
> 
> Bob





Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 30 May 2011 07:23:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 30 03:23:22 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QQwor-00005u-MV
	for submit <at> debbugs.gnu.org; Mon, 30 May 2011 03:23:21 -0400
Received: from mail27.messagelabs.com ([193.109.254.147])
	by debbugs.gnu.org with smtp (Exim 4.69)
	(envelope-from <bernhard.voelker@HIDDEN>)
	id 1QQwop-00005i-2E
	for 8749 <at> debbugs.gnu.org; Mon, 30 May 2011 03:23:19 -0400
X-VirusChecked: Checked
X-Env-Sender: bernhard.voelker@HIDDEN
X-Msg-Ref: server-10.tower-27.messagelabs.com!1306740184!33541291!1
X-StarScan-Version: 6.2.17; banners=-,-,-
X-Originating-IP: [62.134.46.9]
Received: (qmail 27649 invoked from network); 30 May 2011 07:23:04 -0000
Received: from unknown (HELO senmx11-mx) (62.134.46.9)
	by server-10.tower-27.messagelabs.com with SMTP;
	30 May 2011 07:23:04 -0000
Received: from MCHP063A.global-ad.net (unknown [172.29.37.61])
	by senmx11-mx (Server) with ESMTP id B255F1EB83E1;
	Mon, 30 May 2011 09:23:12 +0200 (CEST)
Received: from MCHP058A.global-ad.net ([172.29.37.55]) by
	MCHP063A.global-ad.net ([172.29.37.61]) with mapi;
	Mon, 30 May 2011 09:23:12 +0200
From: "Voelker, Bernhard" <bernhard.voelker@HIDDEN>
To: Bob Proulx <bob@HIDDEN>, Shaun Jackman <sjackman@HIDDEN>
Date: Mon, 30 May 2011 09:23:11 +0200
Subject: RE: bug#8749: mkdir: feature request --reference
Thread-Topic: bug#8749: mkdir: feature request --reference
Thread-Index: AcwdolL3+fxIkP4STImx1EMTIZXkcgA9r3Sw
Message-ID: <7856072A9D04C24B82DFE2B1112FE38A087A2F9CB4@HIDDEN>
References: <1306538729.7120.42.camel@HIDDEN>
	<20110529014652.GA3698@HIDDEN>
In-Reply-To: <20110529014652.GA3698@HIDDEN>
Accept-Language: de-DE, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: de-DE, en-US
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Spam-Score: -4.8 (----)
X-Debbugs-Envelope-To: 8749
Cc: "8749 <at> debbugs.gnu.org" <8749 <at> debbugs.gnu.org>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.9 (----)

Bob Proulx wrote:=20

> I generally dislike combining the functionality of several different
> commands into one command.  In this case combining mkdir and chmod and
> I don't see any reason they can't be used individually.  Plus mkdir
> already allows you to create directories with a specified permission
> and this is feature creep into the area of the 'install' command which
> also already allows creating directories of specified permissions.

well, 'mkdir --reference=3Dfile' could be the sister of 'touch -r file',
so creating a directory with both the perms and the timestamps of the
reference file/directory. I don't know when 'touch' has been enhanced
for '--reference' but wasn't it the same question then?

Have a nice day,
Berny





Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at 8749 <at> debbugs.gnu.org:


Received: (at 8749) by debbugs.gnu.org; 29 May 2011 01:47:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 28 21:47:01 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QQV5p-0007nO-2V
	for submit <at> debbugs.gnu.org; Sat, 28 May 2011 21:47:01 -0400
Received: from joseki.proulx.com ([216.17.153.58])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <bob@HIDDEN>) id 1QQV5m-0007nC-Bw
	for 8749 <at> debbugs.gnu.org; Sat, 28 May 2011 21:46:59 -0400
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
	by joseki.proulx.com (Postfix) with ESMTP id 7A05321311;
	Sat, 28 May 2011 19:46:52 -0600 (MDT)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
	id 32F812DC5D; Sat, 28 May 2011 19:46:52 -0600 (MDT)
Date: Sat, 28 May 2011 19:46:52 -0600
From: Bob Proulx <bob@HIDDEN>
To: Shaun Jackman <sjackman@HIDDEN>
Subject: Re: bug#8749: mkdir: feature request --reference
Message-ID: <20110529014652.GA3698@HIDDEN>
References: <1306538729.7120.42.camel@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1306538729.7120.42.camel@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Spam-Score: -2.4 (--)
X-Debbugs-Envelope-To: 8749
Cc: 8749 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.4 (--)

Shaun Jackman wrote:
> My primary use case for this feature is to create a shell alias:
> 	alias mkdir='mkdir --reference=.'
> so that in interactive shells, new directories are created with the same
> permissions as their parent directory.

If your primary purpose is for an alias then you can do it this way:

  alias mkdirchmod='mkdir -m $(stat -c %a .)'

  alias mkdirchmod='install -d -m $(stat -c %a .)'

However a shell function might serve you better:

  mkdirchmod() { mkdir "$@" ; chmod --reference=. "$@" ;}

But I think this task is better served by not doing it all and instead
using the technique of User Private Groups.

> My goal is to have directories in my personal home directory to have
> permission 755 and directories in my shared work space to have
> permission 775, so that other members of my group may create new files
> in shared directories. Files should have permission 755 so that members
> of my group cannot modify files that I've created.

The UPG (User Private Group) technique works very well in this
situation.  There is a lot of documentation available on UPG on the
net and so I won't include a specific pointer.  Search for it and you
will find a lot of information on it.  And different operating systems
deal with configuring it differently and so you would want to look at
documentation for your particular system.  But I highly recommend
using the technique.

I generally dislike combining the functionality of several different
commands into one command.  In this case combining mkdir and chmod and
I don't see any reason they can't be used individually.  Plus mkdir
already allows you to create directories with a specified permission
and this is feature creep into the area of the 'install' command which
also already allows creating directories of specified permissions.

Bob




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 May 2011 23:31:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 19:31:35 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QQ6VA-0005Nn-IX
	for submit <at> debbugs.gnu.org; Fri, 27 May 2011 19:31:32 -0400
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <sjackman@HIDDEN>) id 1QQ6Pl-000583-EB
	for submit <at> debbugs.gnu.org; Fri, 27 May 2011 19:25:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <sjackman@HIDDEN>) id 1QQ6Pf-0008Tl-FS
	for submit <at> debbugs.gnu.org; Fri, 27 May 2011 19:25:52 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD
	autolearn=unavailable version=3.3.1
Received: from lists.gnu.org ([140.186.70.17]:46333)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <sjackman@HIDDEN>) id 1QQ6Pf-0008Th-Ds
	for submit <at> debbugs.gnu.org; Fri, 27 May 2011 19:25:51 -0400
Received: from eggs.gnu.org ([140.186.70.92]:47332)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <sjackman@HIDDEN>) id 1QQ6Pe-000558-K9
	for bug-coreutils@HIDDEN; Fri, 27 May 2011 19:25:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <sjackman@HIDDEN>) id 1QQ6Pd-0008TE-Tb
	for bug-coreutils@HIDDEN; Fri, 27 May 2011 19:25:50 -0400
Received: from mail.bcgsc.ca ([134.87.4.13]:42824)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <sjackman@HIDDEN>) id 1QQ6Pd-0008SA-PI
	for bug-coreutils@HIDDEN; Fri, 27 May 2011 19:25:49 -0400
Received: from MORBO.phage.bcgsc.ca (morbo.bcgsc.ca [10.9.208.112])
	by mail.bcgsc.ca (Postfix) with ESMTP id EE1371AF295
	for <bug-coreutils@HIDDEN>; Fri, 27 May 2011 16:24:46 -0700 (PDT)
Received: from [10.9.202.58] (10.9.202.58) by morbo.phage.bcgsc.ca
	(10.9.208.112) with Microsoft SMTP Server id 8.1.436.0; Fri, 27 May 2011
	16:26:28 -0700
Subject: mkdir: feature request --reference
From: Shaun Jackman <sjackman@HIDDEN>
To: Coreutils <bug-coreutils@HIDDEN>
Content-Type: text/plain
Date: Fri, 27 May 2011 16:25:29 -0700
Message-ID: <1306538729.7120.42.camel@HIDDEN>
MIME-Version: 1.0
X-Mailer: Evolution 2.12.3 (2.12.3-19.el5) 
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 140.186.70.17
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 27 May 2011 19:31:31 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.6 (------)

Hi,

mkdir has an option -m to set the permission mode of the directory. I
would find it useful for mkdir to have a --reference=FILE option that
works identically to chmod.

My primary use case for this feature is to create a shell alias:
	alias mkdir='mkdir --reference=.'
so that in interactive shells, new directories are created with the same
permissions as their parent directory.

My goal is to have directories in my personal home directory to have
permission 755 and directories in my shared work space to have
permission 775, so that other members of my group may create new files
in shared directories. Files should have permission 755 so that members
of my group cannot modify files that I've created.

Thanks,
Shaun






Acknowledgement sent to Shaun Jackman <sjackman@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN:
bug#8749; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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