-
Notifications
You must be signed in to change notification settings - Fork 15
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
Commands executing in Scuba can't write to /dev/stdout #126
Comments
Manually walking the symlinks, we find that
It looks like the problem is this:
Ugh. At first glance, it seems like |
The following short-term workaround seems to work for me and I'm planning on using it until this issue is resolved: hooks:
root: chown scubauser:tty /dev/pts/0 (This solution was suggested to me by @JonathonReinhart) |
On another machine running
Related issues: |
@xanarin An even easier workaround is to just remove the redundant function show_help() {
cat << END
USAGE: ${0} [-f] [-c] [-h]
OPTIONAL ARGS:
-f Run tests in "failfast" mode, where testing stops on first failed or errored test
-c Measure coverage during testing and output coverage results
-v Verbose output
-h Display this help and exit
END
} |
In an offline discussion with @JonathonReinhart we wondered if there was a way to reproduce this behavior outside of docker. It turns out there is. Here are 3 PoC snippets that show similar behavior on a normal Linux system with no containers involved. In these snippets, $ sudo -u dummy /bin/bash -c 'cat > /dev/stdout << END
FOOBAR
END'
/bin/bash: /dev/stdout: Permission denied $ echo "foo" > bar
$ sudo -u dummy /bin/bash -c 'cat bar > /dev/stdout'
/bin/bash: /dev/stdout: Permission denied $ sudo -u dummy /bin/bash -c 'echo foo | tee /dev/stdout'
tee: /dev/stdout: Permission denied
foo I believe that these permissions issues occur when a running process launches a child process that changes its UID/EUID, then tries to explicitly open $ id
uid=1000(smartguy) gid=1000(smartguy) groups=1000(smartguy),10(wheel),91(video)
$ sudo -u dummy ls -lH /dev/stdout
crw--w---- 1 smartguy tty 136, 6 Mar 25 16:59 /dev/stdout |
I was writing a bash script that will run inside of a docker container launched with scuba. In that script, I use a heredoc in order to write my help message to STDOUT. The function looks like this:
If I run this script on my host, it works correctly. However, if I run it under Scuba, I get the following error:
I did some research, and I think the issue is the same as the one addressed in this SO post: bash:/dev/stderr: Permission denied. Additionally, I can see that the permissions of /dev/stdout (once all symlinks are followed) are
0620
and the file is owned byroot:tty
:I am able to minimally reproduce this issue by running the following command:
The text was updated successfully, but these errors were encountered: