bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HOME not set when printing with LPR


From: James Richard Tyrer
Subject: Re: HOME not set when printing with LPR
Date: Thu, 19 Aug 2004 13:22:48 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7) Gecko/20040616

Enrique Perez-Terron wrote:
On Wed, 2004-08-18 at 23:56, James Richard Tyrer wrote:

I was having a problem with LPR (I am still using GNUlpr) not finding my fonts when I printed. I found that the filter script was not a login script. I changed that but found that it still didn't find the fonts in $HOME/.fonts.

Some debugging and I found that the problem is that despite the fact that USER is set correctly to the user that started the print job that HOME is not set (it is blank). This appears to me to be a Bash bug.


An lpr filter script does not usually run as the user who invoked lpr.

Actually it does in the original UCB LPR. A job is printed by a process which is forked and this is run as the user that submitted the job. The current LPRng appears to be a complete rewrite and does not appear do this.

It usually runs with the privileges that the lpd daemon allows it to
have. You might want to modify lpd to set HOME for the filter processes
to point to the home directory of the user who submitted the print job.

If I understood the LPRng code correctly from a quick scan, it has a process for the filter, so it would need to be modified to run a separate filter process for each user. The original design is clearly better.

HOME is usually set (exported) by the /bin/login program or its
replacements like xdm, gdm, etc.

Yes, but this doesn't set it when it is started with an effective user by a 
fork.

Lpd is usually started from an init script. Then there is no login
program in the hierarchy of parent processes of Lpd.

But, this doesn't just apply to LPR.

Bash *does* have code to set HOME (from the passwd file) when it is not set. This is needed for Tilde expansion. The problem appears to be that when a script is a login script that this value is not passed to: "/etc/profile" and "~/.bash_profile". This is the problem and this is the bug that needs to be fixed. I should emphasize that when "~/.bash_profile" is called that HOME is set correctly (internally) otherwise it wouldn't be able to call the correct script!

--
JRT





reply via email to

[Prev in Thread] Current Thread [Next in Thread]