diff --git a/.cvsignore b/.cvsignore index bd8ab69..ca8ebb9 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -which-2.12.tar.gz +which-2.13.tar.gz diff --git a/sources b/sources index ff6c445..d41c28e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -8955df4fe35e29378a5eda31a61de39e which-2.12.tar.gz +ab5a2b929b87c7917887e70f0204bce5 which-2.13.tar.gz diff --git a/which-2.13-afs.patch b/which-2.13-afs.patch new file mode 100644 index 0000000..94f1ec6 --- /dev/null +++ b/which-2.13-afs.patch @@ -0,0 +1,107 @@ +--- which-2.13/bash.c.orig Tue Feb 26 23:39:42 2002 ++++ which-2.13/bash.c Wed Feb 27 00:02:36 2002 +@@ -33,7 +33,6 @@ + */ + #define HAVE_GETGROUPS + #undef SHELL +-#undef AFS + #undef NOGROUP + + /* +@@ -146,51 +145,52 @@ + if (S_ISDIR (finfo.st_mode)) + return (FS_EXISTS); + +-#if defined (AFS) +- /* We have to use access(2) to determine access because AFS does not +- support Unix file system semantics. This may produce wrong +- answers for non-AFS files when ruid != euid. I hate AFS. */ +- if (access (name, X_OK) == 0) +- return (FS_EXISTS | FS_EXECABLE); +- else +- return (FS_EXISTS); +-#else /* !AFS */ +- +- /* Find out if the file is actually executable. By definition, the +- only other criteria is that the file has an execute bit set that +- we can use. */ +- if (user_id == -1) +- user_id = geteuid (); /* CHANGED: bash uses: current_user.euid; */ +- +- /* Root only requires execute permission for any of owner, group or +- others to be able to exec a file. */ +- if (user_id == 0) ++ if (getenv("AFS")) { ++ /* We have to use access(2) to determine access because AFS does not ++ support Unix file system semantics. This may produce wrong ++ answers for non-AFS files when ruid != euid. I hate AFS. */ ++ if (access (name, X_OK) == 0) ++ return (FS_EXISTS | FS_EXECABLE); ++ else ++ return (FS_EXISTS); ++ } ++ else /* !AFS */ + { +- int bits; +- +- bits = (u_mode_bits (finfo.st_mode) | +- g_mode_bits (finfo.st_mode) | +- o_mode_bits (finfo.st_mode)); +- +- if (X_BIT (bits)) +- return (FS_EXISTS | FS_EXECABLE); +- } +- +- /* If we are the owner of the file, the owner execute bit applies. */ +- if (user_id == finfo.st_uid && X_BIT (u_mode_bits (finfo.st_mode))) +- return (FS_EXISTS | FS_EXECABLE); +- +- /* If we are in the owning group, the group permissions apply. */ +- if (group_member (finfo.st_gid) && X_BIT (g_mode_bits (finfo.st_mode))) +- return (FS_EXISTS | FS_EXECABLE); +- +- /* If `others' have execute permission to the file, then so do we, +- since we are also `others'. */ +- if (X_BIT (o_mode_bits (finfo.st_mode))) +- return (FS_EXISTS | FS_EXECABLE); +- else +- return (FS_EXISTS); +-#endif /* !AFS */ ++ /* Find out if the file is actually executable. By definition, the ++ only other criteria is that the file has an execute bit set that ++ we can use. */ ++ if (user_id == -1) ++ user_id = geteuid (); /* CHANGED: bash uses: current_user.euid; */ ++ ++ /* Root only requires execute permission for any of owner, group or ++ others to be able to exec a file. */ ++ if (user_id == 0) ++ { ++ int bits; ++ ++ bits = (u_mode_bits (finfo.st_mode) | ++ g_mode_bits (finfo.st_mode) | ++ o_mode_bits (finfo.st_mode)); ++ ++ if (X_BIT (bits)) ++ return (FS_EXISTS | FS_EXECABLE); ++ } ++ ++ /* If we are the owner of the file, the owner execute bit applies. */ ++ if (user_id == finfo.st_uid && X_BIT (u_mode_bits (finfo.st_mode))) ++ return (FS_EXISTS | FS_EXECABLE); ++ ++ /* If we are in the owning group, the group permissions apply. */ ++ if (group_member (finfo.st_gid) && X_BIT (g_mode_bits (finfo.st_mode))) ++ return (FS_EXISTS | FS_EXECABLE); ++ ++ /* If `others' have execute permission to the file, then so do we, ++ since we are also `others'. */ ++ if (X_BIT (o_mode_bits (finfo.st_mode))) ++ return (FS_EXISTS | FS_EXECABLE); ++ else ++ return (FS_EXISTS); ++ } /* !AFS */ + } + + /* Return 1 if STRING is an absolute program name; it is absolute if it diff --git a/which-2.sh b/which-2.sh index ee5619d..fb65973 100755 --- a/which-2.sh +++ b/which-2.sh @@ -1,2 +1,4 @@ # Initialization script for bash and sh + +# export AFS, if you are in AFS environment alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'