Skip to content
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

can't execute /dev/stdin on linux #54200

Open
asukaminato0721 opened this issue Aug 4, 2024 · 6 comments · May be fixed by #54458
Open

can't execute /dev/stdin on linux #54200

asukaminato0721 opened this issue Aug 4, 2024 · 6 comments · May be fixed by #54458
Labels
confirmed-bug Issues with confirmed bugs. linux Issues and PRs related to the Linux platform.

Comments

@asukaminato0721
Copy link

asukaminato0721 commented Aug 4, 2024

Version

v22.5.1

Platform

Linux archlinux 6.10.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 27 Jul 2024 16:49:55 +0000 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

printf 'console.log(1)' | node /dev/stdin

How often does it reproduce? Is there a required condition?

every time

What is the expected behavior? Why is that the expected behavior?

1

What do you see instead?

node:fs:453
    return binding.readFileUtf8(path, stringToFlags(options.flag));
                   ^

Error: ENOENT: no such file or directory, open '/proc/2513530/fd/pipe:[611889]'

Additional information

related so problem https://stackoverflow.com/q/77488707/13040423

@OrkWard
Copy link

OrkWard commented Aug 4, 2024

Repro here with v22.5.1 and latest Debian trixie/sid, platform:

Linux debian 6.8.8-surface-1 #1 SMP PREEMPT_DYNAMIC Tue Apr 30 09:10:33 UTC 2024 x86_64 GNU/Linux

Output:

node:fs:441
    return binding.readFileUtf8(path, stringToFlags(options.flag));
                   ^

Error: ENOENT: no such file or directory, open '/proc/540364/fd/pipe:[14951593]'
    at Object.readFileSync (node:fs:441:20)
    at getMaybeCachedSource (node:internal/modules/cjs/loader:1527:18)
    at Module._extensions..js (node:internal/modules/cjs/loader:1539:19)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
    at Module._load (node:internal/modules/cjs/loader:1098:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
    at node:internal/main/run_main_module:30:49 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/proc/540364/fd/pipe:[14951593]'
}

Node.js v22.5.1

@jakecastelli
Copy link
Member

jakecastelli commented Aug 4, 2024

I cannot reproduce this on MacOS m1 arch64

But I can reproduce this on Linux.

Tested on v22.x, v20.x and still can reproduce this, but cannot reproduce this on v18.19.1 and can reproduce on v18.20.4.

@jakecastelli jakecastelli added confirmed-bug Issues with confirmed bugs. and removed confirmed-bug Issues with confirmed bugs. labels Aug 4, 2024
@avivkeller avivkeller added repro-exists linux Issues and PRs related to the Linux platform. labels Aug 5, 2024
@CGQAQ
Copy link
Contributor

CGQAQ commented Aug 15, 2024

Repro here on Windows WSL unbutu 22.04 (5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux)

printf 'console.log(1)' | node /dev/stdin

node:fs:441
    return binding.readFileUtf8(path, stringToFlags(options.flag));
                   ^

Error: ENOENT: no such file or directory, open '/proc/1686/fd/pipe:[29212]'
    at Object.readFileSync (node:fs:441:20)
    at getMaybeCachedSource (node:internal/modules/cjs/loader:1569:18)
    at Module._extensions..js (node:internal/modules/cjs/loader:1652:19)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:166:5)
    at node:internal/main/run_main_module:30:49 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/proc/1686/fd/pipe:[29212]'
}

Node.js v22.6.0

But this works fine

printf 'console.log(1)' | node

1

@skye-lopez
Copy link

Repro on: Ubuntu24.04 Node v19.18.1

Output:

➜  ~ printf 'console.log(1)' | node /dev/stdin     
node:internal/fs/utils:351
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/proc/24533/fd/pipe:[132653]'
    at Object.openSync (node:fs:596:3)
    at Object.readFileSync (node:fs:464:35)
    at Module._extensions..js (node:internal/modules/cjs/loader:1377:18)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49 {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/proc/24533/fd/pipe:[132653]'
}

Node.js v18.19.1

Working alternatives on my system:

 printf 'console.log(1)' | node           
1

printf 'console.log(1)' | node -         
1

@juanarbol juanarbol added the confirmed-bug Issues with confirmed bugs. label Aug 16, 2024
@juanarbol
Copy link
Member

I'll try to fix this.

@avivkeller
Copy link
Member

FWIW printf 'input' | node -p "fs.readFileSync('/dev/stdin').toString()" works.

CGQAQ added a commit to CGQAQ/node that referenced this issue Aug 20, 2024
CGQAQ added a commit to CGQAQ/node that referenced this issue Aug 20, 2024
CGQAQ added a commit to CGQAQ/node that referenced this issue Aug 21, 2024
CGQAQ added a commit to CGQAQ/node that referenced this issue Aug 21, 2024
CGQAQ added a commit to CGQAQ/node that referenced this issue Aug 21, 2024
CGQAQ added a commit to CGQAQ/node that referenced this issue Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. linux Issues and PRs related to the Linux platform.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants