Skip to content

Fix EOF (^D) handling in devpts (partially addr #9333) - #9336

Merged
copybara-service[bot] merged 1 commit into
gvisor:masterfrom
thundergolfer:jonathon/dev-pts-eof-handling
Sep 6, 2023
Merged

copybara-service[bot] merged 1 commit into
gvisor:masterfrom
thundergolfer:jonathon/dev-pts-eof-handling

Conversation

@thundergolfer

Copy link
Copy Markdown
Contributor

This fixes the ctrl-d part of #9333.

Disclaimer: new to this codebase.

@milantracy milantracy added the ready to pull Causes the PR to be imported into Google. Will be removed soon. label Sep 4, 2023

@nlacasse nlacasse left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, and the nice test. One minor nit.

@ayushr2

ayushr2 commented Sep 5, 2023

Copy link
Copy Markdown
Contributor

Could you squash the two commits? Otherwise these will appear as two separate commits on the master branch after merge.

@thundergolfer

Copy link
Copy Markdown
Contributor Author

Oh sure, I thought I could squash just before merge. But I'll squash them now and force push.

@thundergolfer
thundergolfer force-pushed the jonathon/dev-pts-eof-handling branch from bed5b42 to abb4894 Compare September 5, 2023 00:27
@ayushr2
ayushr2 requested a review from nlacasse September 5, 2023 00:43
@ayushr2 ayushr2 added ready to pull Causes the PR to be imported into Google. Will be removed soon. and removed ready to pull Causes the PR to be imported into Google. Will be removed soon. labels Sep 5, 2023
@ayushr2

ayushr2 commented Sep 5, 2023

Copy link
Copy Markdown
Contributor

We don't squash and merge from Github UI (unfortunately...). It needs be go through our internal system (via the "ready to pull" tag). Copybara will clone your PR as a new PR and merge that and close this. And in the process, it just pushes the commits from this branch onto master. So we request the commits are squashed (unless they are meant to be logically separated).

@thundergolfer

Copy link
Copy Markdown
Contributor Author

Make sense. Thanks for the explanation 👌

@nlacasse nlacasse added the kokoro:run Presubmits may be run label Sep 5, 2023
@nlacasse nlacasse added kokoro:forcerun ready to pull Causes the PR to be imported into Google. Will be removed soon. and removed ready to pull Causes the PR to be imported into Google. Will be removed soon. labels Sep 5, 2023
@nlacasse

nlacasse commented Sep 5, 2023

Copy link
Copy Markdown
Contributor

This seems to break the PtyTest.TermiosONLCR test:

[ RUN      ] PtyTest.TermiosONLCR
test/syscalls/linux/pty.cc:466: Failure
Value of: ReadFd(fd.get(), &c, 1)
Expected: -1 (failure), with errno PosixError(errno=11 Resource temporarily unavailable)
  Actual: 0 (of type long)
[  FAILED  ] PtyTest.TermiosONLCR (5 ms)

Full logs here

@thundergolfer
thundergolfer force-pushed the jonathon/dev-pts-eof-handling branch from abb4894 to ff0959b Compare September 5, 2023 22:53
@thundergolfer

thundergolfer commented Sep 5, 2023 •

Copy link
Copy Markdown
Contributor Author

Oh of course, this behavior is only valid in canonical mode, and that test disables the ICANON flag. Pushed a fix.

Edit: commit now passes make test TARGETS=//test/syscalls:pty_test_runsc_ptrace_shared

@nlacasse nlacasse Sep 5, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to hold l.termiosMu to access l.termios.

I would set isCanon := l.termios.LEnabled(linux.ICANON) while the lock is held on line 200, and then reference isCanon in this conditional.

@thundergolfer
thundergolfer force-pushed the jonathon/dev-pts-eof-handling branch from ff0959b to e8c399a Compare September 6, 2023 01:18
@copybara-service
copybara-service Bot merged commit 0230a37 into gvisor:master Sep 6, 2023
@nlacasse

nlacasse commented Sep 6, 2023

Copy link
Copy Markdown
Contributor

This is merged! Thanks for the PR.

@thundergolfer
thundergolfer deleted the jonathon/dev-pts-eof-handling branch September 7, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kokoro:forcerun kokoro:run Presubmits may be run ready to pull Causes the PR to be imported into Google. Will be removed soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants