bug-bash
[Top][All Lists]
Advanced

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

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alterna


From: Bojan Land
Subject: Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd
Date: Fri, 05 Jan 2007 06:33:15 -0500

On Thu, 2007-01-04 at 11:31 -0700, Bob Proulx wrote:
> Bojan Land wrote:
> > Bob Proulx wrote:
> > > This is possible when it has been cached by bash and then the
> > > executable is either moved from its original location or a new
> > > executable appears earlier in PATH.
> > 
> > I did not move the executable.
> 
> Right.  "or a new executable appears earlier in PATH."  I believe that
> after invoking the /usr/bin/ version you created a new executable by
> the same name earlier in PATH.

I think I ran both commands before the bug I posted occurred.  Though I
just tried to reproduce the bug and I cannot, it works as expected this
time!

$ type -a mycmd
mycmd is /bin/mycmd
mycmd is /home/user/bin/mycmd
$ pwd
/home/user/bin
$ ls
file1 file2 file3 mycmd file5
$ which mycmd
/bin/mycmd
$ mycmd
hello you
$ ./mycmd
hello me
$ /bin/mycmd
hello you
$ cat /bin/mycmd
#!/bin/sh

echo "hello you"
$ cat mycmd
#!/bin/sh

echo "hello me"

Whereas what I posted as a bug returned very different results!  So, how
do I reproduce those results?  Is it not a bug?

> -p only prints a path if the result is a file and has a path to print.

So say the man pages!

> > One clarification I need is for these results:
> > 
> > > $ type help
> > > help is a shell builtin
> > > $ type -p help
> > > $ type -t help
> > > builtin
> > > $
> > 
> > Why is there no output for -p?
> 
> There is no path for type -p help because help is a shell builtin and
> does not have a path.  It does not exist on the filesystem.  It
> exists only inside the shell as a builtin command.

That does make sense, though I thought it might return bash's location.

> (And before
> someone pipes in that Solaris /bin/sh is still the Bourne shell and
> that you need /usr/xpg4/bin/sh to get the POSIX shell let me say
> again, all *modern* systems have /bin/sh as the POSIX shell.)

Is XPG dead?  Did the architects of Solaris choose to place the Bourne
Shell instead of the XPG shell because more users use the facilities of
it and thus ensuring the majority's needs are satisfied instead?

> > Seems there are three commands returning same results differently
> > encapsulated.  Is there a purpose to having command, which and type on a
> > system or can one of them do the job of the other two?
> 
> Ask five people the same question and you will get seven different
> answers!  These are different implementations by different people.
> Not having a standard in this area meant that there are no standards.
> They chose differently from each other.

I'm trying to avoid the ten thousand hammers problem in a distro I'd
like to build.  I'd much rather a collection of task specific tools that
integrate well than a collection of tools that seem to do the same tasks
differently.

> > The results did not say hashed and I've tried it several times.  The
> > only way I can get type to report hashed is by using hash manually:
> 
> Probably version of shell differences.  I don't know.

It wasn't hashing because I wasn't running the commands!  :)


> > Being able to cd but not ls is like walking through a dark room without
> > any senses.  I thought by setting +P prior to re-entering
> > html_users/user I would return to /home/user/public_html however that's
> > not the case.
> 
> That would be the -P setting.

-P turns off symlink following (physical following), +P enables (logical
following); when set -P cannot return to where started after cding a
symlink without knowing the owd.

> 
> > No bashref from info, however there are html and ps versions.
> 
> Well, that is probably a systems bug then.  You might wish to file a
> bug report to whoever installed your system.

LOL, systems bug filled!  Though I seem to know more than the systems
team so hence the problem.

> I learn something new every day from people who post on the mailing
> lists.  The community of people working to improve free software is an
> unmatched strength.

I've just been informed of gnome.comp.shells.bash.bugs, should I have
asked my question there instead?

The community of people "working" to improve free software rarely get
reimbursed financially and sometimes end up hungry and in financial
debt, like me!  Then they give up on free software and work on closed
software, then their stuff is stolen and they return to free software
out of life support reasons with a larger financial debt!  :(





reply via email to

[Prev in Thread] Current Thread [Next in Thread]