-
Notifications
You must be signed in to change notification settings - Fork 1
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
Files written/modified using output redirection are ignored by the shim #177
Comments
I used strace to find the bug. This is output redirection without the shim (indented lines are irrelevant):
The most important thing to note is the With the shim, we see
At the time of the dup2 call, fd 1 points to the file that stdout is being redirected to (dirone/fileone) and fd 10 is the pseudoterminal normally connected to stdout. In dup2, we already have code that explicitly calls close on the newfd (1 in this case). That should trigger a post for fd 1. Lines 1129 to 1135 in 1ed2cae
But in this case, because oldfd (10, /dev/pts/403) is pointing to a Lines 1120 to 1124 in 1ed2cae
The fix is to move the "... NO POST path device or proc" code after the explicit close. I made this change in bcecd39 and it seems to work. |
While the explanations sound reasonable, just want to highlight aspects of this issue which I don't understand: why this problem isn't on most ubuntu machines, but seemed to show up on redhat 8. ... Pretty sure there was no problem on ubuntu 22.04, for example (perhaps all ubuntu's back to 18...) |
That's what I'm still trying to understand in the tests. I think the redirection problem actually is present on all OS versions and the tests are either using Lines 5 to 8 in e220acc
Or we are incorrectly testing and checking for the wrong behaviour, like this example. The redirection is ignored, but the test passes because the touch causes 1 message to be posted. Lines 106 to 112 in e220acc
In this case, I'm trying to remove all the special KNOWN_REDIRECTION_BUG cases that change the commands run and expected results from the test scripts and compare the results across OS versions and between using |
confusing to me... is that I only set KNOWN_REDIRECTION_BUG on certain Os's .e.g. redhat 8, while things passed without it on ubuntu. It sounds like you're getting to the bottom of it. |
We're already aware of this, but it wasn't documented in an issue.
@petersilva added a variable, KNOWN_REDIRECTION_BUG, to the tests that can be used to ignore this known issue.
Note: we only expect output redirection to work in subshells that are launched after setting LD_PRELOAD.
The text was updated successfully, but these errors were encountered: