Hi Bruno, On 5/18/24 4:54 AM, Bruno Haible wrote: >> + /* On NetBSD dup3 is a no-op when oldfd == newfd, but we expect >> + an error with errno == EINVAL. */ > > (What is "we", and who expects something from whom?) > I would find it less confusing if written like this: > > /* On NetBSD dup3 is a no-op when oldfd == newfd, but we are > expected to return -1 with errno == EINVAL. */ > or > /* On NetBSD dup3 is a no-op when oldfd == newfd, but we are > expected to fail with error EINVAL. */
Yeah, that comment isn't very well-written now that I read it again. I've pushed the patch with a ChangeLog + the second of your suggestions. >> Should I report this to the NetBSD people? I guess it isn't >> standardized so they are free to do as they wish. > > Ideally every bug that we find in any *BSD should be reported. It's > mostly a question of time, and of likelihood that they fix it. > > In this case, the argument that "look, FreeBSD and OpenBSD do it right [1][2]" > is stronger than the argument "you do it differently than glibc, and glibc > is right" that we could use to argue w.r.t. other bugs. Haha, I assume the "glibc does it right, you do it wrong, be like glibc" argument has been used unsucessfully before? I've submitted a bug report with the links to documentation and a test program for them [1]. I think I even found the right place to change the behavior, so hopefully someone takes a look at it soon. Until then, maybe this should be added to the documentation? You tested NetBSD 9.0 and NetBSD 10.0 and I reproduced on NetBSD 10.0. >From what I can tell from a brief look at the git history (don't know how to use cvs, so github mirror) the behavior hasn't changed since it was introduced in NetBSD 6.0. Collin [1] https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=58266 [2] https://man.netbsd.org/dup3.2