Skip to content
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

busybox ash echo weirdness #3129

Closed
agowa opened this issue Apr 26, 2018 · 8 comments
Closed

busybox ash echo weirdness #3129

agowa opened this issue Apr 26, 2018 · 8 comments

Comments

@agowa
Copy link

agowa commented Apr 26, 2018

Your Windows build number

Microsoft Windows [Version 10.0.17650.1001]

What you're doing and what's happening

Within Alpine Linux as root (busybox ash):

wget https://raw.githubusercontent.com/jirutka/alpine-make-rootfs/v0.1.0/alpine-make-rootfs
echo '714a764b96442f551084fc50941fd1352e15ca6d  alpine-make-rootfs' | sha1sum -c

What's wrong / what should be happening instead

2nd command fails with can't set tty process group (Operation not permitted)

Used wsl userland: Alpine
Used shell: ash
Symlinks in the system:
/bin/echo => /bin/busybox
/bin/ash => /bin/busybox

but it is not a problem of busybox, as doing all of the following works:

ash -c "echo '714a764b96442f551084fc50941fd1352e15ca6d  alpine-make-rootfs'" | sha1sum -c
/bin/echo '714a764b96442f551084fc50941fd1352e15ca6d  alpine-make-rootfs' | sha1sum -c
busybox echo '714a764b96442f551084fc50941fd1352e15ca6d  alpine-make-rootfs' | sha1sum -c

also using zsh or bash instead of ash

Strace of the failing command

gist

@therealkenc
Copy link
Collaborator

I don't have an Alpine setup handy (I'll look next time I do), but here's the fail, anyway. You might want to make sure you've used strace -f -o and post a gist for legibility. I would have expected to see PIDs in the first column. Hesitate to speculate (but have a hunch).

rt_sigprocmask(SIG_BLOCK, ~[], [], 8)   = 0
fork()                                  = 79
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=79, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]})                 = 0
setpgid(79, 79)                         = -1 ESRCH (No such process)
close(4)                                = 0
stat("/sbin/sha1sum", 0x7fffe4f74ad8)   = -1 ENOENT (No such file or directory)
stat("/bin/sha1sum", 0x7fffe4f74ad8)    = -1 ENOENT (No such file or directory)
stat("/usr/sbin/sha1sum", 0x7fffe4f74ad8) = -1 ENOENT (No such file or directory)
stat("/usr/bin/sha1sum", {st_mode=S_IFREG|0755, st_size=805024, ...}) = 0
rt_sigprocmask(SIG_BLOCK, ~[], [], 8)   = 0
fork() ash:                                  can't set tty process group (Operation not permitted)= 80

rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=80, si_uid=0, si_status=2, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]})                 = 0
setpgid(80, 79)                         = -1 ESRCH (No such process)
close(3)                                = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WSTOPPED, NULL) = 79
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 2}], WSTOPPED, NULL) = 80
ioctl(10, TIOCSPGRP, [78])              = 0
wait4(-1, 0x7fffe4f74b7c, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child process)

@Biswa96
Copy link

Biswa96 commented Apr 28, 2018

@agowa338 Yes, that second command does not work. But if you change a little it then works. Try this:

wget https://raw.githubusercontent.com/jirutka/alpine-make-rootfs/v0.1.0/alpine-make-rootfs
echo '714a764b96442f551084fc50941fd1352e15ca6d  alpine-make-rootfs' > test.txt
sha1sum -c test.txt

@agowa
Copy link
Author

agowa commented Apr 29, 2018

I tried to generate a new strace file, but as soon as I specify the "-f" option it works. So I'm unable to provide a strace -f -o output, but I can provide a strace -o output. But I doubt it will be much different than the one from above
pipeError.log

@Biswa96 This is currently not a blocking bug for me. I just discovered it and would like to have it fixed. But thanks anyway for that workaround.

@therealkenc
Copy link
Collaborator

I just discovered it and would like to have it fixed.

If you don't hear different, keep one eye on #2786 / #1353. It might be working under strace because the child stays alive just long enough.

@therealkenc
Copy link
Collaborator

I got something today that might be related. This was on 17661 and Ubuntu 16.04.

63    waitid(P_PID, 13, {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13, si_uid=0, si_status=213, si_utime=0, si_stime=0}, WEXITED, NULL) = 0
63    waitid(P_ALL, 0, 0x7ffffc491380, WNOHANG|WEXITED|WNOWAIT, NULL) = -1 ECHILD (No child processes)
63    clock_gettime(CLOCK_MONOTONIC, {233, 656312000}) = 0
63    epoll_wait(4,  <unfinished ...>
62    +++ killed by SIGKILL +++

I don't have a repro anyone wants to hear. The catch is in my case, that SIGKILL causes a blue screen. I sent a minidump to secure@microsoft.com and poked @benhillis.

@therealkenc
Copy link
Collaborator

@agowa338 - please try build 17713 and see if it addresses your issue with ash on Alpine.

@knottio
Copy link

knottio commented Sep 7, 2018

@therealkenc I had this same issue on Alpine prior to build 17713. Updating to 17713 fixed it.

@therealkenc
Copy link
Collaborator

Right thanks for the heads up. My suspicion was correct and this was Rick Grimes problem. Duping for closure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants