Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Dec 2015 12:34:04 -0700 (MST)
From:      Warren Block <wblock@wonkity.com>
To:        Bertram Scharpf <lists@bertram-scharpf.de>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: PATH variable in lpd's process
Message-ID:  <alpine.BSF.2.20.1512221227190.94396@wonkity.com>
In-Reply-To: <20151221164338.GB33124@becker.bs.l>
References:  <20151221164338.GB33124@becker.bs.l>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 21 Dec 2015, Bertram Scharpf wrote:

> in my "/etc/printcap", the "if" field points to an input
> filter I wrote in Ruby. There, the first line is a shebang
> saying
>
>  #!/usr/bin/env ruby
>
> Further there is
>
>  # procstat -e `pgrep lpd`
>    PID COMM             ENVIRONMENT
>    940 lpd              PATH=/sbin:/bin:/usr/sbin:/usr/bin PWD=/ HOME=/ RC_PID=20
>
> As you can easily see, I will receive a mail saying the
> print job failed because of
>
>  env: ruby: No such file or directory
>
> When I restart "lpd" from the command line, the new process
> receives the environment variables from the shell process
> and everything ist fine.
>
> So far I found two ways to solve this neither of them I like
> very much:
>
>  - Tweaking the PATH variable in "etc/rc" in the source
>    tree and reinstall by "make distribution".
>
>  - Patching the filter programms installation method to
>    modify the shebang line using "/usr/local/bin/ruby".
>
> "/etc/crontab" allows to reset the PATH variable but I do
> not see a way to do the same in "/etc/printcap".
>
> Is there a better way to solve my problem and is there a
> recommended one?

env has the -S option where a path value can be specified.  So it will 
work whether $PATH is set or not.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.20.1512221227190.94396>