Skip to content

Problematic ssize_t to int conversion in uv_fs_write #3360

@zbjornson

Description

@zbjornson
  • Version: 1.42.0
  • Platform: Linux/Unix (generic)

uv_fs_write returns an int, but the underlying Linux syscalls return a ssize_t. That conversion is problematic for large writes and has caused a few bugs in Node.js, including:

There are a handful of issues about related compiler warnings (#708, #2714), but I don't see an issue for the actual bug.

I think the only way to fix this without a breaking change is to add ssize_t uv_fs_write64 or ssize_t uv_fs_write2 or something. uv_fs_s's result property is already a ssize_t, so only the return type needs changing.

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