Open r-owen opened 4 years ago
This can also be easily reproduced with the alpine postgres
image and bash
, where bash
falsely reports the non-executable file on a grpcfuse volume to be executable:
# docker run -v `pwd`/data:/data postgres bash -c 'FILE=data/foo.sh; touch $FILE; chmod -x $FILE; ls -l $FILE; if [ -x "$FILE" ]; then echo file is executable; fi'
-rw-r--r-- 1 root root 0 Nov 4 19:15 data/foo.sh
file is executable
Interestingly enough, sh
behaves correctly:
docker run -v `pwd`/data:/data postgres sh -c 'FILE=data/foo.sh; touch $FILE; chmod -x $FILE; ls -l $FILE; if [ -x "$FILE" ]; then echo file is executable; fi'
-rw-r--r-- 1 root root 0 Nov 4 19:17 data/foo.sh
The issue seems to affect access() and faccessat(), but not stat(). /bin/sh on alpine and /bin/ash both use stat(), while bash uses faccessat().
So (with Docker Desktop 2.5.0 on MacOS 10.15):
mkdir mount
touch mount/foo
# The following will output nothing (stat() is used):
docker run -it --mount source=`pwd`/mount,dst=/mount,type=bind alpine sh -c 'test -x /mount/foo && echo exectuable'
# The following will output "executable" (faccessat() is used):
docker run -it --mount source=`pwd`/mount,dst=/mount,type=bind alpine sh -c 'apk add bash > /dev/null; /bin/bash -c "test -x /mount/foo && echo exectuable"'
I've found that this also seems to affect Docker Desktop 2.4.0 as well; 2.3.0.5 functions as expected.
@djs55 PTAL
Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
comment.
Stale issues will be closed after an additional 30 days of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen
comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale
/remove-lifecycle stale
/lifecycle frozen
I've found that this can be worked around by disabling gRPC FUSE. Is there some way to detect from the command-line whether gRPC FUSE is enabled or not? Failing that, is it possible to detect over the API?
Not exactly from the command line, but you can find it in the settings.json file.
so.. is there any solution to this? The legacy sharing (when you disable gRPC FUSE) has 1 second file timestamps resolution. which breaks my build process. and gRPC has broken 'test -x' in bash. which also breaks build process ;)
any ideas?
Is this a Docker issue or FUSE issue? Is there some way we can at least identify where a fix might exist?
This comes into play when doing VSCode Remote Container development for build/make processes that check for executable permissions.
The new "Enable VirtioFS accelerated directory sharing" feature seems to have the same issue; I assume it forces gRPC FUSE back on.
any news on this?
I am not sure why is issue not getting any attention.
It seems that both gRPC FUSE and VirtioFS in the very latest version (4.16.2) still suffer from this bug.
Worse, it seems that the legacy osxfs driver is now hanging on access to bind-mounted volumes (at least on MacOS 12.6.3 ARM), breaking the workaround of using it instead, completely breaking my use case for Docker Desktop.
got the same issue here
Still the same with Docker Desktop 4.19.0.
And still the same for Docker Desktop 4.21.1
Not sure why is this not getting the deserving love.
February of 2024 and I have the same issue.
I have the same error as of April 2024.
I have the same issue.
This seems to effect the stock official node
containers if you give it a CMD to a file that is within a bind mount to your local directory.
For what its worth, several of my colleagues and I switched to OrbStack instead of Docker Desktop and it does not have this problem. If it is a viable option for you, do consider giving it a try.
I came here while analysing check-executables-have-shebangs pre-commit check failing, in a VS Code Dev Container. I tried using the new Docker VMM (beta) today and the pre-commit check is no longer failing. Just thought to leave a note.
This may be the same as issue https://github.com/docker/for-mac/issues/5007 I can't quite tell. I expected False and in that ticket the user expected "access denied".
Expected behavior
The linux command access(path, F_OK) should return False for a file that is not executable.
Actual behavior
When the file is in a shared volume the access command above returns True for a file that is not executable. This despite
ls -l
showing that the file is not executable.Steps to reproduce the behavior
1) On macOS (I have 10.14.6): create a directory containing at least one file that is not executable.
2) Run a Docker image that runs CentOS Linux release 7.7.1908 (Core), mounting that directory into the image. It simplifies the test if the Docker image includes Python (I have 3.7.8 but it should not matter), but it suffices to have gcc.
3) Run the following code inside the image:
I see True if the file is not executable and is on my shared volume, which is incorrect. I see the correct result of False if the file is not executable and is internal to the Docker image.
If you would rather not use Python then compile and run the following C++ code. I get the same results with it as I do with the Python test above.
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.)
macOS 10.14.6 And in the Docker image: