GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: fix the false isatty() issue on IBMi by dmabupt · Pull Request #30829 · nodejs/node

Conversation

@dmabupt

@dmabupt dmabupt commented Dec 7, 2019

Copy link
Copy Markdown
Contributor

IBMi PASE always says it is a tty terminal.
For ssh terminals it is true, but for terminals like TN5250 it is not.
Need to identify whether it is actually in a TTY or not.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Dec 7, 2019
@richardlau

richardlau commented Dec 7, 2019

Copy link
Copy Markdown
Member

Presumably this is related to https://www.ibm.com/support/pages/nodejs-failure-pase-error-560-assertion? (And, if so, setting the PASE_STDIO_ISATTY environment variable in code is not an option?)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dmabupt

dmabupt commented Dec 7, 2019

Copy link
Copy Markdown
Contributor Author

Presumably this is related to https://www.ibm.com/support/pages/nodejs-failure-pase-error-560-assertion? (And, if so, setting the PASE_STDIO_ISATTY environment variable in code is not an option?)

Yes, that is the issue.
We can work around by setting PASE_STDIO_ISATTY=N but I think maybe it is better to directly get the result.

richardlau reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Dec 7, 2019

Copy link
Copy Markdown
Contributor

Somewhat related question: is it worth teaching uv_guess_handle() about this?

richardlau, BridgeAR, and addaleax reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

richardlau
richardlau approved these changes Dec 7, 2019
View reviewed changes
Comment thread src/node.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

@richardlau

richardlau commented Dec 7, 2019

Copy link
Copy Markdown
Member

There are some linter failures:

https://travis-ci.com/nodejs/node/jobs/264279822#L301-L308

Running C++ linter...
src/node.cc:113:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/node.cc:562:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/node.cc:564:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/node.cc:565:  Use nullptr instead of NULL  [readability/null_usage] [2]
src/node.cc:566:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
Done processing src/node.cc
Total errors found: 5
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

devnexen
devnexen approved these changes Dec 7, 2019
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented Dec 7, 2019

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/27452/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dmabupt

dmabupt commented Dec 7, 2019

Copy link
Copy Markdown
Contributor Author

uv_guess_handle()

Hello @cjihrig , Do you know any API or test case using uv_guess_handle()? I found test/parallel/test-ttywrap-invalid-fd.js but it seems to be an internal case that I can not directly run?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@richardlau richardlau added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Dec 7, 2019
@richardlau

richardlau commented Dec 7, 2019

Copy link
Copy Markdown
Member

uv_guess_handle()

Hello @cjihrig , Do you know any API or test case using uv_guess_handle()? I found test/parallel/test-ttywrap-invalid-fd.js but it seems to be an internal case that I can not directly run?

@dmabupt If you're not running via the test runner (i.e. tools/test.py parallel/test-ttywrap-invalid-fd) you need to append the flags from the // Flags: comment (i.e. node --expose-internals test/parallel/test-ttywrap-invalid-fd.js).

libuv has its own tests that use uv_guess_handle(). See build instructions and running tests for how to build libuv and run tests (I assume you already know this since you've already contributed to libuv).

dmabupt and cjihrig reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Dec 7, 2019

Copy link
Copy Markdown
Contributor

@dmabupt the documentation for uv_guess_handle() states:

For isatty(3) equivalent functionality use this function and test for UV_TTY.

So I just thought that while you're adding this functionality to Node, it would probably be worthwhile to add it to libuv as well. In fact, uv_guess_handle() could then be used to clean this code up a little bit (one less #ifdef).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Trott
Trott approved these changes Dec 7, 2019
View reviewed changes
@dmabupt

dmabupt commented Dec 8, 2019

Copy link
Copy Markdown
Contributor Author

@dmabupt the documentation for uv_guess_handle() states:

For isatty(3) equivalent functionality use this function and test for UV_TTY.

So I just thought that while you're adding this functionality to Node, it would probably be worthwhile to add it to libuv as well. In fact, uv_guess_handle() could then be used to clean this code up a little bit (one less #ifdef).

Thanks for the information. I have submiited a PR for that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

BridgeAR
BridgeAR approved these changes Dec 8, 2019
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented Dec 8, 2019

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/27490/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Dec 8, 2019

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/27492/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dmabupt
src: fix the false isatty() issue on IBMi
5644ec6
On IBMi PASE isatty() always returns true for stdin, stdout and stderr.
Use ioctl() instead to identify whether it's actually a TTY.
@dmabupt

dmabupt commented Dec 9, 2019

Copy link
Copy Markdown
Contributor Author

I have updated the code to --

    if (ioctl(fd, TXISATTY + 0x81, nullptr) == -1 && errno == ENOTTY)
      continue;

to specifically detect the ENOTTY environment.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Dec 9, 2019

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/27509/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mhdawson
mhdawson approved these changes Dec 9, 2019
View reviewed changes

@mhdawson mhdawson left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
BridgeAR pushed a commit that referenced this pull request Dec 9, 2019
@dmabupt @BridgeAR
src: fix the false isatty() issue on IBMi
68874a6
On IBMi PASE isatty() always returns true for stdin, stdout and stderr.
Use ioctl() instead to identify whether it's actually a TTY.

PR-URL: #30829
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@BridgeAR

BridgeAR commented Dec 9, 2019

Copy link
Copy Markdown
Member

Landed in 68874a6 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR BridgeAR closed this Dec 9, 2019
@dmabupt
dmabupt deleted the ibmi_isatty branch December 10, 2019 05:35
targos pushed a commit that referenced this pull request Dec 10, 2019
@dmabupt @targos
src: fix the false isatty() issue on IBMi
6088603
On IBMi PASE isatty() always returns true for stdin, stdout and stderr.
Use ioctl() instead to identify whether it's actually a TTY.

PR-URL: #30829
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Dec 13, 2019
v13.4.0 proposal #30937
Merged
targos pushed a commit that referenced this pull request Jan 14, 2020
@dmabupt @targos
src: fix the false isatty() issue on IBMi
1743738
On IBMi PASE isatty() always returns true for stdin, stdout and stderr.
Use ioctl() instead to identify whether it's actually a TTY.

PR-URL: #30829
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@targos targos mentioned this pull request Jan 15, 2020
v12.15.0 release proposal #31368
Closed
cjihrig added a commit to cjihrig/node that referenced this pull request Jan 15, 2020
@cjihrig
src: use uv_guess_handle() to detect TTYs
38c0784
This commit reverts nodejs#30829
and uses uv_guess_handle() instead of isatty(). The IBMi
changes are no longer required, as of libuv 1.34.1.

PR-URL: nodejs#31333
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 16, 2020
@cjihrig @MylesBorins
src: use uv_guess_handle() to detect TTYs
6534c6c
This commit reverts #30829
and uses uv_guess_handle() instead of isatty(). The IBMi
changes are no longer required, as of libuv 1.34.1.

PR-URL: #31333
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
@dmabupt @BethGriggs
src: fix the false isatty() issue on IBMi
e00c4e4
On IBMi PASE isatty() always returns true for stdin, stdout and stderr.
Use ioctl() instead to identify whether it's actually a TTY.

PR-URL: #30829
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Feb 8, 2020
v12.16.0 proposal #31691
Merged
codebytere pushed a commit that referenced this pull request Mar 14, 2020
@cjihrig @codebytere
src: use uv_guess_handle() to detect TTYs
7b0687d
This commit reverts #30829
and uses uv_guess_handle() instead of isatty(). The IBMi
changes are no longer required, as of libuv 1.34.1.

PR-URL: #31333
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
codebytere pushed a commit that referenced this pull request Mar 17, 2020
@cjihrig @codebytere
src: use uv_guess_handle() to detect TTYs
1d075cf
This commit reverts #30829
and uses uv_guess_handle() instead of isatty(). The IBMi
changes are no longer required, as of libuv 1.34.1.

PR-URL: #31333
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Trott Trott Trott approved these changes
@richardlau richardlau richardlau approved these changes
@BridgeAR BridgeAR BridgeAR approved these changes
+2 more reviewers
@devnexen devnexen devnexen approved these changes
@mhdawson mhdawson mhdawson approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@dmabupt @richardlau @cjihrig @nodejs-github-bot @BridgeAR @Trott @devnexen @mhdawson
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.