-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Test that file descriptor state is clean (Overhaul file descriptor handling) #223
Comments
NOTE: I just added a spec test case that I'm confused by. OSH doesn't handle assignment builtins differently than other builtins. But it agrees a lot with zsh, but disagrees with the other shells. Is this an issue of "change fd state state then fork" vs. "fork then change fd state" ?? Not sure why it would be different. Maybe check smoosh?
|
Yeah there is a bug. Two things to do while fixing this:
|
#653 mentions several file descriptor constructs not implemented
|
Feature: - Enforce that FDs only have 2 digits, e.g. echo 99>&1 is allowed but echo 100>&1 isn't. Wrote a test to show that all shells do this except bash. Addresses issue #674. Refactoring that preserves the new move, close, and named FD features. That is, 3>&1- and 3>&- and {fd}> - Use exceptions for error handling within a redirect. There are a bunch of failure cases scattered throughout, and this simplifies the code. - Removed _PushMove in favor of _PushDup and some more code - Removed duplicate code for >file.txt - Get rid of _GetFreeDescriptor(). That was replaced by F_DUPFD, which tells the *kernel* to get a free descriptor (above a certain range). - Script to strace shells (incomplete, but may be useful later.) - Add more test cases. All spec tests still pass. This is most of #223, although there a few more things I'd like to clean up.
OK I did a big refactor that is most of this. We just need some more tests. I started some strace tests in |
While investigating a bug that turned out to be related to issue #202, I found two things
test/spec.sh command_
. bash and dash do one thing, mksh and zsh do another (they have/dev/tty
open), but OSH is even worse. There are pipes open for some reason._GetFreeDescriptor()
incore/process.py
, I should be usingfcntl(..., F_DUPFD, ...)
and looking at the return value, like dash does.The text was updated successfully, but these errors were encountered: