ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.73k stars 267 forks source link

Should not follow symlinks on `argv[0]` path resolution #1644

Closed Coekjan closed 2 months ago

Coekjan commented 2 months ago

Many programs (e.g. busybox, ex, bash) can have different behaviors on different argv[0]. We should only resolve the argv[0] (program name) to its absolute path but not realpath, i.e. don't resolve the symlinks.

ptitSeb commented 2 months ago

Many programs (e.g. busybox, ex, bash) can have different behaviors on different argv[0]. We should only resolve the argv[0] (program name) to its absolute path but not realpath, i.e. don't resolve the symlinks.

Ok, I agree. But I'm afraid making the change here will have some side effect on other things. This function is used in many places, not just arg[0] resolution.

Coekjan commented 2 months ago

Ok, I agree. But I'm afraid making the change here will have some side effect on other things. This function is used in many places, not just arg[0] resolution.

Maybe we can have a "soft" version of ResolveFile? Like ResolveFileSoft, indicating that it does not resolve symlinks.

ptitSeb commented 2 months ago

Ok, I agree. But I'm afraid making the change here will have some side effect on other things. This function is used in many places, not just arg[0] resolution.

Maybe we can have a "soft" version of ResolveFile? Like ResolveFileSoft, indicating that it does not resolve symlinks.

Yeah, that would limit side-effect I think.

Coekjan commented 2 months ago

Yeah, that would limit side-effect I think.

Done :) Please review the changes.

ptitSeb commented 2 months ago

Ok, looks good now, thanks.