Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 303411 - app-shells/bash: built-in "test -x" fails for root
Summary: app-shells/bash: built-in "test -x" fails for root
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: All FreeBSD
: High normal (vote)
Assignee: Gentoo/BSD Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-04 05:24 UTC by Johan Hattne
Modified: 2010-03-28 10:57 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for built-in test -x failure for root (bash-4.0-fbsd-testx.patch,684 bytes, patch)
2010-02-04 05:25 UTC, Johan Hattne
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Hattne 2010-02-04 05:24:08 UTC
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.
Comment 1 Johan Hattne 2010-02-04 05:25:02 UTC
Created attachment 218343 [details, diff]
Patch for built-in test -x failure for root
Comment 2 Johan Hattne 2010-02-12 21:48:31 UTC
Applies to app-shells/bash-4.1_p2, too.
Comment 3 Javier Villavicencio (RETIRED) gentoo-dev 2010-03-26 17:07:52 UTC
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.
Comment 4 SpanKY gentoo-dev 2010-03-27 05:28:36 UTC
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.
Comment 5 Johan Hattne 2010-03-27 20:06:39 UTC
(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
Comment 6 Javier Villavicencio (RETIRED) gentoo-dev 2010-03-28 10:57:14 UTC
Fixed in CVS, and thanks again!