From 5fc346f917a9287f3a8aff22776af008d376301b Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Thu, 28 Feb 2013 16:18:20 +0000 Subject: [PATCH] OS-1967: bash 'test -x' always returns true --- bash/Makefile | 2 ++ bash/Patches/lib_sh_eaccess.c.patch | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 bash/Patches/lib_sh_eaccess.c.patch diff --git a/bash/Makefile b/bash/Makefile index e160c6fc..38437345 100644 --- a/bash/Makefile +++ b/bash/Makefile @@ -25,6 +25,8 @@ VER = bash-4.1 include ../Makefile.defs +PATCHES = Patches/* + # # As pkgsrc suggests, parallel builds are unsafe. Boo! # diff --git a/bash/Patches/lib_sh_eaccess.c.patch b/bash/Patches/lib_sh_eaccess.c.patch new file mode 100644 index 00000000..3f80c8d9 --- /dev/null +++ b/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 + }