Skip to content

fs.realpath.native causes SIGABRT on darwin when the realpath is really long #34900

Closed
@ashi009

Description

@ashi009
  • Version: v12.12.0 and v14.8.0
  • Platform: Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64
  • Subsystem: fs

What steps will reproduce the bug?

$ LONG_PATH='/tmp/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/long/path/254B'
$ SHORT_LINK='/tmp/short'
$ mkdir -p "${LONG_PATH}"
$ ln -s "${LONG_PATH}" "${SHORT_LINK}"
$ node -e "fs.realpathSync.native('${SHORT_LINK}/file-not-exist')"
node(60274,0x10eabedc0) malloc: Incorrect checksum for freed object 0x104805aa0: probably modified after being freed.
Corrupt value: 0x7473697865
node(60274,0x10eabedc0) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6

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

Almost every time.

What is the expected behavior?

return ENOENT.

What do you see instead?

Crash with SIGABRT

Additional information

The bug is confirmed by the libuv and the patch is underway: libuv/libuv#2965

Metadata

Metadata

Assignees

No one assigned

    Labels

    libuvIssues and PRs related to the libuv dependency or the uv binding.macosIssues and PRs related to the macOS platform / OSX.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions