From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 17 11:34:57 2016 Received: (at submit) by debbugs.gnu.org; 17 Aug 2016 15:34:57 +0000 Received: from localhost ([127.0.0.1]:60419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba2rp-0003o8-5l for submit@debbugs.gnu.org; Wed, 17 Aug 2016 11:34:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35050) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZzFF-0006BA-Gk for submit@debbugs.gnu.org; Wed, 17 Aug 2016 07:42:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZzF9-0004YX-8L for submit@debbugs.gnu.org; Wed, 17 Aug 2016 07:42:48 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZzF9-0004Y8-50 for submit@debbugs.gnu.org; Wed, 17 Aug 2016 07:42:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZzF6-0002yB-Mc for bug-coreutils@gnu.org; Wed, 17 Aug 2016 07:42:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZzF4-0004XJ-JC for bug-coreutils@gnu.org; Wed, 17 Aug 2016 07:42:43 -0400 Received: from mail-it0-x233.google.com ([2607:f8b0:4001:c0b::233]:35650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZzF4-0004XA-BV for bug-coreutils@gnu.org; Wed, 17 Aug 2016 07:42:42 -0400 Received: by mail-it0-x233.google.com with SMTP id x131so39855281ite.0 for ; Wed, 17 Aug 2016 04:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=O1WlJe+STtTZZPgIfZs2liGlQwbD4194LGBq5wRgVhQ=; b=PJSFldWKNVeoi0xPcPq3tt4fGzYGOcpxSN9dBVvt0TOw/9hl3Y9RiwgxDFIC7rKx96 SpUofJzb/1iAfm/Bwlh/iA5DLuPSGscR5bywU4QTnkSjWkXe5gDWzNjAMiXupQOt+72B rFVe2em2a4nJFViPVgn5PFC0fp+NzhWpB9d3vrS4wBiSc4TJ2N2SCPZ3YSLXUTIMP1zb qJ1QZZu7YwZ5d4/pE9+VkP9o7sGDHMl+ut9uo1mQJzLf9e8ZgvuLWm/VO69J1gstEJ1u LoLMvJtBmlu8ukm2YD5H0VxRM13pMOfmwFOtebU2RpSNalRerwO4SNP2U3TlYeGHs+1q epBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=O1WlJe+STtTZZPgIfZs2liGlQwbD4194LGBq5wRgVhQ=; b=HbLe9eUAMJ6iFbR6h7LTSmyLoo+qjPin00YyYBt2mNoNmtc9FmDpQjsm/7aej3J2Xs D8kCglxPEWlac/uIWBHlWvuC66Ugmd2JXGABZSKptxEE58LoGY+sFlZS9aXnlMqCYwdl SlKqfBmJr9uX2yW4EDAxxrALPIdWtpuLxDfUJjrVHXKH/MxIT6gXBEkrOfSb3GYP9UHC z7cdeI2i+6FuyDCgBarSD+u4UnAWw7pFXjhMbAXJjW6j/rHnjX/QGjz8SXWr88nbI3aW pEukInZSNltudKAT/hLnI1d26vJF0OPOfYwy0P5UPb3GZgy9bxoKm+ncYk8uFNcV82/6 3KvA== X-Gm-Message-State: AEkooutn4bJhTcFrD1qJADW6q4CB5pkIEpSQK/MqKs3wHznhCyKJF7JQ1aW+JV3xcfRCUOYMnbpHxpmeRmOxew== X-Received: by 10.36.71.6 with SMTP id t6mr1082650itb.39.1471434161058; Wed, 17 Aug 2016 04:42:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.12.77 with HTTP; Wed, 17 Aug 2016 04:42:40 -0700 (PDT) From: Mark Mitchell Date: Wed, 17 Aug 2016 11:42:40 +0000 Message-ID: Subject: Potential cp bug: directories created with --parents and --no-preserve=mode retain original mode bits don't match ~umask To: bug-coreutils@gnu.org Content-Type: multipart/mixed; boundary=001a1143e9587b6b1d053a42f63d X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 17 Aug 2016 11:34:56 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) --001a1143e9587b6b1d053a42f63d Content-Type: multipart/alternative; boundary=001a1143e9587b6b18053a42f63b --001a1143e9587b6b18053a42f63b Content-Type: text/plain; charset=UTF-8 Hi, I'm writing to report a potential bug with cp. I don't think the mode bits always get properly set on directories created when using the --parents option combined with --no-preserve=mode option. I'm not sure what the expected behaviour is supposed to be, but my assumption is that the created directories would match process's ~umask (like mkdir -p). I've attached a simple script and its output to demonstrate the behaviour. I've tested this on the most recent master branch of the coreutils git repository (output of git describe is 'v8.25-55-gff2178b'). Thanks for your efforts on these utilities, it is much appreciated :-). -Mark --001a1143e9587b6b18053a42f63b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I'm writing to r= eport a potential bug with cp.=C2=A0 I don't think the mode bits always= get properly set on directories created when using the --parents option co= mbined with --no-preserve=3Dmode option.=C2=A0 I'm not sure what the ex= pected behaviour is supposed to be, but my assumption is that the created d= irectories would match process's ~umask (like mkdir -p).

<= div>I've attached a simple script and its output to demonstrate the beh= aviour.=C2=A0 I've tested this on the most recent master branch of the = coreutils git repository (output of git describe is 'v8.25-55-gff2178b&= #39;).

Thanks for your efforts on these utilities, it is = much appreciated :-).

-Mark
--001a1143e9587b6b18053a42f63b-- --001a1143e9587b6b1d053a42f63d Content-Type: text/plain; charset=US-ASCII; name="test-output.txt" Content-Disposition: attachment; filename="test-output.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_irytswzp1 T3JpZ2luYWwgc291cmNlIGRpcmVjdG9yaWVzIGFuZCBmaWxlcwpscyAtbGEKdG90YWwgMjAKZHJ3 eHJ3eHIteCAzIG1hcmsgbWFyayA0MDk2IEF1ZyAxNyAxMTozOCAuCmRyd3hyLXhyLXggNCBtYXJr IG1hcmsgNDA5NiBBdWcgMTcgMDM6NDQgLi4KZHJ3eC0tLS0tLSAzIG1hcmsgbWFyayA0MDk2IEF1 ZyAxNyAxMTozOCBhCi1yd3hyd3hyLXggMSBtYXJrIG1hcmsgMTA2MCBBdWcgMTcgMTE6MzcgdGVz dC1jcC1wYXJlbnRzLXVtYXNrLnNoCi1ydy1yLS1yLS0gMSBtYXJrIG1hcmsgICA0NSBBdWcgMTcg MTE6MzggdGVzdC1vdXRwdXQudHh0CnRvdGFsIDgKZHJ3eHIteHIteCAyIG1hcmsgbWFyayA0MDk2 IEF1ZyAxNyAxMTozOCAuCmRyd3gtLS0tLS0gMyBtYXJrIG1hcmsgNDA5NiBBdWcgMTcgMTE6Mzgg Li4KLXJ3eHJ3eHIteCAxIG1hcmsgbWFyayAgICAwIEF1ZyAxNyAxMTozOCBjX2ZpbGUKQ29weWlu ZyB3aXRoIC0tcGFyZW50cyB3aXRoIG5vcm1hbCBtb2RlIHByZXNlcnZhdGlvbiAoYW5kIHVtYXNr PTAwMDIpCmNwIC0tcGFyZW50cyBhL2IvY19maWxlIHRlc3RfcHJlc2VydmVkLwpub3JtYWwgY2Fz ZSwgcGVybWlzc2lvbnMgb24gZGlyZWN0b3J5IG1hdGNoIHRoZWlyIG9yaWdpbmFscwpscyAtbGEg dGVzdF9wcmVzZXJ2ZWQvCnRvdGFsIDEyCmRyd3hyLXhyLXggMyBtYXJrIG1hcmsgNDA5NiBBdWcg MTcgMTE6MzggLgpkcnd4cnd4ci14IDQgbWFyayBtYXJrIDQwOTYgQXVnIDE3IDExOjM4IC4uCmRy d3gtLS0tLS0gMyBtYXJrIG1hcmsgNDA5NiBBdWcgMTcgMTE6MzggYQp0b3RhbCA4CmRyd3hyLXhy LXggMiBtYXJrIG1hcmsgNDA5NiBBdWcgMTcgMTE6MzggLgpkcnd4LS0tLS0tIDMgbWFyayBtYXJr IDQwOTYgQXVnIDE3IDExOjM4IC4uCi1yd3hyd3hyLXggMSBtYXJrIG1hcmsgICAgMCBBdWcgMTcg MTE6MzggY19maWxlCkNvcHlpbmcgd2l0aCAtLXBhcmVudHMgYW5kIC0tbm8tcHJlc2VydmU9bW9k ZQpjcCAtLXBhcmVudHMgLS1uby1wcmVzZXJ2ZT1tb2RlIGEvYi9jX2ZpbGUgdGVzdF91bWFzay8K ZmFpbHVyZSBjYXNlIC0gZGlyZWN0b3J5IGEgcmV0YWlucyBpdHMgb3JpZ2luYWwgcGVybWlzc2lv bnMgZXZlbiB0aG91Z2ggLS1uby1wcmVzZXJ2ZT1tb2RlIHdhcyB1c2VkCmxzIC1sYSB0ZXN0X3Vt YXNrLwp0b3RhbCAxMgpkcnd4cnd4ci14IDMgbWFyayBtYXJrIDQwOTYgQXVnIDE3IDExOjM4IC4K ZHJ3eHJ3eHIteCA1IG1hcmsgbWFyayA0MDk2IEF1ZyAxNyAxMTozOCAuLgpkcnd4LS0tLS0tIDMg bWFyayBtYXJrIDQwOTYgQXVnIDE3IDExOjM4IGEKbm90ZSB0aG91Z2ggdGhhdCBtb2RlIGJpdHMg Zm9yIGNfZmlsZSBhcmUgc2V0IGNvcnJlY3RseSBhY2NvcmRpbmcgdG8gdW1hc2sKbHMgLWxhIHRl c3RfdW1hc2svYS9iLwp0b3RhbCA4CmRyd3hyLXhyLXggMiBtYXJrIG1hcmsgNDA5NiBBdWcgMTcg MTE6MzggLgpkcnd4LS0tLS0tIDMgbWFyayBtYXJrIDQwOTYgQXVnIDE3IDExOjM4IC4uCi1ydy1y dy1yLS0gMSBtYXJrIG1hcmsgICAgMCBBdWcgMTcgMTE6MzggY19maWxlCg== --001a1143e9587b6b1d053a42f63d Content-Type: application/x-sh; name="test-cp-parents-umask.sh" Content-Disposition: attachment; filename="test-cp-parents-umask.sh" Content-Transfer-Encoding: base64 X-Attachment-Id: f_irytsmkg0 IyEvYmluL2Jhc2gKCnNldCAtZQoKcm0gLXJmIGEvCnJtIC1yZiB0ZXN0X3ByZXNlcnZlZC8Kcm0g LXJmIHRlc3RfdW1hc2sKCnVtYXNrIDAwMjIKbWtkaXIgLXAgYS9iCmNobW9kIDA3MDAgYQp0b3Vj aCBhL2IvY19maWxlCmNobW9kIDc3NSBhL2IvY19maWxlCgplY2hvIE9yaWdpbmFsIHNvdXJjZSBk aXJlY3RvcmllcyBhbmQgZmlsZXMKZWNobyAgbHMgLWxhCmxzIC1sYQpscyAtbGEgYS9iCgpta2Rp ciB0ZXN0X3ByZXNlcnZlZAp1bWFzayAwMDAyCmVjaG8gQ29weWluZyB3aXRoIC0tcGFyZW50cyB3 aXRoIG5vcm1hbCBtb2RlIHByZXNlcnZhdGlvbiBcKGFuZCB1bWFzaz0wMDAyXCkKZWNobyBjcCAt LXBhcmVudHMgYS9iL2NfZmlsZSB0ZXN0X3ByZXNlcnZlZC8KY3AgLS1wYXJlbnRzIGEvYi9jX2Zp bGUgdGVzdF9wcmVzZXJ2ZWQvCgplY2hvIG5vcm1hbCBjYXNlLCBwZXJtaXNzaW9ucyBvbiBkaXJl Y3RvcnkgbWF0Y2ggdGhlaXIgb3JpZ2luYWxzCmVjaG8gIGxzIC1sYSB0ZXN0X3ByZXNlcnZlZC8K bHMgLWxhIHRlc3RfcHJlc2VydmVkLwojIGEgPSAwNzAwCgpscyAtbGEgdGVzdF9wcmVzZXJ2ZWQv YS9iCiMgY19maWxlID0gNzc3Cgpta2RpciB0ZXN0X3VtYXNrCmVjaG8gQ29weWluZyB3aXRoIC0t cGFyZW50cyBhbmQgLS1uby1wcmVzZXJ2ZT1tb2RlCmVjaG8gY3AgLS1wYXJlbnRzIC0tbm8tcHJl c2VydmU9bW9kZSBhL2IvY19maWxlIHRlc3RfdW1hc2svCmNwIC0tcGFyZW50cyAtLW5vLXByZXNl cnZlPW1vZGUgYS9iL2NfZmlsZSB0ZXN0X3VtYXNrLwoKZWNobyBmYWlsdXJlIGNhc2UgLSBkaXJl Y3RvcnkgJ2EnIHJldGFpbnMgaXRzIG9yaWdpbmFsIHBlcm1pc3Npb25zIGV2ZW4gdGhvdWdoIC0t bm8tcHJlc2VydmU9bW9kZSB3YXMgdXNlZAplY2hvICBscyAtbGEgdGVzdF91bWFzay8KbHMgLWxh IHRlc3RfdW1hc2svCgplY2hvIG5vdGUgdGhvdWdoIHRoYXQgbW9kZSBiaXRzIGZvciBjX2ZpbGUg YXJlIHNldCBjb3JyZWN0bHkgYWNjb3JkaW5nIHRvIHVtYXNrCmVjaG8gIGxzIC1sYSB0ZXN0X3Vt YXNrL2EvYi8KbHMgLWxhIHRlc3RfdW1hc2svYS9iLwoKCg== --001a1143e9587b6b1d053a42f63d-- From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 18 08:57:56 2016 Received: (at 24251-done) by debbugs.gnu.org; 18 Aug 2016 12:57:56 +0000 Received: from localhost ([127.0.0.1]:60982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baMtP-0008Hp-Op for submit@debbugs.gnu.org; Thu, 18 Aug 2016 08:57:56 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:53076) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baMtM-0008Hg-UV for 24251-done@debbugs.gnu.org; Thu, 18 Aug 2016 08:57:54 -0400 Received: from [192.168.1.80] (unknown [109.77.110.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 830F5239; Thu, 18 Aug 2016 13:57:49 +0100 (IST) Subject: Re: bug#24251: Potential cp bug: directories created with --parents and --no-preserve=mode retain original mode bits don't match ~umask To: Mark Mitchell , 24251-done@debbugs.gnu.org References: From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <57B5B0CC.6030203@draigBrady.com> Date: Thu, 18 Aug 2016 13:57:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------070700030609080903050907" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24251-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) This is a multi-part message in MIME format. --------------070700030609080903050907 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit On 17/08/16 12:42, Mark Mitchell wrote: > Hi, > > I'm writing to report a potential bug with cp. I don't think the mode bits > always get properly set on directories created when using the --parents > option combined with --no-preserve=mode option. I'm not sure what the > expected behaviour is supposed to be, but my assumption is that the created > directories would match process's ~umask (like mkdir -p). > > I've attached a simple script and its output to demonstrate the behaviour. > I've tested this on the most recent master branch of the coreutils git > repository (output of git describe is 'v8.25-55-gff2178b'). > > Thanks for your efforts on these utilities, it is much appreciated :-). I agree that's unexpected, especially since cp -r --no-preserve=mode does not copy the permissions for created dirs. I think this may have changed with: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v5.92-435-gfdffb6b I've adjusted things back in the attached. thanks, Pádraig. --------------070700030609080903050907 Content-Type: text/x-patch; name="cp-parents-no-preserve-mode.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cp-parents-no-preserve-mode.patch" =46rom bd75118c16d8bca235b61dbb99326c043278a791 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?P=3DC3=3DA1draig=3D20Brady?=3D Date: Thu, 18 Aug 2016 13:54:48 +0100 Subject: [PATCH] cp: with --parents --no-preserve=3Dmode don't copy dir p= erms * src/cp.c (make_dir_parents_private): Use default permissions for created directories when --no-preserve=3Dmode is specified. * tests/cp/cp-parents.sh: Add a test case. * NEWS: Mention the fix. Fixes http://bugs.gnu.org/24251 --- NEWS | 4 ++++ src/cp.c | 3 ++- tests/cp/cp-parents.sh | 27 +++++++++++++++++++-------- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index c0e0d37..34a969e 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,10 @@ GNU coreutils NEWS -*= - outline -*- handling ACLs on Cygwin and Solaris platforms. [bug introduced in coreutils-8.24] =20 + cp --parents --no-preserve=3Dmode, no longer copies permissions from s= ource + directories, instead using default permissions for created directories= =2E + [bug introduced in coreutils-5.93] + chcon, chgrp, chmod, chown, du, and rm, or specifically utilities using the FTS interface, now diagnose failures returned by readdir(). [this bug was inherent in the use of fts: thus, for rm the bug was diff --git a/src/cp.c b/src/cp.c index 3b5b6cb..13dc1ea 100644 --- a/src/cp.c +++ b/src/cp.c @@ -476,7 +476,8 @@ make_dir_parents_private (char const *const_dir, size= _t src_offset, (src_mode & ~S_IRWXUGO) !=3D 0. However, common practi= ce is to ask mkdir to copy all the CHMOD_MODE_BITS, letting m= kdir decide what to do with S_ISUID | S_ISGID | S_ISVTX. */= - mkdir_mode =3D src_mode & CHMOD_MODE_BITS & ~omitted_permi= ssions; + mkdir_mode =3D x->explicit_no_preserve_mode ? S_IRWXUGO : = src_mode; + mkdir_mode &=3D CHMOD_MODE_BITS & ~omitted_permissions; if (mkdir (dir, mkdir_mode) !=3D 0) { error (0, errno, _("cannot make directory %s"), diff --git a/tests/cp/cp-parents.sh b/tests/cp/cp-parents.sh index b0be883..3819e3d 100755 --- a/tests/cp/cp-parents.sh +++ b/tests/cp/cp-parents.sh @@ -1,6 +1,4 @@ #!/bin/sh -# cp -R --parents dir-specified-with-trailing-slash/ other-dir -# would get a failed assertion. =20 # Copyright (C) 2000-2016 Free Software Foundation, Inc. =20 @@ -25,14 +23,15 @@ working_umask_or_skip_ # Run the setgid check from the just-created directory. skip_if_setgid_ =20 -mkdir foo bar || framework_failure_ -mkdir -p a/b/c d e g || framework_failure_ -ln -s d/a sym || framework_failure_ -touch f || framework_failure_ - +{ + mkdir foo bar + mkdir -p a/b/c d e g + ln -s d/a sym + touch f +} || framework_failure_ =20 # With 4.0.37 and earlier (back to when?), this would fail -# with the failed assertion from dirname.c. +# with the failed assertion from dirname.c due to the trailing slash. cp -R --parents foo/ bar || fail=3D1 =20 # Exercise the make_path and re_protect code in cp.c. @@ -55,4 +54,16 @@ p=3D$(ls -ld g/sym|cut -b-10); case $p in drwx-w--w-);= ; *) fail=3D1;; esac p=3D$(ls -ld e/d/a/b/c|cut -b-10); case $p in drwxr-xr-x);; *) fail=3D1;= ; esac p=3D$(ls -ld g/sym/b/c|cut -b-10); case $p in drwxr-xr-x);; *) fail=3D1;= ; esac =20 +# Before 8.25 cp --parents --no-preserve=3Dmode would copy +# the mode bits from the source directories +{ + mkdir -p np/b && + chmod 0700 np && + touch np/b/file && + chmod 775 np/b/file && + mkdir np_dest +} || framework_failure_ +cp --parents --no-preserve=3Dmode np/b/file np_dest/ || fail=3D1 +p=3D$(ls -ld np_dest/np|cut -b-10); case $p in drwxr-xr-x);; *) fail=3D1= ;; esac + Exit $fail --=20 2.5.5 --------------070700030609080903050907-- From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 18 10:39:14 2016 Received: (at 24251) by debbugs.gnu.org; 18 Aug 2016 14:39:14 +0000 Received: from localhost ([127.0.0.1]:33507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baOTS-00048E-0N for submit@debbugs.gnu.org; Thu, 18 Aug 2016 10:39:14 -0400 Received: from mail-ua0-f169.google.com ([209.85.217.169]:35067) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baOTQ-00047x-Hc; Thu, 18 Aug 2016 10:39:12 -0400 Received: by mail-ua0-f169.google.com with SMTP id n59so31265485uan.2; Thu, 18 Aug 2016 07:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=B4aWIXybGHRJRbTb9TxkiNV4F+ZlQRU4XTMzdZpwOpI=; b=u45zC0zibl7FMwI8eow2IY+xVhAfSIxmEU6KqakDiPoAnc92pjqRHoXZEbVDxTkPqH TyRSs//RyK3v6894H0GUwhtD9oBBZ+/pfwi4/tPTpNV9hRtYxvBOCSGyuZ8CmPDr1Z04 pGBjQxxUHHLMY6HRseaRp16BSwhBzdRscKI5uKy8SSkQ6DeU7c6PKhs6g2skhsCZXgFN r3UEt2JJNDhjqEVZi3g2YjTBPIvNkr7lyl+gSLbP4Uy0N0YsXe3XPqaYzFGT4NtxrMAp nlEJ9Zz0gNp+OamUSVVKpMtco64Xy4d8v0nCip0S2pe0xp7eMXwEeJSB8tsZKLrVAEHk p3nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=B4aWIXybGHRJRbTb9TxkiNV4F+ZlQRU4XTMzdZpwOpI=; b=FjbO77KfknxTl8+2qglBXRCXX9xH4h/gQN3U3asoi9k+I27JTX6CQTaSyXQAtDqcT7 3KI7QWvtVzeLMA/6HKEwwhob4AopVoJpwS/bl2ZjHElylUsvlTzbrbbaPCijnCbZRNHm 1p47R0JEWblmjJB0z0qyNBroxGoqMqyYTQ2UMnf8DH74Aqt6aG+JCBAYgPwWIgd1XnRK kZir0H49+uuu2XuJAx3GvFlUxzp/rjmWUU9lvxDXui6TVW0Vc6B9xo19ZDSRc2XYSjA7 prlJboNt6hh+oBPvIA36qjL+/NrwTnd0K+GGl5rJVpwPUYd3AnN3Oo8FJdsigjLywxCx 3Xag== X-Gm-Message-State: AEkooutTS8slgr2JN353UPs06LfBgJQ/A1Y4k3QoZQoBGdshwBhczm+hvH+w6PQBacNu8K7z/4Sevgz/Ko1hOw== X-Received: by 10.159.34.15 with SMTP id 15mr1288945uad.84.1471531146810; Thu, 18 Aug 2016 07:39:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.80.143 with HTTP; Thu, 18 Aug 2016 07:38:46 -0700 (PDT) In-Reply-To: <57B5B0CC.6030203@draigBrady.com> References: <57B5B0CC.6030203@draigBrady.com> From: Jim Meyering Date: Thu, 18 Aug 2016 07:38:46 -0700 X-Google-Sender-Auth: f10oISItZBaJNZzLz326YotiF5c Message-ID: Subject: Re: bug#24251: Potential cp bug: directories created with --parents and --no-preserve=mode retain original mode bits don't match ~umask To: 24251@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= , mark81@gmail.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 24251 Cc: 24251-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Thu, Aug 18, 2016 at 5:57 AM, P=C3=A1draig Brady wrot= e: > On 17/08/16 12:42, Mark Mitchell wrote: >> Hi, >> >> I'm writing to report a potential bug with cp. I don't think the mode b= its >> always get properly set on directories created when using the --parents >> option combined with --no-preserve=3Dmode option. I'm not sure what the >> expected behaviour is supposed to be, but my assumption is that the crea= ted >> directories would match process's ~umask (like mkdir -p). >> >> I've attached a simple script and its output to demonstrate the behaviou= r. >> I've tested this on the most recent master branch of the coreutils git >> repository (output of git describe is 'v8.25-55-gff2178b'). >> >> Thanks for your efforts on these utilities, it is much appreciated :-). > > I agree that's unexpected, especially since cp -r --no-preserve=3Dmode > does not copy the permissions for created dirs. > > I think this may have changed with: > http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff;h=3Dv5.92-= 435-gfdffb6b > > I've adjusted things back in the attached. That looks right. Thank you! From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 18 22:36:39 2016 Received: (at 24251) by debbugs.gnu.org; 19 Aug 2016 02:36:39 +0000 Received: from localhost ([127.0.0.1]:33704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baZfj-000677-9b for submit@debbugs.gnu.org; Thu, 18 Aug 2016 22:36:39 -0400 Received: from mail-io0-f174.google.com ([209.85.223.174]:34389) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baZfh-00066r-Br; Thu, 18 Aug 2016 22:36:37 -0400 Received: by mail-io0-f174.google.com with SMTP id q83so36788131iod.1; Thu, 18 Aug 2016 19:36:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oPjsP64mb4AvPpWhByWvWc5Wam/ktJ5rnFxmbaPHaX4=; b=iUY7+g3WyDw/t3isPbbVe8NGfWILD0d5iXbkWMMcElDDDsLNUaIwx/337iVIgdJw1c gG9QzXfCWVZMonaIsKWiEM/cQCRlgn4vo5g44e2fcoXev2HY0BWBMaPcme61CZByimxx DyMPRInrUyjP9Bp8NqELvadDG/L2VfJe5ExpKGta7DUNPfIrhUkfn8l6YdN1eDRsjsAw 0GBwikMVt1AXh8u1Yv6lPBY/3oLWXlHl0fChMvdS9UfNZpmlpTpgu4vR//nWVzXiObTb d89aRBPKBhR+++OKClUUSXwocATDymqe0v6fuHsNijxDW/Xhj53fMjYwUKpbb3kV/S+s vKFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oPjsP64mb4AvPpWhByWvWc5Wam/ktJ5rnFxmbaPHaX4=; b=klu5injIxVKjb8FT5UGSHuGEfGE6NfoiazM2w9YwmGFJObZS3QCYChQYMTC0ufovrH ChDysBvepKUboSrjjLwQaZedvPxifbvP+feOjyyACmkz5FSRF+aV3Yy1W03avAftQQ8m F8rSKwNWJ98gGKDU4tIXOKOBZ6Dyu6p//f3o7dH2hZQFRKdvzp3K6g8VvWYjA9Nd+hyK YAr80y3V6t6gnY9Xy3tJazfTR/E7bd+FgkU+fW//ypOC2H2o21L9BZhLO5dvqwBLRSGF lOEDt3BsjHQV0ziHYP7tv7Sp3KxOdhHwTWfdFNWXPycayv7mlth5bu+TyOnNLwxJIL/v TZhw== X-Gm-Message-State: AEkoouszfmLEHMOVkqtYTOxobiXPrOtJZBrJTG5ln2jNjankGmexb7aR4bv00Nwc7RaKsOfMsqru8yKVHuz6jw== X-Received: by 10.107.130.39 with SMTP id e39mr6830337iod.66.1471574191739; Thu, 18 Aug 2016 19:36:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.12.77 with HTTP; Thu, 18 Aug 2016 19:36:31 -0700 (PDT) In-Reply-To: References: <57B5B0CC.6030203@draigBrady.com> From: Mark Mitchell Date: Fri, 19 Aug 2016 02:36:31 +0000 Message-ID: Subject: Re: bug#24251: Potential cp bug: directories created with --parents and --no-preserve=mode retain original mode bits don't match ~umask To: Jim Meyering Content-Type: multipart/alternative; boundary=001a113ec7ecf59a21053a639087 X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 24251 Cc: =?UTF-8?Q?P=C3=A1draig_Brady?= , 24251@debbugs.gnu.org, 24251-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) --001a113ec7ecf59a21053a639087 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Wow that was quick -- thanks again for your time, -Mark On Thu, Aug 18, 2016 at 2:38 PM, Jim Meyering wrote: > On Thu, Aug 18, 2016 at 5:57 AM, P=C3=A1draig Brady wr= ote: > > On 17/08/16 12:42, Mark Mitchell wrote: > >> Hi, > >> > >> I'm writing to report a potential bug with cp. I don't think the mode > bits > >> always get properly set on directories created when using the --parent= s > >> option combined with --no-preserve=3Dmode option. I'm not sure what t= he > >> expected behaviour is supposed to be, but my assumption is that the > created > >> directories would match process's ~umask (like mkdir -p). > >> > >> I've attached a simple script and its output to demonstrate the > behaviour. > >> I've tested this on the most recent master branch of the coreutils git > >> repository (output of git describe is 'v8.25-55-gff2178b'). > >> > >> Thanks for your efforts on these utilities, it is much appreciated :-)= . > > > > I agree that's unexpected, especially since cp -r --no-preserve=3Dmode > > does not copy the permissions for created dirs. > > > > I think this may have changed with: > > http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff; > h=3Dv5.92-435-gfdffb6b > > > > I've adjusted things back in the attached. > > That looks right. Thank you! > --001a113ec7ecf59a21053a639087 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Wow that was quick -- thanks again for your time,
=
-Mark

On Thu, Aug 18, 2016 at 2:38 PM, Jim Meyering <= ;jim@meyering.net= > wrote:
On Th= u, Aug 18, 2016 at 5:57 AM, P=C3=A1draig Brady <P@draigbrady.com> wrote:
> On 17/08/16 12:42, Mark Mitchell wrote:
>> Hi,
>>
>> I'm writing to report a potential bug with cp.=C2=A0 I don'= ;t think the mode bits
>> always get properly set on directories created when using the --pa= rents
>> option combined with --no-preserve=3Dmode option.=C2=A0 I'm no= t sure what the
>> expected behaviour is supposed to be, but my assumption is that th= e created
>> directories would match process's ~umask (like mkdir -p).
>>
>> I've attached a simple script and its output to demonstrate th= e behaviour.
>> I've tested this on the most recent master branch of the coreu= tils git
>> repository (output of git describe is 'v8.25-55-gff2178b')= .
>>
>> Thanks for your efforts on these utilities, it is much appreciated= :-).
>
> I agree that's unexpected, especially since cp -r --no-preserve=3D= mode
> does not copy the permissions for created dirs.
>
> I think this may have changed with:
> http://git= .sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff;h=3Dv5.92-43= 5-gfdffb6b
>
> I've adjusted things back in the attached.

That looks right. Thank you!

--001a113ec7ecf59a21053a639087-- From unknown Sat Aug 16 16:08:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 16 Sep 2016 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator