Well, I have now found an official description of the expected behavior.
>From src/cmd/ksh93/COMPATIBILITY:
10. Built-ins in ksh-88 were always executed before looking for
the command in the PATH variable. This is no longer true.
Thus, with ksh-93, if you have the current directory first
in your PATH, and you have a program named test in your
directory, it will be executed when you type test; the
built-in version will be run at the point /bin is found
in your PATH.
However, now I am MORE confused because this is telling me that it
_should_ execute the external command.
Back to the ltrace output, I discovered that with the link in
/usr/local/bin I see:
strcpy(0x9ff8df8, "UNIVERSE - att") = 0x9ff8df8
strchr("_AST_FEATURES=UNIVERSE - att", '=') = "=UNIVERSE - att"
strcpy(0x9ff8e10, "UNIVERSE - att") = 0x9ff8e10
strchr("_AST_FEATURES=UNIVERSE - att", '=') = "=UNIVERSE - att"
and without:
strcpy(0x8476df8, "UNIVERSE - ucb") = 0x8476df8
strchr("_AST_FEATURES=UNIVERSE - ucb", '=') = "=UNIVERSE - ucb"
strcpy(0x8476e10, "UNIVERSE - ucb") = 0x8476e10
strchr("_AST_FEATURES=UNIVERSE - ucb", '=') = "=UNIVERSE - ucb"
So, it appears that rather than ever execute the external command, it
simply has a different behavior based on where the external command was
found!
Kevin
ps - Tom, I composed this message before I left for lunch and now I see
that you have also disovered the "UNIVERSE" thing
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Collins, Kevin
[MindWorks]
Sent: Friday, July 06, 2007 11:28 AM
To: Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list
Subject: RE: [rhelv5-list] how to handle "echo" ?
Funny, I just did the exact same thing!
So far, the code is not providing much insight (but I'm not a C/C++
programmer!)... it does appear that the echo builtin is handled by the
same code as the print builtin.
I've tried both strace and ltrace and not finding anything that jumps
out at me, although these lines from ltrace make me wonder just what in
the hell is going on (I have snipped lines between these):
strncmp("usr/kerberos/sbin:/usr/kerberos/"..., "usr/bin:", 8) = 9
strncmp("usr/kerberos/sbin:/usr/kerberos/"..., "ucb", 3) = 16
strncmp("usr/kerberos/bin:/usr/local/sbin"..., "usr/bin:", 8) = 9
strncmp("usr/kerberos/bin:/usr/local/sbin"..., "ucb", 3) = 16
strncmp("bin:/usr/local/sbin:/usr/local/b"..., "bsd", 3) = -10
strncmp("usr/local/sbin:/usr/local/bin:/s"..., "usr/bin:", 8) = 10
strncmp("usr/local/sbin:/usr/local/bin:/s"..., "ucb", 3) = 16
strncmp("usr/local/bin:/sbin:/bin:/usr/sb"..., "usr/bin:", 8) = 10
strncmp("usr/local/bin:/sbin:/bin:/usr/sb"..., "ucb", 3) = 16
strncmp("bin:/sbin:/bin:/usr/sbin:/usr/bi"..., "bsd", 3) = -10
strncmp("bin:/usr/sbin:/usr/bin:/root/bin"..., "bin:", 4) = 0
It would appear that some behaviour would be different depending on
whether you have certain things in your PATH.
Still looking through the code.
Kevin
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tom Sightler
Sent: Friday, July 06, 2007 10:57 AM
To: Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list
Subject: Re: [rhelv5-list] how to handle "echo" ?
On Fri, 2007-07-06 at 12:03 -0500, inode0 wrote:
> I tried yesterday with /bin as the first thing in PATH and it didn't
> appear to look for an external echo anywhere.
Your right, it seems to follow the path until it gets to /bin and then
stops, even if it doesn't find echo there. I removed echo from my /bin
directory but it never pursues any directories in the PATH after /bin,
only the ones before /bin. Seems strange.
> It will be interesting to hear what the code is actually doing.
I agree.
Later,
Tom
_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list
_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list
_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list