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

doc: server.listen truncates socket path on unix #6659

Closed

Conversation

jeanregisser
Copy link
Contributor

@jeanregisser jeanregisser commented May 9, 2016

Checklist
  • documentation is changed or added
  • the commit message follows commit guidelines
Affected core subsystem(s)

doc

Description of change

I found out that calling the following code would create a UNIX socket with a truncated path:

const net = require('net');
var server = net.createServer();
server.listen('/tmp/0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz');
// On the FS it ends up creating '/tmp/0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnop' 
// i.e. 103 chars on OSX instead of the initial 113 chars

Internally it ends up calling uv_pipe_bind with the given path which itself is documented to truncate the path. See http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_bind

This is NOT a bug, but a restriction of the unix socket api, as it stores the path in sockaddr_un.sun_path (104 chars on OSX, 108 chars on Linux), see man unix.

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label May 9, 2016
@mscdex mscdex added the net Issues and PRs related to the net subsystem. label May 9, 2016
filesystem, and will *persist until unlinked*.
filesystem path name. It gets truncated to `sizeof(sockaddr_un.sun_path)`
bytes, decreased by 1. It varies on different operating system between 91 and
107 bytes. The typical values are 107 on Linux and 103 on OSX. The path is
Copy link
Member

@bnoordhuis bnoordhuis May 10, 2016

Choose a reason for hiding this comment

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

The convention in the documentation seems to be to spell it as 'OS X' (space before the X.)

EDIT: In the commit log as well.

@bnoordhuis
Copy link
Member

LGTM with nit.

/cc @nodejs/documentation

Internally it ends up calling `uv_pipe_bind` with the given path which
itself is documented to truncate the path. See
http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_bind

This is NOT a bug, but a restriction of the unix
socket api, as it stores the path in `sockaddr_un.sun_path` (104 chars
on OS X, 108 chars on Linux), see `man unix`.
@jasnell
Copy link
Member

jasnell commented May 10, 2016

LGTM

2 similar comments
@estliberitas
Copy link
Contributor

LGTM

@addaleax
Copy link
Member

LGTM

addaleax pushed a commit that referenced this pull request May 12, 2016
Internally it ends up calling `uv_pipe_bind` with the given path which
itself is documented to truncate the path. See
http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_bind

This is NOT a bug, but a restriction of the unix
socket api, as it stores the path in `sockaddr_un.sun_path` (104 chars
on OS X, 108 chars on Linux), see `man unix`.

PR-URL: #6659
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@addaleax
Copy link
Member

Landed in 4c24fbf, removed trailing whitespace upon landing. Thanks!

@addaleax addaleax closed this May 12, 2016
evanlucas pushed a commit that referenced this pull request May 17, 2016
Internally it ends up calling `uv_pipe_bind` with the given path which
itself is documented to truncate the path. See
http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_bind

This is NOT a bug, but a restriction of the unix
socket api, as it stores the path in `sockaddr_un.sun_path` (104 chars
on OS X, 108 chars on Linux), see `man unix`.

PR-URL: #6659
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@MylesBorins
Copy link
Contributor

@addaleax lts?

@addaleax
Copy link
Member

addaleax commented Jun 2, 2016

@thealphanerd yep 👍

MylesBorins pushed a commit that referenced this pull request Jul 11, 2016
Internally it ends up calling `uv_pipe_bind` with the given path which
itself is documented to truncate the path. See
http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_bind

This is NOT a bug, but a restriction of the unix
socket api, as it stores the path in `sockaddr_un.sun_path` (104 chars
on OS X, 108 chars on Linux), see `man unix`.

PR-URL: #6659
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this pull request Jul 11, 2016
Internally it ends up calling `uv_pipe_bind` with the given path which
itself is documented to truncate the path. See
http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_bind

This is NOT a bug, but a restriction of the unix
socket api, as it stores the path in `sockaddr_un.sun_path` (104 chars
on OS X, 108 chars on Linux), see `man unix`.

PR-URL: #6659
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
Internally it ends up calling `uv_pipe_bind` with the given path which
itself is documented to truncate the path. See
http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_bind

This is NOT a bug, but a restriction of the unix
socket api, as it stores the path in `sockaddr_un.sun_path` (104 chars
on OS X, 108 chars on Linux), see `man unix`.

PR-URL: #6659
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
Internally it ends up calling `uv_pipe_bind` with the given path which
itself is documented to truncate the path. See
http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_bind

This is NOT a bug, but a restriction of the unix
socket api, as it stores the path in `sockaddr_un.sun_path` (104 chars
on OS X, 108 chars on Linux), see `man unix`.

PR-URL: #6659
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@MylesBorins MylesBorins mentioned this pull request Jul 12, 2016
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
Internally it ends up calling `uv_pipe_bind` with the given path which
itself is documented to truncate the path. See
http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_bind

This is NOT a bug, but a restriction of the unix
socket api, as it stores the path in `sockaddr_un.sun_path` (104 chars
on OS X, 108 chars on Linux), see `man unix`.

PR-URL: #6659
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
Internally it ends up calling `uv_pipe_bind` with the given path which
itself is documented to truncate the path. See
http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_bind

This is NOT a bug, but a restriction of the unix
socket api, as it stores the path in `sockaddr_un.sun_path` (104 chars
on OS X, 108 chars on Linux), see `man unix`.

PR-URL: #6659
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. net Issues and PRs related to the net subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants