Bug#1005906: libc6: 'test -x' ignores executable bit on files and directories
On 2022-02-17 06:14, David Eccles (gringer) wrote:
> Package: libc6
> Version: 2.33-6
> Severity: important
> X-Debbugs-Cc: bugs@gringene.org
>
> Dear Maintainer,
>
> I'm not sure which package this bug is linked to; I'm fairly confident it's one of the following:
>
> fontconfig-config libbrotli-dev libbrotli1 libc-bin libc-dev-bin libc-l10n
> libc6 libc6-dev libexpat1 libexpat1-dev libfontconfig-dev libfontconfig1
> libfreetype-dev libfreetype6 libfreetype6-dev libuuid1 locales uuid-dev
>
> I was trying to get R working on a Docker container with the following Dockerfile:
>
> --- BEGIN ---
>
> FROM rocker/r-base:4.1.2
>
> ## This works
> RUN R -e 'install.packages(c("rjson"))'
>
> RUN apt-get update && apt-get install -y \
> libfontconfig1-dev
>
> ## This doesn't work
> RUN R -e 'install.packages(c("rjson"))'
>
> --- END ---
>
> Unfortunately, the R command stops working after the packages are updated. At the time I ran this,
> the following packages were pulled in:
>
> fontconfig-config libbrotli-dev libbrotli1 libc-bin libc-dev-bin libc-l10n
> libc6 libc6-dev libexpat1 libexpat1-dev libfontconfig-dev libfontconfig1
> libfreetype-dev libfreetype6 libfreetype6-dev libuuid1 locales uuid-dev
>
> I get similar results [i.e. R not working] when I try to install 'nano' instead of libfontconfig1-dev.
>
> I opened up the docker container to try to work out what was happening, and noticed the R command
> has the following logic:
>
> if test -x "${R_HOME}"; then
> :
> else
> error "R_HOME ('${R_HOME}') not found"
> fi
>
> When I changed this to a 'test -d', R started working again:
>
> if test -d "${R_HOME}"; then
> :
> else
> error "R_HOME ('${R_HOME}') not found"
> fi
>
> Unfortunately, this didn't fix all my problems, because there was another R INSTALL script that
> was required for installing R packages, and this script also didn't work. The script had a simiar
> '-x' command, but it was used to test to make sure a file was executable, instead of a directory.
>
> I created a short test shell commands to demonstrate the issue:
>
> # export R_HOME=/usr/lib/R
> # ls -lh ${R_HOME}/bin/INSTALL
> -rwxr-xr-x 1 root root 825 Nov 1 11:00 /usr/lib/R/bin/INSTALL
> # if test -x "${R_HOME}/bin/INSTALL"; then echo "file is executable"; else echo "dead beef"; fi
> dead beef
>
> [note that this reports "dead beef", rather than stating that the file is executable, even though
> 'ls' reports the file as executable]
Please run this command under strace and provide the output, so that we can find the culprit.
Regards,
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
Reply to: