Bug 657570 - strptime()'s '%b' descriptor should be greedy
strptime()'s '%b' descriptor should be greedy
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: glibc (Show other bugs)
Unspecified Unspecified
low Severity medium
: rc
: 5.7
Assigned To: Andreas Schwab
Depends On: 657266 657572
  Show dependency treegraph
Reported: 2010-11-26 09:26 EST by Adrien Kunysz
Modified: 2016-11-24 11:01 EST (History)
6 users (show)

See Also:
Fixed In Version: glibc-2.5-67
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 657266
Last Closed: 2012-02-21 01:32:51 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Sourceware 4773 None None None Never

  None (edit)
Description Adrien Kunysz 2010-11-26 09:26:29 EST
This is a request to backport the fix of Sourceware bz4773 in RHEL 5.

In RHEL5, the short month name for November in Finnish is not recognized by strptime(). This is due to upstream bug 4773. The test case developped for that bug can be easily adapted to the Finnish locale to show the problem as reported:

$ cat tst-strptime.c 
#include <locale.h>
#include <time.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>

main (void)
  if (setlocale (LC_ALL, "fi_FI.utf8") == NULL)
      puts ("cannot set locale");
      return 1;
  struct tm tm;
  static const char s[] = "marras";
  char *r = strptime (s, "%b", &tm);
  printf ("r = %p, r-s = %ju, tm.tm_mon = %d\n", r, (uintmax_t)(r - s), tm.tm_mon);
  return r == NULL || r - s != strlen(s) || tm.tm_mon != 10;
$ cc -std=gnu99 -o tst-strptime tst-strptime.c

On RHEL 5:

$ rpm -q glibc
$ ./tst-strptime
r = 0x80485c3, r-s = 3, tm.tm_mon = 2
$ echo $?

On RHEL 6:

$ cc -Wall -W -pedantic -std=gnu99 -o tst-strptime tst-strptime.c 
$ ./tst-strptime 
r = 0x4007a1, r-s = 6, tm.tm_mon = 10
$ echo $?
$ rpm -q glibc

This was fixed upstream in commit f98c2d06bb4e04e59bb067b301bacf880fb72a9f. Test case was commited in 9ffe4385a8df731953e0857339ebc6dafea05570.
Comment 2 RHEL Product and Program Management 2011-06-20 18:19:04 EDT
This request was evaluated by Red Hat Product Management for inclusion in Red Hat Enterprise Linux 5.7 and Red Hat does not plan to fix this issue the currently developed update.

Contact your manager or support representative in case you need to escalate this bug.
Comment 5 errata-xmlrpc 2012-02-21 01:32:51 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.