util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [su] New su utility messes with my PATH
@ 2012-09-15 13:17 Thomas Bächler
  2012-09-15 14:43 ` Pádraig Brady
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Bächler @ 2012-09-15 13:17 UTC (permalink / raw)
  To: util-linux; +Cc: Dave Reisner, Tobias Powalowski

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

I found what I think is absolutely unexpected behaviour in the new su
utility. It seems to have been introduced by commit a6fdd3f8.

It is about /sbin and /usr/sbin being in the path: Whenever you switch
to a non-root user, they are removed from the path, and when you switch
to root, they are added. I find it completely unexpected that su (when
not running with -l) messes with my environment at all.

Commands like
 PATH=... su -c "cmd" user
do not work as expected.

In my opinion, when you wish your path (or anything in the environment)
to change you should a) use -l to start a login shell or b) configure
your scripts to take care of it.

I propose to revert the mentioned patch. Opinions?


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 897 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [su] New su utility messes with my PATH
  2012-09-15 13:17 [su] New su utility messes with my PATH Thomas Bächler
@ 2012-09-15 14:43 ` Pádraig Brady
  2012-09-20  9:47   ` Karel Zak
  0 siblings, 1 reply; 6+ messages in thread
From: Pádraig Brady @ 2012-09-15 14:43 UTC (permalink / raw)
  To: Thomas Bächler; +Cc: util-linux, Dave Reisner, Tobias Powalowski

On 09/15/2012 02:17 PM, Thomas Bächler wrote:
> I found what I think is absolutely unexpected behaviour in the new su
> utility. It seems to have been introduced by commit a6fdd3f8.
>
> It is about /sbin and /usr/sbin being in the path: Whenever you switch
> to a non-root user, they are removed from the path, and when you switch
> to root, they are added. I find it completely unexpected that su (when
> not running with -l) messes with my environment at all.
>
> Commands like
>   PATH=... su -c "cmd" user
> do not work as expected.
>
> In my opinion, when you wish your path (or anything in the environment)
> to change you should a) use -l to start a login shell or b) configure
> your scripts to take care of it.
>
> I propose to revert the mentioned patch. Opinions?

Ouch, I agree.
su shouldn't be messing with PATH at all IMHO.

cheers,
Pádraig.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [su] New su utility messes with my PATH
  2012-09-15 14:43 ` Pádraig Brady
@ 2012-09-20  9:47   ` Karel Zak
  2012-09-21  7:54     ` Ludwig Nussel
  2012-10-02  8:17     ` Karel Zak
  0 siblings, 2 replies; 6+ messages in thread
From: Karel Zak @ 2012-09-20  9:47 UTC (permalink / raw)
  To: Pádraig Brady, Werner Fink, Ludwig Nussel
  Cc: Thomas Bächler, util-linux, Dave Reisner, Tobias Powalowski

On Sat, Sep 15, 2012 at 03:43:29PM +0100, Pádraig Brady wrote:
> On 09/15/2012 02:17 PM, Thomas Bächler wrote:
> >I found what I think is absolutely unexpected behaviour in the new su
> >utility. It seems to have been introduced by commit a6fdd3f8.
> >
> >It is about /sbin and /usr/sbin being in the path: Whenever you switch
> >to a non-root user, they are removed from the path, and when you switch
> >to root, they are added. I find it completely unexpected that su (when
> >not running with -l) messes with my environment at all.
> >
> >Commands like
> >  PATH=... su -c "cmd" user
> >do not work as expected.
> >
> >In my opinion, when you wish your path (or anything in the environment)
> >to change you should a) use -l to start a login shell or b) configure
> >your scripts to take care of it.
> >
> >I propose to revert the mentioned patch. Opinions?
> 
> Ouch, I agree.
> su shouldn't be messing with PATH at all IMHO.

It's Suse patch, I guess there is/was any reason for the patch

        commit a6fdd3f8125be23930d955c2bc6b7a46cdaf8a12
        Author: Werner Fink <werner@suse.de>
        Date:   Tue Aug 17 09:09:55 2010 +0200

        make sure /sbin resp /usr/sbin are in PATH


Werner, Ludwig? What about to revert the patch?

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [su] New su utility messes with my PATH
  2012-09-20  9:47   ` Karel Zak
@ 2012-09-21  7:54     ` Ludwig Nussel
  2012-10-02  8:17     ` Karel Zak
  1 sibling, 0 replies; 6+ messages in thread
From: Ludwig Nussel @ 2012-09-21  7:54 UTC (permalink / raw)
  To: Karel Zak
  Cc: Pádraig Brady, Werner Fink, Thomas Bächler, util-linux,
	Dave Reisner, Tobias Powalowski

Karel Zak wrote:
> On Sat, Sep 15, 2012 at 03:43:29PM +0100, Pádraig Brady wrote:
>> On 09/15/2012 02:17 PM, Thomas Bächler wrote:
>>> I found what I think is absolutely unexpected behaviour in the new su
>>> utility. It seems to have been introduced by commit a6fdd3f8.
>>>
>>> It is about /sbin and /usr/sbin being in the path: Whenever you switch
>>> to a non-root user, they are removed from the path, and when you switch
>>> to root, they are added. I find it completely unexpected that su (when
>>> not running with -l) messes with my environment at all.
>>>
>>> Commands like
>>>  PATH=... su -c "cmd" user
>>> do not work as expected.
>>>
>>> In my opinion, when you wish your path (or anything in the environment)
>>> to change you should a) use -l to start a login shell or b) configure
>>> your scripts to take care of it.
>>>
>>> I propose to revert the mentioned patch. Opinions?
>>
>> Ouch, I agree.
>> su shouldn't be messing with PATH at all IMHO.

Well, su is such a mess that you better not make any assumptions about
it. Avoid su if you can.

> It's Suse patch, I guess there is/was any reason for the patch
> 
>         commit a6fdd3f8125be23930d955c2bc6b7a46cdaf8a12
>         Author: Werner Fink <werner@suse.de>
>         Date:   Tue Aug 17 09:09:55 2010 +0200
> 
>         make sure /sbin resp /usr/sbin are in PATH
> 
> 
> Werner, Ludwig? What about to revert the patch?

Personally I don't really mind. I don't know the background of the patch
though. IMO using 'su' instead of 'su -' is broken anyways so making the
former less convenient may help teaching people to use 'su -' instead.

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [su] New su utility messes with my PATH
  2012-09-20  9:47   ` Karel Zak
  2012-09-21  7:54     ` Ludwig Nussel
@ 2012-10-02  8:17     ` Karel Zak
  2012-10-02  8:23       ` Thomas Bächler
  1 sibling, 1 reply; 6+ messages in thread
From: Karel Zak @ 2012-10-02  8:17 UTC (permalink / raw)
  To: Pádraig Brady, Werner Fink, Ludwig Nussel
  Cc: Thomas Bächler, util-linux, Dave Reisner, Tobias Powalowski

On Thu, Sep 20, 2012 at 11:47:04AM +0200, Karel Zak wrote:
>         commit a6fdd3f8125be23930d955c2bc6b7a46cdaf8a12
>         Author: Werner Fink <werner@suse.de>
>         Date:   Tue Aug 17 09:09:55 2010 +0200
> 
>         make sure /sbin resp /usr/sbin are in PATH
> 
> 
> Werner, Ludwig? What about to revert the patch?

 Reverted.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [su] New su utility messes with my PATH
  2012-10-02  8:17     ` Karel Zak
@ 2012-10-02  8:23       ` Thomas Bächler
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Bächler @ 2012-10-02  8:23 UTC (permalink / raw)
  To: Karel Zak
  Cc: Pádraig Brady, Werner Fink, Ludwig Nussel, util-linux,
	Dave Reisner, Tobias Powalowski

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

Am 02.10.2012 10:17, schrieb Karel Zak:
> On Thu, Sep 20, 2012 at 11:47:04AM +0200, Karel Zak wrote:
>>         commit a6fdd3f8125be23930d955c2bc6b7a46cdaf8a12
>>         Author: Werner Fink <werner@suse.de>
>>         Date:   Tue Aug 17 09:09:55 2010 +0200
>>
>>         make sure /sbin resp /usr/sbin are in PATH
>>
>>
>> Werner, Ludwig? What about to revert the patch?
> 
>  Reverted.
> 
>     Karel

Thank you, much appreciated.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 897 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-10-02  8:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-15 13:17 [su] New su utility messes with my PATH Thomas Bächler
2012-09-15 14:43 ` Pádraig Brady
2012-09-20  9:47   ` Karel Zak
2012-09-21  7:54     ` Ludwig Nussel
2012-10-02  8:17     ` Karel Zak
2012-10-02  8:23       ` Thomas Bächler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).