[Top][All Lists]

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

Re: HOME not set when printing with LPR

From: Chet Ramey
Subject: Re: HOME not set when printing with LPR
Date: Thu, 19 Aug 2004 08:20:49 -0400

> > Bash will give HOME a default value if it's unset when a login shell starts,
> > but otherwise will not change or set it.  It will not auto-export the 
> > variable,
> > either.
> > 
> > It's not really the shell's business to be setting HOME.
> OK, then what sets HOME?

login sets HOME and puts it in the environment, where it is exported to all
other child processes.  xterm and other terminal emulators may set HOME
before invoking the shell.

> What does this code do?
> variables.c [line 539 - ]
> /* Set $HOME to the information in the password file if we didn't get
>     it from the environment. */

Exactly what I said it does.  Bash gives a HOME default value if a login
shell is started with HOME unset, but does not export it.

> static void
> set_home_var ()
> {
>    SHELL_VAR *temp_var;
>    temp_var = find_variable ("HOME");
>    if (temp_var == 0)
>      temp_var = bind_variable ("HOME", sh_get_home_dir ());
> #if 0
>    VSETATTR (temp_var, att_exported);
> #endif

> In any case, something needs to set it when a job is run as an effective user 
> -- 
> which I presume is what is happening with the print daemon (lpd) which is 
> running as root but when the print job is run, the environment variable USER 
> is 
> set correctly.

Is HOME exported?  Is it set to a non-empty value?  If it's exported, the
print client should have it and communicate it to lpd somehow as part of
the job.


``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Chet Ramey, ITS, CWRU    address@hidden    http://tiswww.tis.cwru.edu/~chet/

reply via email to

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