The bash-4.0_p37 built-in test fails to correctly report executable status for non-executable files when run by root on FreeBSD. On FreeBSD, bash calls eaccess(2) to find the executable status, but according to the man page "even if a process's real or effective user has appropriate privileges and indicates success for X_OK, the file may not actually have execute permission bits set". The attached patch is based on source from FreeBSD's stand-alone test, http://www.freebsd.org/cgi/cvsweb.cgi/src/bin/test/test.c. Reproducible: Always Steps to Reproduce: 1. su - 2. /bin/bash 3. test -x /etc/passwd && echo "is executable" Actual Results: Above steps produce output. Expected Results: Above steps do not produce output.
Created attachment 218343 [details, diff] Patch for built-in test -x failure for root
Applies to app-shells/bash-4.1_p2, too.
Thanks for the report, did you send this upstream? seems that even bash in FreeBSD ports would be affected by this. @base-system: any chances to get this in? @prefix: heads up.
since it only applies to the FreeBSD section, and the patch looks sane, then it looks fine to me. i leave it to you to push upstream since i have no way of testing things.
(In reply to comment #3) > Thanks for the report, did you send this upstream? seems that even bash in > FreeBSD ports would be affected by this. It's now with upstream. http://lists.gnu.org/archive/html/bug-bash/2010-03/msg00106.html
Fixed in CVS, and thanks again!