Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1 7z readlink to locate plugins

closed-rejected
nobody
None
5
2004-12-17
2004-12-09
Marko Kohtala
No

I'm using Linux glibc 2.3.2 with bash. I installed 7z
as a symlink as documented in README. However the
plugins are not found since arguments[0] is only "7z"
that is not found in cwd.

This patch first sees if arguments[0] is absolute path,
and if not it'll see the "_" environment variable as
set by bash. As last resort it goes more Linux specific
and uses /proc/self/exe.

To see that all cases work, I tested this with
invocations like

$ strace -eexecve,readlink /usr/local/bin/7z l rar.rar
$ strace -eexecve,readlink strace env
_=/usr/local/bin/7z 7z l rar.rar
$ strace -eexecve,readlink env -u_ 7z l rar.rar

strace does not set "_" so simply "strace 7z" fails as
"_" still points to strace! I think this is ok.

Discussion

  • Marko Kohtala
    Marko Kohtala
    2004-12-09

    The patch

     
    Attachments
  • my space
    my space
    2004-12-17

    • status: open --> closed-rejected
     
  • my space
    my space
    2004-12-17

    Logged In: YES
    user_id=336051

    Thank you for your help.

    I do not plan to use non-portable code.

    p7zip 4.13 do not use anymore link to find its plugins.

    Instead of link, p7zip 4.13 uses a shell.

    Example :

    /usr/bin/7za is :
    #! /bin/sh
    /usr/local/lib/p7zip/7za $*

    7za is copied to /usr/local/lib/p7zip/7za.
    The Codecs and Formats directories are in
    "/usr/local/lib/p7zip/"