From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18776 invoked by alias); 20 Jul 2007 19:18:09 -0000 Received: (qmail 18760 invoked by uid 22791); 20 Jul 2007 19:18:08 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 20 Jul 2007 19:18:07 +0000 Received: from sunsite.mff.cuni.cz (localhost.localdomain [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.8/8.13.8) with ESMTP id l6KJLrbk006462; Fri, 20 Jul 2007 21:21:53 +0200 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.13.8/8.13.8/Submit) id l6KJLrAw006461; Fri, 20 Jul 2007 21:21:53 +0200 Date: Fri, 20 Jul 2007 19:18:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Handle %x, %X, %r, %c in strptime for certain locales Message-ID: <20070720192152.GD4603@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00038.txt.bz2 Hi! This patch relies on the previous strptime patch I posted today. While strptime (xxx, nl_langinfo (D_FMT), &tm) etc. may be invalid, as the returned format string contains modifiers/width strftime handles, but strptime does not, strptime (xxx, "%x", &tm) must work, unless we declare all the locales using GNU extensions in strftime format strings invalid. This patch will ignore the modifiers and width only in the recursive calls, so it means no user visible extensions to strptime. 2007-07-20 Jakub Jelinek [BZ #4772] * time/strptime_l.c (__strptime_internal): Silently ignore strftime modifiers and field width in recursive calls. --- libc/time/strptime_l.c.jj 2007-07-20 16:55:44.000000000 +0200 +++ libc/time/strptime_l.c 2007-07-20 20:26:18.000000000 +0200 @@ -329,6 +329,18 @@ __strptime_internal (rp, fmt, tmp, state } ++fmt; + if (statep != NULL) + { + /* In recursive calls silently discard strftime modifiers. */ + while (*fmt == '-' || *fmt == '_' || *fmt == '0' + || *fmt == '^' || *fmt == '#') + ++fmt; + + /* And field width. */ + while (*fmt >= '0' && *fmt <= '9') + ++fmt; + } + #ifndef _NL_CURRENT /* We need this for handling the `E' modifier. */ start_over: Jakub