Re: shell script sniplets in /usr/bin?
On Sun, 30 Jan 2005, Jochen Voss wrote:
> Hello John,
>
> On Sat, Jan 29, 2005 at 11:46:12AM -0600, John Hasler wrote:
> > Jochen Voss writes:
> > > Any references for this? I was a little bit disappointed that the FHS
> > > was so unclear about /usr/bin and I do not know where else to look.
> >
> > While the FHS is not as explicit as it might be, with the application of a
> > bit of common sense it is sufficiently clear.
>
> One should think so, but the presence of /usr/bin/gettect.sh and
> the fact that my bug report was closed by the maintainer shed some
> doubt on it. Any idea how I should proceed?
I suggest that you read the reply by the author. For the benefit of
those who don't have web browsers, I'll quote it here:
gettext.sh is meant to be sourced from shell scripts, using the "."
command. This command looks in $PATH, but none of the subdirectories
of /usr/share/gettext is present in $PATH.
You can also see it this way: POSIX /bin/sh supports the concept of
functions. As in any programming language, functions can be grouped
together in a file called "library". As in any programming language,
such libraries can be loaded. In C it's via dlsym(), in sh it's via ".".
Where does dlsym() look up the libraries? In /usr/lib. So Debian
installs C libraries in /usr/lib/. Fine.
Where does "." look up the libraries? Anywhere in $PATH. In particular in
/usr/bin.
If the Debian project designates a particular directory for shell script
function libraries, and puts this directory in $PATH by default, GNU gettext
will happily install its contents there.
If it doesn't, then - by the analogy with /usr/lib above - there is nothing
wrong with gettext.sh in /usr/lib/.
So, the common sense says /usr/bin is ok for gettext.sh, not the opposite.
If you want to make policy that /usr/bin should only contain executables,
go ahead, make a policy proposal, but none of you have answered to the
question made by Frank Küster:
Do you think we should simply not make any use of the POSIX feature
that . $name will look for $name in the $PATH? Or do you think we should
add a directory to PATH that is then dedicated to such shell snippets?
Anyway, this is a policy issue, so please followup to debian-policy.
Reply to: