coping with conflicting strerror_r signatures [was: strerror vs. threads]

2011-05-25 Thread Eric Blake
On 05/25/2011 08:32 AM, Eric Blake wrote: > If glibc were to change GNU strerror_r to _always_ populate buf, in > addition to the return string, then you could blindly call either > variant of strerror_r and just ignore the return value; the only > remaining problem is making sure you provide a lar

Re: strerror vs. threads

2011-05-25 Thread Eric Blake
On 05/25/2011 02:59 AM, Simon Josefsson wrote: >> Therefore, I'm afraid that the more portable choice is to consistently >> stick to the standard definition, rather than the GNU definition, even >> if the GNU definition is slightly easier to use. > > Yes. What we'd really like is a dependency sch

Re: strerror vs. threads

2011-05-25 Thread Simon Josefsson
Eric Blake writes: > On 05/24/2011 03:30 PM, Simon Josefsson wrote: >> Maybe there could be a strerror_r-gnu and strerror_r-posix choice? Or a >> strerror_r-posixlean to just do the minimum required by POSIX. > > I think a strerror_r-gnu module might be nice, especially now that I've > posted a

Re: strerror vs. threads

2011-05-24 Thread Eric Blake
On 05/24/2011 03:30 PM, Simon Josefsson wrote: > Maybe there could be a strerror_r-gnu and strerror_r-posix choice? Or a > strerror_r-posixlean to just do the minimum required by POSIX. I think a strerror_r-gnu module might be nice, especially now that I've posted a patch series that decouples st

Re: strerror vs. threads

2011-05-24 Thread Simon Josefsson
Eric Blake writes: > On 05/24/2011 12:52 PM, Simon Josefsson wrote: >>> POSIX explicitly allows strerror to use a static buffer, and that's >>> _exactly_ what gnulib's implementation does on out-of-range input. >>> Which means that "Unknown error (-1)" of thread 1 and "Unknown error >>> (-2)" of

Re: strerror vs. threads

2011-05-24 Thread Paul Eggert
Having had to deal with too many dependencies when using gnulib in GNU Emacs, I can sympathize with Sam Steingold: it'd be nicer to not pull in lock.c, lock.h, threadlib.c merely because an application wants to use strerror. For example, I can't see Emacs using the strerror module if this problem

Re: strerror vs. threads [was: new files imported without new modules added]

2011-05-24 Thread Eric Blake
On 05/24/2011 01:27 PM, Sam Steingold wrote: >> * Eric Blake [2011-05-24 12:24:34 -0600]: >> >> strerror(-1) in thread 1 >> strerror(-2) in thread 2 > > thanks for the explanation. > > My further questions are: > you are not using the standard win32 FormatMessage() function. > how do you hangle

Re: strerror vs. threads [was: new files imported without new modules added]

2011-05-24 Thread Sam Steingold
> * Eric Blake [2011-05-24 12:24:34 -0600]: > > strerror(-1) in thread 1 > strerror(-2) in thread 2 thanks for the explanation. My further questions are: you are not using the standard win32 FormatMessage() function. how do you hangle the gazillion windows error messages? (same goes for system-s

Re: strerror vs. threads

2011-05-24 Thread Eric Blake
On 05/24/2011 12:52 PM, Simon Josefsson wrote: >> POSIX explicitly allows strerror to use a static buffer, and that's >> _exactly_ what gnulib's implementation does on out-of-range input. >> Which means that "Unknown error (-1)" of thread 1 and "Unknown error >> (-2)" of thread 2 are calling sprint

Re: strerror vs. threads [was: new files imported without new modules added]

2011-05-24 Thread Simon Josefsson
Eric Blake writes: > On 05/24/2011 12:06 PM, Sam Steingold wrote: >>> * Eric Blake [2011-05-24 10:54:20 -0600]: >>> >>> Are you multi-threaded? Then you are suffering from a data race. >> >> I am sorry, I am afraid I am out of my depth. >> Why is this function "suffering from a data race"? >>

strerror vs. threads [was: new files imported without new modules added]

2011-05-24 Thread Eric Blake
On 05/24/2011 12:06 PM, Sam Steingold wrote: >> * Eric Blake [2011-05-24 10:54:20 -0600]: >> >> Are you multi-threaded? Then you are suffering from a data race. > > I am sorry, I am afraid I am out of my depth. > Why is this function "suffering from a data race"? > > const char *strerror (int e