Re: ipcclean in 8.1 broken?

Roman Neuhauser <neuhauser@sigpipe.cz>

From: Roman Neuhauser <neuhauser@sigpipe.cz>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-hackers@postgresql.org, Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Date: 2006-03-01T12:04:11Z
Lists: pgsql-hackers
# peter_e@gmx.net / 2006-03-01 12:49:13 +0100:
> Am Dienstag, 28. Februar 2006 07:42 schrieb Christopher Kings-Lynne:
> > I just tried using ipcclean in 8.1.3.  It doesn't work when I su to the
> > pgsql user.  This part of the script:
> >
> > if [ "$USER" = 'root' -o "$LOGNAME" = 'root' ]
> >
> > Always fails because even tho $USER is set to 'pgsql' when su'ed,
> > $LOGNAME is still root.
> >
> > This is on FreeBSD 4.9
> 
> It seems to work on Linux; apparently there are different behaviors of su.  Do 
> you have a suggestion for resolving this?

    use "su -l"? this is on FreeBSD 6:

     By default, the environment is unmodified with the exception of USER,
     HOME, and SHELL.
     ...
     -l      Simulate a full login.  The environment is discarded except for
             HOME, SHELL, PATH, TERM, and USER.  HOME and SHELL are modified
             as above.  USER is set to the target login.  PATH is set to
             ``/bin:/usr/bin''.  TERM is imported from your current environ-
             ment.

    smradoch@neuhauser ~ 1001:0 > echo $USER $LOGNAME
    smradoch smradoch
    smradoch@neuhauser ~ 1002:0 > su -l
    Password:
    neuhauser# echo $USER $LOGNAME
    root root
    neuhauser# logout
    smradoch@neuhauser ~ 1003:0 > su   
    Password:
    You have mail.
    neuhauser# echo $USER $LOGNAME
    smradoch smradoch
    neuhauser# exit
    smradoch@neuhauser ~ 1004:0 > uname -srm
    FreeBSD 6.1-PRERELEASE amd64

    su (coreutils) 4.5.3 on RHEL3 behaves exactly the same.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991