Just a suggestion, but would it make sense to handle abstract unix sockets differently at the Erlang level?<br><br>Basically if the path is a binary or list consider it a standard path and append the null byte, but if it is for example a tuple `{abstract, string() | binary()}` then prepend the null byte instead of appending?<br><div class="gmail_quote"><div dir="ltr">On Fri, 28 Apr 2017 at 10:42, Raimo Niskanen <<a href="mailto:raimo%2Berlang-questions@erix.ericsson.se">raimo+erlang-questions@erix.ericsson.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Apr 28, 2017 at 04:46:17PM +1200, Richard A. O'Keefe wrote:<br>
:<br>
><br>
> My argument goes like this:<br>
> - Linux is too important to ignore<br>
> - The Linux extension is a genuinely useful feature<br>
> done in a rather unpleasant way<br>
> - If you are using AF_UNIX in the portable way, you should<br>
> provide the *length* of the address, not the *size* of the<br>
> struct. I remember it being that way in 4.2 BSD and have<br>
> cited material from some of the key BSD people that that was<br>
> certainly the intent in 4.3BSD.<br>
> - But if you care about HP-UX, you had better do some experiments.<br>
><br>
> Honestly, just doing the right thing is less effort than arguing<br>
> about it.<br>
<br>
Precisely. Well put! But what is the "right thing"?<br>
<br>
The current implementation passes the address given to it as is, but<br>
ensures it is correctly terminated as in appending a '\0' at the end<br>
that is not counted for address_len, and if that does not fit<br>
in the defined size it bails out.<br>
<br>
That felt like the "right thing" when I wrote it, but you can not set the<br>
last byte of the address to non-zero.<br>
<br>
The new "right thing" could be to add an exception to the above when there<br>
is a '\0' first in the address, since that hopefully will count as a<br>
correct termination on OS:es that do not understand abstract addresses.<br>
<br>
The question is if there is any danger in this because we then give a<br>
contradiction to e.g bind() because we have not used SUN_LEN(su) as we were<br>
told to do...?<br>
<br>
I believe not, and will try to find the time to do this<br>
after our OTP-20.rc1 pre-release.<br>
<br>
--<br>
<br>
/ Raimo Niskanen, Erlang/OTP, Ericsson AB<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>