[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: buildd path name length

* Simon Josefsson:

>> Suppose that a package wants to create a UNIX domain socket as part of
>> its test suite.  If the socket is created within the package build
>> directory, this might fail because of the quite low path name length
>> limit.  What is the correct way of dealing with this?  "mktemp -d" uses
>> TMPDIR, which is potentially affected by the same issue.
>> (My personal opinion is "fix the buildd", especially since none of the
>> official buildds seems to use long path names, but there is
>> disagreement.)
> Can't the low path name length limit be fixed?  What restricts the
> length?  Kernel, libc, filesystem, ...?

It's part of the API:

  /* Structure describing the address of an AF_LOCAL (aka AF_UNIX)
  socket.  */
  struct sockaddr_un
      __SOCKADDR_COMMON (sun_);
      char sun_path[108];         /* Path name.  */

I haven't checked if the Linux kernel actually cares about the actually
length of this data structure (there are explicit length fields in all
cases), but I guess it should work.  However, this might not be portable
to the Hurd or kfreebsd.

In a larger context, there is sockaddr_storage, which indirectly imposes
a limit (because getpeername must complete when passed a
sockaddr_storage argument, for instance).  Overlong UNIX domain sockets
might break some libraries that rely on that functionality.

Reply to: