Op 05/18/16 om 13:55 schreef Ingo Schwarze:
Hi,

Remco wrote on Wed, May 18, 2016 at 10:29:40AM +0200:
Op 05/18/16 om 01:49 schreef Edgar Pettijohn:

The wording made it hard for me to understand at first.
The "unless" "non-zero" seem like double negatives.

Actually, quadruple negation:

  1. Unless
  2. nochdir   is
  3. non-
  4. zero

Yikes.


Index: daemon.3
===================================================================
RCS file: /cvs/src/lib/libc/gen/daemon.3,v
retrieving revision 1.12
diff -u -p -u -r1.12 daemon.3
--- daemon.3    5 Jun 2013 03:39:22 -0000    1.12
+++ daemon.3    17 May 2016 23:42:25 -0000
@@ -43,16 +43,16 @@ The
   function is for programs wishing to detach themselves from the
   controlling terminal and run in the background as system daemons.
   .Pp
-Unless the argument
+If the argument
   .Fa nochdir
-is non-zero,
+is zero,
   .Fn daemon
   changes the current working directory to the root
   .Pq Pa / .
   .Pp
-Unless the argument
+If the argument
   .Fa noclose
-is non-zero,
+is zero,
   .Fn daemon
   will redirect standard input, standard output and standard error to
   .Pa /dev/null .

I quickly committed this correct patch (with two minor tweaks)
in the hope that people stop proposing incorrect versions.

I personally think the cause of confusion is the negated parameters,

Indeed.

Interface designers, *please* design the flags accepted by your
interfaces to have *positive* semantics, even if that means that
some of them are active by default.  That's so much easier to
understand and document.  With flags called NO_FOOBAR, we regularly
end up with double negation in the documentation, and confusion
often ensues.

[...]
Don't use negated parameters by renaming "nochdr" to "cd"

That would have been better, but obviously, it can't be done after
the fact, once the interface if established in practice.  It would
require changing the implementation of the interface and all the
code using it.  That would be extremely error prone and it would
land us in compatibility hell.

Remco's patch is completely wrong.

Yours,
   Ingo



Ingo's right, please ignore my patch, that was kind of a stupid move.

Thanks for setting me straight on this one Ingo.

Reply via email to