Bug 657570 - strptime()'s '%b' descriptor should be greedy
strptime()'s '%b' descriptor should be greedy
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: glibc (Show other bugs)
5.5
Unspecified Unspecified
low Severity medium
: rc
: 5.7
Assigned To: Andreas Schwab
qe-baseos-tools
:
Depends On: 657266 657572
Blocks:
  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
Environment:
Last Closed: 2012-02-21 01:32:51 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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 
#define _XOPEN_SOURCE
#include <locale.h>
#include <time.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>

int
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
glibc-2.5-42.el5_4.3
$ ./tst-strptime
r = 0x80485c3, r-s = 3, tm.tm_mon = 2
$ echo $?
1

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 $?
0
$ rpm -q glibc
glibc-2.12-1.7.el6_0.3.x86_64
glibc-2.12-1.7.el6_0.3.i686

This was fixed upstream in commit f98c2d06bb4e04e59bb067b301bacf880fb72a9f. Test case was commited in 9ffe4385a8df731953e0857339ebc6dafea05570.
http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=9ffe4385a8df731953e0857339ebc6dafea05570
http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=f98c2d06bb4e04e59bb067b301bacf880fb72a9f
http://sources.redhat.com/bugzilla/show_bug.cgi?id=4773
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.

http://rhn.redhat.com/errata/RHBA-2012-0260.html

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