Guilhem Moulin:
> On Sat, 24 Aug 2019 at 20:25:00 +0000, astian wrote:
>> Looking at the patch I don't trust this is the only behaviour change.  I
>> don't understand why this divergence from upstream was introduced and I
>> wish it was reverted altogether.
>
> The patch was added to support the following calls for consistency with
> netcat-traditional:
>
>     nc -l -s 127.0.0.1 -p 12345 ## listen on AF_INET socket 
> INADDR_LOOPBACK:12345
>     nc -l -p 12345              ## listen on AF_INET socket ADDR_ANY:12345
>
> It'd be a regression to stop supporting these forms, or any of the
> others from https://bugs.debian.org/897020#17 .

Ah, blessed compatibility.

>> But if that's not possible below is a patch that you can fold into the
>> existing one.
>> […]
>> -    } else if (argc == 1 && !pflag && !sflag) {
>> +    } else if (argc == 1 && !pflag && (!sflag || family == AF_UNIX)) {
>
> In combination with ‘-U’ the ‘-s’ option only makes sense for datagrams,
> no?

Yes, sorry.  (Now I remember that I was looking into making stream
UNIX-domain clients also bind() and accept an optional '-s' so that the
peer address is reported correctly in verbose mode.  This is an upstream
quirk/bug.)

> AFAICT it's a no-op for stream sockets; might make sense to error
> out unless ‘-u’ is set.

Right, so it could be something like:

-       } else if (argc == 1 && !pflag && !sflag) {
+       } else if (argc == 1 && !pflag && (!sflag || (family == AF_UNIX && 
uflag))) {

Or using the previously suggested diff and adding a dedicated check in
the if group below:

        if (family == AF_UNIX) {
 ...
+               if (sflag && !uflag)
+                       errx(1, "for unix sockets -s is only valid together "
+                           "with -u");

> As for your other patches, I'm personally not keen to further diverge
> with upstream (especially when it comes to adding new flags/options) —

We concur.

Cheers.

Reply via email to