| From | Sent On | Attachments |
|---|---|---|
| kmx via RT | Mar 3, 2010 1:47 am | |
| Steve Hay | Mar 4, 2010 8:40 am | |
| Dave Mitchell | Mar 4, 2010 12:17 pm | |
| Steve Hay | Mar 4, 2010 4:17 pm | |
| Jan Dubois | Mar 4, 2010 6:53 pm | |
| Jan Dubois | Mar 4, 2010 7:07 pm | |
| kmx via RT | Mar 4, 2010 11:15 pm | |
| Jan Dubois | Mar 5, 2010 12:26 am | |
| Steve Hay | Mar 5, 2010 1:18 am | |
| Jan Dubois | Mar 5, 2010 12:50 pm | |
| kmx | Mar 5, 2010 11:52 pm | |
| Tim Bunce | Mar 6, 2010 1:37 pm | |
| kmx via RT | Apr 11, 2010 2:35 am | |
| Jan Dubois via RT | Apr 21, 2010 11:55 pm | |
| kmx via RT | Apr 22, 2010 10:46 am | |
| kmx via RT | May 5, 2010 4:30 am | |
| Jan Dubois | May 5, 2010 12:26 pm | |
| Tim Bunce | May 6, 2010 4:05 am | |
| Craig A. Berry | May 6, 2010 6:21 am |
| Subject: | RE: [perl #72704] Buggy fputs(f,s) vs. fputs(s,f) on Win32 (maybe not only) | |
|---|---|---|
| From: | Jan Dubois (ja...@activestate.com) | |
| Date: | Mar 4, 2010 7:07:59 pm | |
| List: | org.perl.perl5-porters | |
On Thu, 04 Mar 2010, Jan Dubois wrote:
On Thu, 04 Mar 2010, Dave Mitchell wrote:
*However*: out in XS/win32 land, you appear to have:
XSUB.h: #define fputs PerlSIO_fputs
That one is correct. PerlSIO_* APIs are supposed to have the same prototype as their corresponding stdio ones.
iperlsys.h:
#if defined(PERL_IMPLICIT_SYS) #define PerlSIO_fputs(f,s) (*PL_StdIO->pPuts)(PL_StdIO, (f),(s)) #else #define PerlSIO_fputs(f,s) fputs(s,f) #endif
This however is busted. The parameters should not be swapped.
The same problem exists for the fputc() function as well. I've attached my attempt at correcting all the mistakes I found. Core Perl still builds fine on Windows and OS X; but I haven't tried building any extensions that use fputs() or fputc().
Note that is would be _possible_ to make a much smaller patch than the one I supplied by just swapping the parameters in
#define PerlSIO_fputs(f,s) (*PL_StdIO->pPuts)(PL_StdIO, (f),(s))
(and also in the corresponding PerlSIO_fputc() #define). It would however be rather confusing longer term, as that works only accidentally: perlsdio.h doesn't swap the parameter order when it should, and iperlsys.h then compensates for that by swapping when it shouldn't. So I would much prefer to use the comprehensive patch provided in my previous message to reduce the amount of brain-pain when somebody looks at these again in the future.
Cheers, -Jan





