On Tue, 1 Dec 2009, Cyril Brulebois wrote:
your package FTBFS on GNU/kFreeBSD: | gcc $(/bin/sh lfs.sh CFLAGS) -D _XOPEN_SOURCE=500 -pipe -ansi -pedantic -g3 -Wall -O2 -c main.c | main.c:115: error: 'ENODATA' undeclared here (not in a function) | main.c:125: error: 'ENOSR' undeclared here (not in a function) | main.c:126: error: 'ENOSTR' undeclared here (not in a function) | main.c:147: error: 'ETIME' undeclared here (not in a function) | make[1]: *** [main.o] Error 1
One could think of declaring the constant ˙˙ string for eyach of them conditionally, as already done for ECANCELED, but really, upstream shouldn't be inventing the wheel again. There's strerror() for that already.
Oh thank you for your kind words. Firstly, strerror() is not required to be reentrant by SUSv2 [0], which is the one and only standard that lbzip2 is coded against. Secondly, incredible it might seem, I even know about strerror_r(), and if you grep the source for it, you'll find that I deliberately avoided it, since it first appeared in SUSv3 [1]. I do call err2str() from multiple threads in parallel. It's not nice but portable and gets the work done.
Wrt. to the compilation error itself: this is a standards-non-compliance bug in GNU/kFreeBSD; SUSv2 mandates those STREAMS related error numbers [2] [3]. I'm not saying GNU/kFreeBSD should support STREAMS, but it should #define those macros. (Or maybe GNU/kFreeBSD doesn't even intend to support SUSv2; in that case, all bets are off and we're in hack-land.)
I've already fixed this bug about then hours ago, but was unable to make an upstream release. I've fixed it like you suggest. I'll do it in upstream because it won't hurt on other (more conformant) platforms either. Also please don't suggest I put them into a big switch statement, as implementations (like GNU/Linux / glibc) violate the uniqueness requirement and (IIRC) ENOTSUP clashes with EOPNOTSUPP etc.
To keep the diff minimal, I used it in err2str()'s implementation, and #if 0'd the big array out.
That's minimal and wrong; see above.
Thanks for considering.
Thanks for reporting, but please don't assume I'm *this* stupid. Even if I am, I'm not sure I'd deserve those "reinventing the weel" words, esp. in public.
Cheers, lacos [0] http://www.opengroup.org/onlinepubs/007908775/xsh/strerror.html [1] http://www.opengroup.org/onlinepubs/000095399/functions/strerror.html [2] http://www.opengroup.org/onlinepubs/007908775/xsh/errors.html [3] http://www.opengroup.org/onlinepubs/007908775/xsh/errno.h.html

