minor, minor, minor bug 
Author Message
 minor, minor, minor bug

Just for the record --

In the process of debugging a problem I'm having with strftime() on
mklinux (not yet solved), I encountered the following potential
inconsistency. In time_strftime() in timemodule.c, the result of
calling strftime() is checked, and a larger buffer is provided if the
result is 0. That's the appropriate behavior on Solaris, and I assume
many other places as well, but not for the version of glibc I've got
under mklinux, and also not for the version of strftime() I just
looked at on one of our local Linux boxes. There, the error value is
when the return value is equal to the size passed in:

STRFTIME(3)         Linux Programmer's Manual         STRFTIME(3)

NAME
       strftime - format date and time

SYNOPSIS
       #include <time.h>

       size_t strftime(char *s, size_t max, const char *format,
                           const struct tm *tm);

[...]

RETURN VALUE
       The  strftime()  function returns the number of characters
       placed in the array s, not including the terminating  NULL
       character.   If  the  value  equals max, it means that the
       array was too small.

The chances are vanishingly small anyone will ever reach this error,
but as long as it's being checked, it might as well be complete. I've
consulted the 1.5b1 sources, and the problem is still there.

Cheers,
Sam Bayer



Mon, 22 May 2000 03:00:00 GMT  
 minor, minor, minor bug

Quote:
> In the process of debugging a problem I'm having with strftime() on
> mklinux (not yet solved), I encountered the following potential
> inconsistency. In time_strftime() in timemodule.c, the result of
> calling strftime() is checked, and a larger buffer is provided if the
> result is 0. That's the appropriate behavior on Solaris, and I assume
> many other places as well, but not for the version of glibc I've got
> under mklinux, and also not for the version of strftime() I just
> looked at on one of our local Linux boxes. There, the error value is
> when the return value is equal to the size passed in:

> STRFTIME(3)         Linux Programmer's Manual         STRFTIME(3)

> NAME
>        strftime - format date and time

> SYNOPSIS
>        #include <time.h>

>        size_t strftime(char *s, size_t max, const char *format,
>                            const struct tm *tm);

> [...]

> RETURN VALUE
>        The  strftime()  function returns the number of characters
>        placed in the array s, not including the terminating  NULL
>        character.   If  the  value  equals max, it means that the
>        array was too small.

> The chances are vanishingly small anyone will ever reach this error,
> but as long as it's being checked, it might as well be complete. I've
> consulted the 1.5b1 sources, and the problem is still there.

My copy of the ANSI std (admittedly not the official book but pretty
close -- "Standard C" by Plaugher and Brodie) clearly states that the
return value is 0 when the buffer is too small.  I think Linux'
attempt to improve the standard is misguided here.

--Guido van Rossum (home page: http://www.python.org/~guido/)



Mon, 22 May 2000 03:00:00 GMT  
 minor, minor, minor bug



Quote:
>> RETURN VALUE
>>        The  strftime()  function returns the number of characters
>>        placed in the array s, not including the terminating  NULL
>>        character.   If  the  value  equals max, it means that the
>>        array was too small.

>> The chances are vanishingly small anyone will ever reach this error,
>> but as long as it's being checked, it might as well be complete. I've
>> consulted the 1.5b1 sources, and the problem is still there.

>My copy of the ANSI std (admittedly not the official book but pretty
>close -- "Standard C" by Plaugher and Brodie) clearly states that the
>return value is 0 when the buffer is too small.  I think Linux'
>attempt to improve the standard is misguided here.

The O'Reilly "POSIX Programmers Guide" agrees with you and P&B, as
does H&S "C A Reference Manual 3e.", as does K&R 2e, as does...

;-) ;-) ;-)



Mon, 22 May 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. one minor bug, two minor problems

2. Minor, minor style question

3. Minor bug - Duplicate Key Bindings

4. BUG(minor): ifNotNil:ifNil: supported but not implemented...

5. Minor bugs

6. A few minor bugs

7. Minor packaqge browser bug?

8. Minor DBConnection bug / suggestion for improvement

9. Minor UI bug

10. Minor bug with FS in gawk 3.0.x

11. Win32Forth Version 3.3 Minor BUG

12. minor bug in click.exe

 

 
Powered by phpBB® Forum Software