Skip to content

Commit

Permalink
OS-1967: bash 'test -x' always returns true
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Perkin committed Feb 28, 2013
1 parent 4e9fd77 commit 5fc346f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bash/Makefile
Expand Up @@ -25,6 +25,8 @@ VER = bash-4.1

include ../Makefile.defs

PATCHES = Patches/*

#
# As pkgsrc suggests, parallel builds are unsafe. Boo!
#
Expand Down
29 changes: 29 additions & 0 deletions bash/Patches/lib_sh_eaccess.c.patch
@@ -0,0 +1,29 @@
--- bash-4.1/lib/sh/eaccess.c.orig 2013-02-28 15:19:17.903657487 +0000
+++ bash-4.1/lib/sh/eaccess.c 2013-02-28 15:22:35.693338914 +0000
@@ -198,6 +198,8 @@
char *path;
int mode;
{
+ int ret;
+
if (path_is_devfd (path))
return (sh_stataccess (path, mode));

@@ -214,9 +216,14 @@
return (sh_euidaccess (path, mode));
# endif

- if (current_user.uid == current_user.euid && current_user.gid == current_user.egid)
- return (access (path, mode));
-
+ if (current_user.uid == current_user.euid && current_user.gid == current_user.egid) {
+ ret = access (path, mode);
+#if defined (__FreeBSD__) || defined (SOLARIS)
+ if (ret == 0 && current_user.euid == 0 && mode == X_OK)
+ return (sh_stataccess (path, mode));
+#endif
+ return ret;
+ }
return (sh_stataccess (path, mode));
#endif
}

0 comments on commit 5fc346f

Please sign in to comment.