Bug#345101: [Pkg-alsa-devel] alsa-tools

Thomas Hood jdthood at yahoo.co.uk
Fri Dec 30 15:21:38 UTC 2005


Michael Prokop wrote:
> * Thomas Hood <jdthood at yahoo.co.uk> [20051230 15:15]:
>> I don't like to hard-code program paths, and I can quote some policy to
>> back this up:
> 
>> >      Programs called from maintainer scripts should not normally have a
>                                                  ^^^^^^
>> >      path prepended to them.  Before installation is started, the package
>> >      management system checks to see if the programs `ldconfig',
>> >      `start-stop-daemon', `install-info', and `update-rc.d' can be found
>> >      via the `PATH' environment variable.  Those programs, and any other
>> >      program that one would expect to be on the `PATH', should thus be
>> >      invoked without an absolute pathname.  Maintainer scripts should also
>> >      not reset the `PATH', though they might choose to modify it by
>> >      prepending or appending package-specific directories.  These
>> >      considerations really apply to all shell scripts. [6.1]
>                                             ^^^^^^^^^^^^^
> 
> Do you consider the /etc/modprobe.d/* files as shell scripts?


What follows 'install <name>' in a modprobe.d file is a shell script.


>> If "modprobe" is failing on the user's system then either he doesn't have a
>> sane default PATH or zsh is broken.
> 
> If $PATH is not set zsh falls back to the following:
> 
>     ,---- [ $ZSH/Src/init.c ]
>     | /* Set default path */
>     | path    = (char **) zalloc(sizeof(*path) * 5);
>     | path[0] = ztrdup("/bin");
>     | path[1] = ztrdup("/usr/bin");
>     | path[2] = ztrdup("/usr/ucb");
>     | path[3] = ztrdup("/usr/local/bin");
>     | path[4] = NULL;
>     `----
> 
> That's what happens in the reported case so modprobe can't be
> executed.


I find this code in the bash sources (config-top.h):

/* The default value of the PATH variable. */
#ifndef DEFAULT_PATH_VALUE
#define DEFAULT_PATH_VALUE \
  "/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:."
#endif

But this shouldn't be relevant because (as init(8) says):

 ENVIRONMENT
       Init sets the following environment variables for all its children:

       PATH   /bin:/usr/bin:/sbin:/usr/sbin

You need to figure out why the zsh instance started by modprobe on your
system isn't searching /sbin for the modprobe command.

Please do this for starters:

    echo 'install envtest env > /tmp/modprobe-env-dump' > /etc/modprobe.d/envtest
    modprobe envtest
    grep PATH tmp/modprobe-env-dump


>> (Or modprobe isn't passing PATH, but my testing indicates that
>> this is not the problem.)
> 
> Where does modprobe set $PATH? (Sorry, I could not find anything.
> I'm still investing on the problem, if it's really a zsh problem
> I'll contact zsh-upstream of course.)


Last time I checked, modprobe did not set PATH, but did pass on PATH from
its environment to the enviroment of the commands its executes.  That's why
the current /etc/modprobe.d/alsa-base works for many, many people.
-- 
Thomas



More information about the Pkg-alsa-devel mailing list