|
Message-ID: <20140114040757.GB7283@openwall.com> Date: Tue, 14 Jan 2014 08:07:57 +0400 From: "(GalaxyMaster)" <galaxy@...nwall.com> To: owl-dev@...ts.openwall.com Subject: absolute() in /etc/init.d/functions is unreliable All, In /etc/init.d/functions we have a defined subroutine called absolute(). The purpose of that subroutine is to return the absolute path of the provided executable. However, 'type -afp <file>' behaves unreliably if the PATH system variable contains a directory where <file> resides twice: === $ echo "$PATH" /bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin $ type -afp file /usr/bin/file $ export PATH="/usr/bin:$PATH" $ echo "$PATH" /usr/bin:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin $ type -afp file /usr/bin/file /usr/bin/file $ === My initial thought was to remove -a from the type command (this way it just returns the first match), but -a also ensures that type is not using hashed paths (i.e. cached values). I stumbled upon this multiple times when I was installing 3rd party services. I'm not sure how to fix this issue properly, but was wondering why we are implementing a substitute for which(1) that we are providing with Owl? Maybe the absolute() subroutine should be enhanced in such a way that it uses which(1) if it is in PATH, but fallback to type otherwise? -- (GM)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.