From: "David J. Fiander" <david@golem.uucp>
To: rc@archone.tamu.edu
Subject: Bug in code which searches for executables
Date: Fri, 15 Nov 1991 20:21:52 -0600 [thread overview]
Message-ID: <13027.690258112@golem> (raw)
I just found a bug in the code which searches for executables.
The problem was unearthed because I do not keep "." in my path.
The problem is that when you type "bin/foo", the program is not
found, but "./bin/foo" works. To reproduce, remove "." from
your path (since searching the path will find it), cd to / and
type
bin/echo hi
You should be told that bin/echo could not be found.
The problem is in which(). As you can see from the patch, I
have changed a call to "isabsolute()" which checks to see if
the path starts with /, ./, or ../, to a call to "strchr()" to
see if a "/" appears anywhere in the string for which we are
searching.
*** Standard Input Fri Nov 15 12:40:09 1991
--- which.c Fri Nov 15 09:56:23 1991
***************
*** 98,104 ****
#endif
}
! if (isabsolute(name)) /* absolute pathname? */
return rc_access(name, verbose) ? name : NULL;
len = strlen(name);
--- 98,104 ----
#endif
}
! if (strchr(name, '/')) /* explicit pathname? */
return rc_access(name, verbose) ? name : NULL;
len = strlen(name);
--
David J. Fiander |A man ought to read just as inclination leads him; for
<david@golem.uucp> |what he reads as a task will do him little good.
next reply other threads:[~1991-11-17 0:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1991-11-16 2:21 David J. Fiander [this message]
1991-11-17 1:20 ` Paul D. Swasey
1991-11-18 18:09 ` steve
1991-11-17 4:23 ` Chris Siebenmann
1991-11-17 2:55 Byron Rakitzis
1991-11-17 4:48 Scott Schwartz
[not found] <9111170123.AA04583@piggy.ucsb.edu>
1991-11-17 4:54 ` David J. Fiander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=13027.690258112@golem \
--to=david@golem.uucp \
--cc=rc@archone.tamu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).