test -x under root in bash shell returns incorrect results clone60# bash --version GNU bash, version 4.1.7(0)-release (amd64-portbld-freebsd8.1) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. How-To-Repeat: Run under root: www3# sh -c 'test -x ~/.cshrc && echo yes' www3# bash -c 'test -x ~/.cshrc && echo yes' yes
State Changed From-To: open->feedback Hello, Bash is a third party application which is not in our base system. Are you suggesting that bash should behave differently? If so you should poke the upstream maintainers so that it can be updated/changed, if not can you please clarify what you mean? Thanks
Still the bug is in bash, as `test' is builtin, and I'm seeing the same behaviour on at least OpenSolaris. Yuri
State Changed From-To: feedback->closed Hello, I would like to ask you to talk to the bash maintainer and/or the upstream bash people to get this sorted out. This is not something that FreeBSD as OS can do to resolve this (since we import external sources for this one).
Bash checks permission calling eaccess(2). The issue is that it returns success for root: 19632 bash CALL eaccess(0x28417600,X_OK) 19632 bash NAMI "/root/.cshrc" 19632 bash RET eaccess 0 sh's test has a workaround for this: case FILEX: /* XXX work around eaccess(2) false positives for superuser */ if (eaccess(nm, X_OK) != 0) return 0; if (S_ISDIR(s.st_mode) || geteuid() != 0) return 1; The eaccess(2) behaviour has been changed in CURRENT. See kern/125009 for details. I think this ticket can be set as a duplicate of kern/125009. -- Mikolaj Golub