Strip command problem
Hi,
I have a weird problem with strip command of binutils package. When I run this command from a shell script, I get a permission denied error. Instead, if I run the same command for the same user from a terminal session, it works! Moreover, I always used this script and it always worked but I don't understand the reason for which it fails on these resources. Any advice? Best regards |
It might help for us to see the script, at least the strip bit and surrounding lines.
|
Quote:
Code:
strip --strip-all "$res" Anyway, I tried to run that script as root ad it worked. Why? I don't understand the reason. Basically, I download a tar archive from internet, extract it into a folder and strip the executables and shared objects. This script always worked, just for this archive it fails with permission denied error. I tried to inspect the previous tar archives than this one, I also saw that for those archive the owner and group are set to root, hence, that seem useless (theorically). Why does it not work in this case as normal user ? |
The most obvious answer is: because the user has no right to write that file. strip tries to modify a file, so it requires both read and write permission.
Check them. |
Does your script extract to /tmp or /var/tmp?
The Linux kernel behavior changed, now root is restricted in directories with a t-bit. https://www.claudiokuenzler.com/blog...-tmp-even-root You can change it back to the Unix standard: Code:
echo 0 > /proc/sys/fs/protected_regular Code:
sysctl fs.protected_regular=0 |
Quote:
if I run the same command for the same user in a terminal session, it works. The problem only exist when it is executed from shell script and that's very weird. |
Quote:
fs.protected_regular is already set to zero. |
Heh ... Looking up the manual page, I very-innocently used the search term: "man strip."
:eek: |
Quote:
|
Quote:
that's is weird because: 1) The resource has already write permission. 2) If I run the same command for the same user into terminal session, it works. Likely, when the files are extracted from tar archive, inherit the fake permissions.... Just a thought. Mark as solved. |
Quote:
|
Quote:
When I run "chmod u+w", on the file system nothing changes occurs but i have to do that otherwise doesn't work. According tar man page: Code:
--no-same-owner It should works without any changes but it doesn't.... |
Is a special file system type involved?
Code:
df -T "$res" |
Quote:
Filesystem is Ext4 on Luks. |
Quote:
Otherwise would be nice to see the exact commands, the exact result and obviously the real environment. |
All times are GMT -5. The time now is 06:54 PM. |