Skip to content

"hello world" bug #43271

@NekoNyanners

Description

@NekoNyanners

Version

v18.2.0

Platform

Linux Neon 5.13.0-44-generic #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

What steps will reproduce the bug?

  • Create a new NodeJS script hello.js
  • Write console.log("hi");
  • Execute with node hello.js > /dev/full

What is the expected behavior?

Non-Zero Exit code and maybe some STDERR output like python3 does, because there is no normal STDOUT output.
e.g. Python3 correctly yields:

Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>
OSError: [Errno 28] No space left on device

What do you see instead?

No text with a zero exit code as if everything worked perfectly.

strace however shows there has indeed been a problem:

$ strace -etrace=write node hello.js > /dev/full

write(5, "*", 1)                        = 1
write(1, "hi\n", 3)                     = -1 ENOSPC (No space left on device)
write(12, "\1\0\0\0\0\0\0\0", 8)        = 8
+++ exited with 0 +++

Additional information

I recently read about the "hello world bug": https://blog.sunfishcode.online/bugs-in-hello-world/
And I noticed NodeJS is on the list as well: https://github.com/sunfishcode/hello-world-vs-io-errors

I have no idea if this has been presented already and I know this isn't really a major problem.
But I was curious as to why it's fixed in other languages (e.g. present in py2 but fixed in py3) but not in NodeJS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions