[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Obscure problem with Bash when printing
From: |
James Richard Tyrer |
Subject: |
Obscure problem with Bash when printing |
Date: |
Wed, 02 Jul 2003 13:36:12 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.4) Gecko/20030624 |
I have been advised of a serious problem when printing in Linux using a
spooler/filter when printing a PostScript file that does not have the fonts
embedded.
I am using GNUlpr. The daemon: "lpd" (running as root) calls the:
"master-filter" script (running as the user that submitted the job) which
calls GhostScript (as the user that submitted the job).
The problem is that when GhostScript is called that the environment
strings: GS_LIB and GS_FONTPATH are not set. The fix for this appeared to
be to make the: "master-filter" script a login script so that: "profile"
would be run before GhostScript was called. This worked for fonts
installed system wide -- providing that they were properly configured to
work with GhostScript and that the search paths were set correctly.
However, if the path set by: "profile" (in a 'profile.d' script on my
system) is in HOME (e.g. $HOME/.fonts), it doesn't work. :-( I find that
the problem is that for some reason that HOME is being set to: '/' rather
then: "/home/$USER". The odd thing is that (sticking echo statements in
the: "master-filter" script) `id -un` reports the correct user name.
This appears to be set incorrectly in this code in: "shell.c":
void
get_current_user_info()
{
struct passwd *entry;
/* Don't fetch this more than once. */
if(current_user.user_name == 0)
{
entry = getpwuid(current_user.uid);
if(entry)
{
current_user.user_name = savestring(entry->pw_name);
current_user.shell = (entry->pw_shell && entry->pw_shell[0])
? savestring(entry->pw_shell)
: savestring("/bin/sh");
current_user.home_dir = savestring(entry->pw_dir);
}
else
{
current_user.user_name = savestring("I have no name!");
current_user.shell = savestring("/bin/sh");
current_user.home_dir = savestring("/");
}
endpwent();
}
}
I'm not sure exactly what is happening here but: "current_user.uid" appears
to get set to the value returned by: "getuid()" in: "uidget()", but is it
executed?
So, the question is, if "getuid()" reports the correct user, should HOME be
correctly set to the home directory for that user? And, if not -- which is
the case here -- is this a bug in Bash?
--
JRT
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Obscure problem with Bash when printing,
James Richard Tyrer <=