Bug 657570 - strptime()'s '%b' descriptor should be greedy
Summary: strptime()'s '%b' descriptor should be greedy
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: glibc
Version: 5.5
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: 5.7
Assignee: Andreas Schwab
QA Contact: qe-baseos-tools
Depends On: 657266 657572
TreeView+ depends on / blocked
Reported: 2010-11-26 14:26 UTC by Adrien Kunysz
Modified: 2018-11-26 19:29 UTC (History)
6 users (show)

Clone Of: 657266
Last Closed: 2012-02-21 06:32:51 UTC

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0260 normal SHIPPED_LIVE glibc bug fix update 2012-02-20 15:06:42 UTC
Sourceware 4773 None None None 2019-05-20 15:21 UTC

Description Adrien Kunysz 2010-11-26 14:26:29 UTC
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 22:19:04 UTC
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 06:32:51 UTC
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.