-
Notifications
You must be signed in to change notification settings - Fork 102
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
dhcpcd -U intermittently fails if stdin is connected to a pipe #285
Comments
Digging further, it seems like if the lease file is still in page cache, the |
Introducing a sleep before piping to dhcpcd appears to make dumplease consistently fail:
There is a secondary failure path that is possible for --dumplease callers that are using unbuffered output or small buffer sizes. This can be reproduced via:
This is possible due to dhcpcd issuing a single |
Checking if data exists in the stdin buffer via an ioctl is unreliable. Allow a user to pass '-' to force stdin parsing. This provides a fix that will allow "no interfaces" to still mean "dump all interfaces". Fixes NetworkConfiguration#285
Previous code used the non-existance of data in the input buffer to determine whether to attempt parsing from stdin. This is racy, so `dhcpcd -U < /path/to/lease` will sometimes fail: # dhcpcd --dumplease --ipv4only < /var/lib/dhcpcd/<iface>.lease dhcpcd is not running The fix uses the (non-)existance of an interface argument to indicate that dhcpcd should wait for data to arrive on stdin. Fixes NetworkConfiguration#285
System details:
Dumping a lease file piped via stdin fails:
But it doesn't with file redirection:
But it is inconsistent and sometimes works, even if dhcpcd isn't running:
an strace:
I see that privsep might be hiding the bigger picture, so I run the same under
strace --follow-forks --output-separately --output=./strace.log
, and I see:strace.log
:and
strace.log.18379
The text was updated successfully, but these errors were encountered: