GNU bug report logs -
#31675
Existing directories and files permissions are not being kept intact
Previous Next
Reported by: Gunjan Gupta <viraniac <at> gmail.com>
Date: Fri, 1 Jun 2018 07:41:02 UTC
Severity: normal
Tags: notabug
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31675 in the body.
You can then email your comments to 31675 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#31675
; Package
coreutils
.
(Fri, 01 Jun 2018 07:41:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Gunjan Gupta <viraniac <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Fri, 01 Jun 2018 07:41:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
Suppose I have the following directory structure
/
| - destination (mode=0755)
| - dir (mode=0755)
| - file.txt (mode=0644)
| - source
| - dir (mode=0755)
| - file.txt (mode=0644)
My user has a umask of 0077. Now if I run the following cp command
cp -aR --no-preserve=mode /source/* /destination
I think the mode of destination/dir should stay as 0755 but it changes to
0700. Is this expected?
I am using coreutils 8.26-3 on Debian Stretch
Thanks & Regards
Gunjan Gupta
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#31675
; Package
coreutils
.
(Sun, 03 Jun 2018 22:21:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 31675 <at> debbugs.gnu.org (full text, mbox):
tag 31675 notabug
close 31675
stop
On 31/05/18 20:50, Gunjan Gupta wrote:
> Hi,
>
> Suppose I have the following directory structure
>
> /
> | - destination (mode=0755)
> | - dir (mode=0755)
> | - file.txt (mode=0644)
> | - source
> | - dir (mode=0755)
> | - file.txt (mode=0644)
>
> My user has a umask of 0077. Now if I run the following cp command
>
> cp -aR --no-preserve=mode /source/* /destination
>
> I think the mode of destination/dir should stay as 0755 but it changes to
> 0700. Is this expected?
>
> I am using coreutils 8.26-3 on Debian Stretch
This is a little surprising as cp didn't create /destination/dir in this case.
However if it did create that dir, then the mode would be expected.
So cp is keeping the destination consistent whether it previously existed or not.
cheers,
Pádraig
Added tag(s) notabug.
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Sun, 03 Jun 2018 22:21:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
31675 <at> debbugs.gnu.org and Gunjan Gupta <viraniac <at> gmail.com>
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Sun, 03 Jun 2018 22:21:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#31675
; Package
coreutils
.
(Sun, 03 Jun 2018 22:32:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 31675 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
++ bugs mailling list
On Mon 4 Jun, 2018, 3:59 AM Gunjan Gupta, <viraniac <at> gmail.com> wrote:
> No cpvdidnt created that directory. Directory was existing on the machine
> before.
>
> It used to be fine before 8.26 version of coreutils and we use to supply
> patches to our customer that use to use cp to copy files to the destination.
>
> Starting from 8.26, its broken. What will happen if we use the same
> command to copy files to say /etc directory. I had one of our patch that
> used to do that. I tried installing it on new system and whole system broke
> because of this.
>
> Don't you think cp should preserve permissions for existing files and
> directory? Using user's umask for new files sounds ok but why cp has to
> change mode for existing files and directories?
>
> Is there a way I can tell cp to preserve destination permissions now?
>
> Thanks & Regards
> Gunjan Gupta
>
> On Mon 4 Jun, 2018, 3:50 AM Pádraig Brady, <P <at> draigbrady.com> wrote:
>
>> tag 31675 notabug
>> close 31675
>> stop
>>
>> On 31/05/18 20:50, Gunjan Gupta wrote:
>> > Hi,
>> >
>> > Suppose I have the following directory structure
>> >
>> > /
>> > | - destination (mode=0755)
>> > | - dir (mode=0755)
>> > | - file.txt (mode=0644)
>> > | - source
>> > | - dir (mode=0755)
>> > | - file.txt (mode=0644)
>> >
>> > My user has a umask of 0077. Now if I run the following cp command
>> >
>> > cp -aR --no-preserve=mode /source/* /destination
>> >
>> > I think the mode of destination/dir should stay as 0755 but it changes
>> to
>> > 0700. Is this expected?
>> >
>> > I am using coreutils 8.26-3 on Debian Stretch
>>
>> This is a little surprising as cp didn't create /destination/dir in this
>> case.
>> However if it did create that dir, then the mode would be expected.
>> So cp is keeping the destination consistent whether it previously existed
>> or not.
>>
>> cheers,
>> Pádraig
>>
>>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#31675
; Package
coreutils
.
(Sun, 03 Jun 2018 22:44:02 GMT)
Full text and
rfc822 format available.
Message #18 received at 31675 <at> debbugs.gnu.org (full text, mbox):
On 03/06/18 15:30, Gunjan Gupta wrote:
> ++ bugs mailling list
>
> On Mon 4 Jun, 2018, 3:59 AM Gunjan Gupta, <viraniac <at> gmail.com> wrote:
>
>> No cpvdidnt created that directory. Directory was existing on the machine
>> before.
>>
>> It used to be fine before 8.26 version of coreutils and we use to supply
>> patches to our customer that use to use cp to copy files to the destination.
>>
>> Starting from 8.26, its broken. What will happen if we use the same
>> command to copy files to say /etc directory. I had one of our patch that
>> used to do that. I tried installing it on new system and whole system broke
>> because of this.
>>
>> Don't you think cp should preserve permissions for existing files and
>> directory? Using user's umask for new files sounds ok but why cp has to
>> change mode for existing files and directories?
>>
>> Is there a way I can tell cp to preserve destination permissions now?
>>
>> Thanks & Regards
>> Gunjan Gupta
>>
>> On Mon 4 Jun, 2018, 3:50 AM Pádraig Brady, <P <at> draigbrady.com> wrote:
>>
>>> tag 31675 notabug
>>> close 31675
>>> stop
>>>
>>> On 31/05/18 20:50, Gunjan Gupta wrote:
>>>> Hi,
>>>>
>>>> Suppose I have the following directory structure
>>>>
>>>> /
>>>> | - destination (mode=0755)
>>>> | - dir (mode=0755)
>>>> | - file.txt (mode=0644)
>>>> | - source
>>>> | - dir (mode=0755)
>>>> | - file.txt (mode=0644)
>>>>
>>>> My user has a umask of 0077. Now if I run the following cp command
>>>>
>>>> cp -aR --no-preserve=mode /source/* /destination
>>>>
>>>> I think the mode of destination/dir should stay as 0755 but it changes
>>> to
>>>> 0700. Is this expected?
>>>>
>>>> I am using coreutils 8.26-3 on Debian Stretch
>>>
>>> This is a little surprising as cp didn't create /destination/dir in this
>>> case.
>>> However if it did create that dir, then the mode would be expected.
>>> So cp is keeping the destination consistent whether it previously existed
>>> or not.
Actually looking more, this is a relatively recent change:
https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.19-145-g24ebca6
Also in retrospect, using --no-preserve=mode should
have no guarantees on the mode bits of the destination.
So it's probably best to leave existing mode bits in place.
Let me see if I can come up with a patch...
thanks,
Pádraig
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#31675
; Package
coreutils
.
(Sun, 03 Jun 2018 22:50:01 GMT)
Full text and
rfc822 format available.
Message #21 received at 31675 <at> debbugs.gnu.org (full text, mbox):
Pádraig Brady wrote:
> This is a little surprising as cp didn't create /destination/dir in this case.
> However if it did create that dir, then the mode would be expected.
> So cp is keeping the destination consistent whether it previously existed or not.
Sorry, but I am not following this analysis. The --no-preserve=mode option says
"do not copy the mode of the source to the destination", and yet cp is copying
the mode of the source to the destination. How is that not a bug?
A longer analysis: the documentation for --preserve says what should happen in
the absence of the --preserve option (namely, that permissions of existing
destinations are unchanged), and --no-preserve=mode is pretty clearly equivalent
to the absence of --preserve=mode.
So I don't see how the current behavior can be considered to match the
documentation. I don't see how it'd be that useful, either.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#31675
; Package
coreutils
.
(Sun, 03 Jun 2018 23:29:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 31675 <at> debbugs.gnu.org (full text, mbox):
On 03/06/18 15:43, Pádraig Brady wrote:
> Actually looking more, this is a relatively recent change:
> https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.19-145-g24ebca6
>
> Also in retrospect, using --no-preserve=mode should
> have no guarantees on the mode bits of the destination.
> So it's probably best to leave existing mode bits in place.
>
> Let me see if I can come up with a patch...
I pushed a fix in:
https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=5e7b892
thanks,
Pádraig
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#31675
; Package
coreutils
.
(Sun, 03 Jun 2018 23:34:01 GMT)
Full text and
rfc822 format available.
Message #27 received at 31675 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
That was fast, I will test it and let you know if I face any issues
Thanks & Regards
Gunjan Gupta
On Mon 4 Jun, 2018, 4:58 AM Pádraig Brady, <P <at> draigbrady.com> wrote:
> On 03/06/18 15:43, Pádraig Brady wrote:
> > Actually looking more, this is a relatively recent change:
> >
> https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.19-145-g24ebca6
> >
> > Also in retrospect, using --no-preserve=mode should
> > have no guarantees on the mode bits of the destination.
> > So it's probably best to leave existing mode bits in place.
> >
> > Let me see if I can come up with a patch...
>
> I pushed a fix in:
> https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=5e7b892
>
> thanks,
> Pádraig
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#31675
; Package
coreutils
.
(Mon, 04 Jun 2018 05:51:02 GMT)
Full text and
rfc822 format available.
Message #30 received at 31675 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Nice, it works!!! I only applied the patch to the copy.c file and didn't
patched the test and NEWS file on my system though.
I have another question. Can I tell cp to only preserve the executable mode
for a file?
Thanks & Regards
Gunjan Gupta
On Mon, Jun 4, 2018 at 5:03 AM, Gunjan Gupta <viraniac <at> gmail.com> wrote:
> That was fast, I will test it and let you know if I face any issues
>
>
> Thanks & Regards
> Gunjan Gupta
>
> On Mon 4 Jun, 2018, 4:58 AM Pádraig Brady, <P <at> draigbrady.com> wrote:
>
>> On 03/06/18 15:43, Pádraig Brady wrote:
>> > Actually looking more, this is a relatively recent change:
>> > https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;
>> h=v8.19-145-g24ebca6
>> >
>> > Also in retrospect, using --no-preserve=mode should
>> > have no guarantees on the mode bits of the destination.
>> > So it's probably best to leave existing mode bits in place.
>> >
>> > Let me see if I can come up with a patch...
>>
>> I pushed a fix in:
>> https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=5e7b892
>>
>> thanks,
>> Pádraig
>>
>
[Message part 2 (text/html, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 02 Jul 2018 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 293 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.