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

Re: [email] Re: SOLARIS: su - user not passing cmd args



I haven't read the documentation at all, but that's quite similar in many
ways to what I would expect.
In the case: 

Su - user -c 'cmd arg1 arg2 arg3' arg4 arg5 arg6 arg7

-c is being passed one argument "cmd arg1 arg2 arg3"
so it will run cmd with arg1 arg2 arg3.

Arg4 arg5 arg6 and arg7 are being processed by SU not passed to the "cmd"
and thus should behave differently.  As for how they're behaving, I have no
idea since I haven't looked at documentation or even run the command.

Jamon

-----Original Message-----
From: silug-discuss-owner@silug.org [mailto:silug-discuss-owner@silug.org]
On Behalf Of mike808@users.sourceforge.net
Sent: Tuesday, September 30, 2003 3:32 PM
To: silug-discuss@silug.org
Subject: [email] Re: SOLARIS: su - user not passing cmd args

> Did you put the args in quotes?

Yep. Here's a new twist, and I think clinches it to be a bug.

   su - user -c 'cmd arg1 arg2 arg3' arg4 arg5 arg6 arg7

.profile sees:   $0=arg4 $1=arg5 $2=arg6 $3=arg7
su'd shell sees: $0=cmd  $1=arg1 $2=arg2 $3=arg3 (and *only* those 3 args,
too)

And if you display the value of the 'tty' command, the .profile returns
the tty of the calling 'su' command's shell (i.e. a real tty), while the
su'd shell will display 'not a tty'.

There's some parameter mis-matching going on here, and it's a bug, or
there is some *severely* under-documented behavior going on. It is not
at *all* clear from the 'su', 'login' or 'ksh' documentation who gets
what arguments and who does what command-line expansions and quoting here.

I really think this may be an off-by-one bug somewhere, in that the .profile
never "sees" that first argument. But what's strange is that _ONLY_ the
first
argument is what's passed to the subshell, and only the .profile sees
the others.

Mike/

---------------------------------------------
http://www.valuenet.net



-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.

winmail.dat


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.