Comment 45 for bug 1007089

Revision history for this message
Mike Mestnik (cheako) wrote :

That's interesting. For self updating applications, well first of all applications should not have access to modify there own source. Leaving that aside as it's obviously working for you and your users are presumably aware of the security risks.

Then I have to point out that the code you linked to is correct, though I may add a replacement for 3 and that's to try and use /proc/self/exe. It should be rare for the other two attempts not to function.

I'm sad to hear that this bug that got into the kernel is effecting your project also. As a work around, you can try adding the path to the mount point. I'll just write some pseudo code in shell.

lnk=$(readlink /proc/$(pgrep firefox)/exe); for ech in $(cut -f2 -d\ /proc/mounts); do [ -f "$ech$lnk" ] && echo "$ech$lnk"; done
/.usr-ro/lib/firefox/firefox
/.usr-rw/lib/firefox/firefox
/usr/lib/firefox/firefox

I guess it's not the most sane solution, you could spice it up a bit.
lnk=$(readlink /proc/$(pgrep firefox)/exe); for ech in $(cut -f2 -d\ /proc/mounts | grep -e ^/var -e ^/usr -e ^/lib -e ^/home); do [ -f "$ech$lnk" ] && echo "$ech$lnk"; done
/usr/lib/firefox/firefox