Jim Knoble wrote in <06004671-E946-4462-9076-5C11D5D46E40@xxxxxxxxx>: |> On Jan 10, 2025, at 11:33, Steffen Nurpmeso <steffen@xxxxxxxxxx> wrote: |> Fyi there is the >35 years old BSD sysexits.h that unfortunately |> did not become standardized, but is widely available nonetheless. | |If you mean [this sysexits][*], that doesn't seem great for several \ |reasons: | |1. "A few programs exit with the following non-portable error codes. \ |Do not use them." This is contradicted by the fact that they are, effectively, portable. They are used in notable programs like the postfix that even de Raadt esteems, sendmail, OpenSMTPD. #?0|kent:net-src.git$ git grep -F '(EX_' origin/trunk -- \ external bin sbin usr.bin usr.sbin | wc -l 454 #?0|kent:free-src.git$ git grep -F '(EX_' origin/main -- \ contrib bin sbin usr.bin usr.sbin | wc -l 2569 #?0|kent:open-src.git$ git grep -F '(EX_' origin/master -- \ gnu bin sbin usr.bin usr.sbin|wc -l 78 I find it especially notable that some rather new programs use it despite what you say, nvme stuff on FreeBSD, smtpd of OpenBSD... (I use it whenever i can, actually.) |2. The only statuses listed at [*] that could remor be applicable might \ |be `EX_NOINPUT` or `EX_UNAVAILABLE`, but it's arguable that even those \ |are not the meaning that's intended. EX_TEMPFAIL may also be an idea. Yes, sure. That is a real problem. (But hey, let's say 3, or 99!) Like the man page says :) |3. As you say, "did not become standardized". Yep. I have forgotten why. But it likely is because of the standard utilities use 0 or 1 (ISO C success and error), or some explicit numeric value like 127, or "greater than zero" otherwise, and so it would have been foreign to the standard. (And then it is also decades too late to say, let's use EX_USAGE for usage errors, aka, "let's do the differentiation".) While looking around, SunOS 5.9 has a sysexits.h from /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ ... * (c) 1986,1987,1988,1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. and even adds a #define EX_NOTFOUND 79 /* entry not found */ which could also be a thing for you. I add this to my stuff, it seems a useful addition! Not documented in the OpenBSD manual. |[*]: https://man.openbsd.org/sysexits /usr/include/sysexits.h, yes. It was just a suggestion. (For me it all comes from i think fetchmail it was, which gives iirc a plethora of explicit and documented exit status codes for easy non-supervised scriptability. And being able to refer to sysexits.h then makes sense, imho.) I recalled something, and it could be the manual change was around the standard discussion even: commit 1a4410d13b704bf394814d6ac05d07da77853ca7 Author: schwarze <schwarze@xxxxxxxxxxx> AuthorDate: 2017-04-11 17:01:11 +0000 -Some programs use defined error codes to distinguish between possible errors. -However, most programs in -.Ox -do not. +A few programs exit with the following non-portable error codes. +Do not use them. I disagree. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) | |In Fall and Winter, feel "The Dropbear Bard"s pint(er). | |The banded bear |without a care, |Banged on himself for e'er and e'er | |Farewell, dear collar bear _______________________________________________ openssh-unix-dev mailing list openssh-unix-dev@xxxxxxxxxxx https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev