In your example below, the permission denied message and subsequent
failure exit code are the result of EACCES on open(2). The issue we had
was when file copying succeeded but the subsequent chown(2) fails.
This can be demonstrated on stock Ubuntu 14.04 as follows:
$ sudo touch foo
$ cp -a foo bar
$ echo $?
0
$ ls -l foo bar
-rw-r--r-- 1 tdm tdm 0 May 31 18:59 bar
-rw-r--r-- 1 root root 0 May 31 18:59 foo
I can't say that this is correct or even necessarily desirable, but it
is indeed what coreutils does.
Also note that in your example below, you are using VFAT. The bug in
question regards the OnePlus One. It does not use VFAT (no sdcard), it
uses ext4 (or possibly f2fs, but mostly ext4).
On 05/29/2016 08:33 PM, Rob Landley wrote:
Browsing through the cyanogenmod repository. Since they never submitted
patches to me I'm not going to copy their stuff verbatim (technically
it could be under a different license), but I'd like to address their
issues in mainline (modulo the pending stuff), and I get to this:
http://review.cyanogenmod.org/#/c/131295/
commit b90823e298988ff365cdf8e6d7c17687c3897d55
Author: Scott Mertz <[email protected]>
Date: Tue Feb 2 14:40:31 2016 -0800
Don't exit with failure code when cp ownership preservation fails
POSIX spec states that it is unspecified whether '-p' prints errors
to stderr when preserving ownership fails. GNU coreutils implementation
does not write anything to stderr when this fails. Additionally,
'-a' is only specified in GNU coreutils & specifies nothing
is to be written to stderr in the case of failure. Switch the
implementation to align with GNU coreutils while still satisfying
POSIX.
OPO-358
Change-Id: Ibb7c94fbf553a178b3f88a724ef6f737275a4205
I tried to pull up the OPO-358 thing to see what the original bug
report was, but it requires a login to view it:
https://jira.cyngn.com/browse/OPO-358
So I tested it myself, and they're _wrong_:
dd if=/dev/zero of=vfat.img bs=1M count=1
mkfs.vfat vfat.img
mkdir vfat
sudo /bin/bash
toybox mount vfat.img vfat
And then when I go:
# cp -a todo vfat/
cp: failed to preserve ownership for ‘vfat/todo/attachment.bin.4’: Operation
not permitted
cp: failed to preserve ownership for ‘vfat/todo/attachment-0002.bin’: Operation
not permitted
cp: failed to preserve ownership for ‘vfat/todo/netstat.patch’: Operation not
permitted
cp: failed to preserve ownership for ‘vfat/todo/githash.patch’: Operation not
permitted
cp: failed to preserve ownership for ‘vfat/todo/expr.patch’: Operation not
permitted
...
The stock ubuntu 14.04 vesion is giving warnings about
inability to preserve ownership...?
Rob
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net