[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#30534: cp - Possible bugs when not preserving mode (explicit) and wh
From: |
Pádraig Brady |
Subject: |
bug#30534: cp - Possible bugs when not preserving mode (explicit) and when copying special files |
Date: |
Mon, 19 Feb 2018 19:26:46 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 19/02/18 02:22, Declercq Laurent wrote:
> I think that I did found at least two bugs in cp(1) command when the
> --no-preserve=mode option is involved and when copying special file. I
> describe each of them below.
>
> 1. Mode set on special files seem to be wrong:
>
> Original file to copy: prw-rw-rw- 1 root staff 0 févr. 18 18:59 spfile
> cp(1) command (run as root user): cp -r --no-preserve=mode spfile
> spfile_copy
>
> Current result:
>
> prwxr-xr-x 1 root staff 0 févr. 18 22:01 spfile_copy
>
> Expected result (considering UMASK 0022):
>
> prw-r--r-- 1 root staff 0 févr. 18 22:01 spfile_copy
>
> The current behavior is due to the fact that mode used is 0777 while
> 0666 should be used for files.
>
> Possible fix: Differentiate directories from files in the copy_internal
> function.
Thanks for the clear details.
The attached should fix this up.
> 2. Non-permission bits are preserved, even when the --no-preserve=mode
> option is involved.
>
> Original file to copy: prwSrw-rw- 1 root staff 0 févr. 18 18:59 spfile
> cp(1) command (run as root user): cp -r --no-preserve=mode spfile
> spfile_copy
>
> Current result:
>
> prwsr-xr-x 1 root staff 0 févr. 18 22:05 spfile_copy
I'm not seeing this. I get 'x' rather than 's' here (and '-' with the fix)
> Expected result (considering UMASK 0022 and without the first bug above):
>
> prw-r--r-- 1 root staff 0 févr. 18 22:05 spfile_copy
thanks!
Pádraig
cp-default-perms.patch
Description: Text Data