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

RE: [rhelv5-list] how to handle "echo" ?

Correct - but see the email I just sent because that is not the
documented behavior :)


-----Original Message-----
From: rhelv5-list-bounces redhat com
[mailto:rhelv5-list-bounces redhat com] On Behalf Of Tom Sightler
Sent: Friday, July 06, 2007 12:14 PM
To: Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list
Subject: RE: [rhelv5-list] how to handle "echo" ?

On Fri, 2007-07-06 at 11:28 -0700, Collins, Kevin [MindWorks] wrote:

> It would appear that some behaviour would be different depending on
> whether you have certain things in your PATH.

Using ltrace was a great idea, I should have thought of it.  Anyway, it
appears that ksh is setting the "UNIVERSE" option which I mentioned
earlier dynamically based on where it finds certain commands.

Here is the output of ltrace when echo is located at /bin/echo
(attempted for remove some whitespace to make this readable):

strncmp("bin:/usr/sbin:/usr/bin:/usr/local/bin/:/root/bin","bin:",4) = 0
__ctype_b_loc()                             = 0xb7fd6a90
strcpy(0x8189698, "UNIVERSE - ucb")         = 0x8189698
strchr("_AST_FEATURES=UNIVERSE - ucb",'=')  = "=UNIVERSE - ucb"
strcmp("_AST_FEATURES", "_AST_FEATURES")    = 0
strcpy(0x81998a0, "UNIVERSE - ucb")         = 0x81998a0
strchr("_AST_FEATURES=UNIVERSE - ucb", '=') = "=UNIVERSE - ucb"

However, when I put the symbolic link in /usr/local/bin I get this:

symbstrncmp("bin:/usr/sbin:/usr/bin:/usr/local/bin/:/root/bin"...4) = 0
__ctype_b_loc()                             = 0xb7fd5a90
strcpy(0x9a8a698, "UNIVERSE - att")         = 0x9a8a698
strchr("_AST_FEATURES=UNIVERSE - att", '=') = "=UNIVERSE - att"
strcmp("_AST_FEATURES", "_AST_FEATURES")    = 0
strcpy(0x9a9a8a0, "UNIVERSE - att")         = 0x9a9a8a0
strchr("_AST_FEATURES=UNIVERSE - att", '=') = "=UNIVERSE - att"

The echo builtin has different behavior based on setting UNIVERSE to ucb
or att.  That's why I posted it as a possible workaround before, if you
can figure out a way to set it globally, which I couldn't.  As it turns
out, placing echo in /usr/local/bin is simply hinting the system to
default to a different UNIVERSE setting.

Of course, this means that a script which meddles with the PATH
statement might still break with my "bandaid", but I had already assumed
that and so far it had not affected our scripts.


rhelv5-list mailing list
rhelv5-list redhat com

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