file permissions when stripping under fakeroot

Alan Modra amodra@gmail.com
Sun Feb 7 06:04:42 GMT 2021


On Sun, Feb 07, 2021 at 02:39:51PM +1000, Allan McRae via Binutils wrote:
> >From local testing, glibc-2.33 appears to be needed in combination with
> binutils-2.36.1 for this issue to occur.  This would explain the issue
> being present on rawhide and not on release Fedora versions.

Note that for a very long time, if you objcopy/strip a file when you
lack write permission for the file then ownership can change.  eg.

$ gcc -o hello -g ~/src/tmp/hello.c
$ sudo chown root. hello
[sudo] password for alan: 
$ ls -l hello
-rwxr-xr-x 1 root root 18392 Feb  7 16:19 hello
$ strip hello
ls -l hello
-rwxr-xr-x 1 alan alan 14312 Feb  7 16:20 hello

This shouldn't be surprising at all.

$ sudo chown root. hello
[sudo] password for alan: 
$ ls -l hello
-rwxr-xr-x 1 root root 14312 Feb  7 16:20 hello
$ cp -p hello hello.new
$ rm -f hello
$ mv hello.new hello
$ ls -l hello
-rwxr-xr-x 1 alan alan 14312 Feb  7 16:20 hello

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list