-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file executable permissions check error on macos in docker container #5945
Comments
…iner On macOS Sonoma v14.5, it was discovered that when using avocado in a Docker container to run scripts without execute permissions, they are considered to have executable permissions. By directly reading the file's permission bits, the `stat` method can provide more accurate permission check results, especially in cases where user context and file system characteristics might affect the behavior of `os.access`. This method is closer to the underlying implementation of the file system, thus providing consistent results across different environments (such as inside and outside Docker containers). After entering the container using `docker exec -it container bash`, use the `stat` command to check the file permission bits. Reference: avocado-framework#5945 Signed-off-by: Kui Li <[email protected]>
The current implementation of the check_file function has an incorrect logic for checking file permissions. This merge request updates the function to correctly verify the required permissions. Reference: avocado-framework#5945 Signed-off-by: Kui Li <[email protected]>
Hi @eeslook, IIUIC you created your own resolver which can resolve |
Thank you very much for your reply! I indeed created a custom resolver to handle .yml files and convert them into tests. Before submitting this bug, I was aware of the plugin priority settings and realized that adjusting the priority could serve as a workaround for this issue. However, considering that there are currently issues with exec-test permission checks within Docker images on macOS systems, and given that our project also includes other types of files such as .py and bins, with some .py files requiring specific plugins for parsing and others needing the exec-test, if the determination of file executable permissions is not accurate, it will always pose a risk. Therefore, I decided to report this issue and have also proposed a code-level fix. |
I see, I just have looked at your #5946, and we can discuss the details there. Thank you very much for your contribution. |
ok |
On macOS Sonoma v14.5, it was discovered that when using avocado in a Docker container to run scripts without execute permissions, they are considered to have executable permissions. By directly reading the file's permission bits, the `stat` method can provide more accurate permission check results, especially in cases where user context and file system characteristics might affect the behavior of `os.access`. This method is closer to the underlying implementation of the file system, thus providing consistent results across different environments (such as inside and outside Docker containers). After entering the container using `docker exec -it container bash`, use the `stat` command to check the file permission bits. Reference: avocado-framework#5945 Signed-off-by: Kui Li <[email protected]>
On macOS Sonoma v14.5, it was discovered that when using avocado in a Docker container to run scripts without execute permissions, they are considered to have executable permissions. By directly reading the file's permission bits, the 4017715918 919 crw--w---- 1 likui34 tty 268435457 0 "Jun 14 17:41:15 2024" "Jun 14 17:41:16 2024" "Jun 14 17:41:16 2024" "Jan 1 08:00:00 1970" 65536 0 0 (stdin) method can provide more accurate permission check results, especially in cases where user context and file system characteristics might affect the behavior of . This method is closer to the underlying implementation of the file system, thus providing consistent results across different environments (such as inside and outside Docker containers). After entering the container using , use the 4017715918 919 crw--w---- 1 likui34 tty 268435457 0 "Jun 14 17:41:15 2024" "Jun 14 17:41:16 2024" "Jun 14 17:41:16 2024" "Jan 1 08:00:00 1970" 65536 0 0 (stdin) command to check the file permission bits. Reference: avocado-framework#5945 Signed-off-by: Kui Li <[email protected]>
On macOS Sonoma v14.5, it was discovered that when using avocado in a Docker container to run scripts without execute permissions, they are considered to have executable permissions. By directly reading the file's permission bits, the stat method can provide more accurate permission check results, especially in cases where user context and file system characteristics might affect the behavior of os.access. This method is closer to the underlying implementation of the file system, thus providing consistent results across different environments (such as inside and outside Docker containers). After entering the container using docker exec -it container bash, use the stat command to check the file permission bits. Reference: avocado-framework#5945 Signed-off-by: Kui Li <[email protected]>
On macOS Sonoma v14.5, it was discovered that when using avocado in a Docker container to run scripts without execute permissions, they are considered to have executable permissions. By directly reading the file's permission bits, the stat method can provide more accurate permission check results, especially in cases where user context and file system characteristics might affect the behavior of os.access. This method is closer to the underlying implementation of the file system, thus providing consistent results across different environments (such as inside and outside Docker containers). After entering the container using docker exec -it container bash, use the stat command to check the file permission bits. Reference: avocado-framework#5945 Signed-off-by: likui <[email protected]>
On macOS Sonoma v14.5, it was discovered that when using avocado in a Docker container to run scripts without execute permissions, they are considered to have executable permissions. By directly reading the file's permission bits, the stat method can provide more accurate permission check results, especially in cases where user context and file system characteristics might affect the behavior of os.access. This method is closer to the underlying implementation of the file system, thus providing consistent results across different environments (such as inside and outside Docker containers). After entering the container using docker exec -it container bash, use the stat command to check the file permission bits. Reference: avocado-framework#5945 Signed-off-by: Kui Li <[email protected]>
Describe the bug
On macOS Sonoma v14.5, it was discovered that when using avocado in a Docker container to run scripts without execute permissions, they are considered to have executable permissions.
Steps to reproduce
Dockerfile-test
with flow content:docker build -t avocado-test:v1 -f Dockerfile-test .
example/00-most-simple-workflow-only-must-options.yml
at current dirchmod -x example/00-most-simple-workflow-only-must-options.yml
docker run -ti -v $PWD:/it avocado-test:v1 bash
cd /it && avocado -V list example/00-most-simple-workflow-only-must-options.yml
, return:Expected behavior
I have an avocado plugin for example/00-most-simple-workflow-only-must-options.yml to run the scripts.
I have exec-test script too, I hope the yml file run with my avocado plugin and the excutable files run with exec-test.
Current behavior
I run the scripts on Linux with docker is ok, but failed when on macos with docker, because the exec-test runner matched first.
I have both exec-test and workflow tests in the testsuites.
System information (please complete the following information):
uname -a
, Darwin mymacbook 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:13:18 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6030 arm64Additional information
I debug the script in macos in the docker with command
python -m pdb /usr/local/bin/avocado -V list ist example/00-most-simple-workflow-only-must-options.yml
and diff with same step at linunx, get the point:By directly reading the file's permission bits, the
stat
method can provide more accurate permission check results, especially in cases where user context and file system characteristics might affect the behavior ofos.access
. This method is closer to the underlying implementation of the file system, thus providing consistent results across different environments (such as inside and outside Docker containers). After entering the container usingdocker exec -it container bash
, use thestat
command to check the file permission bits:The text was updated successfully, but these errors were encountered: