From patchwork Mon Jul 31 14:24:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Lancaster X-Patchwork-Id: 1815030 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=ck2jSCQP; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RF0rV3TX9z1yfG for ; Tue, 1 Aug 2023 00:25:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DFF84385840A for ; Mon, 31 Jul 2023 14:25:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFF84385840A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690813511; bh=ocVH+cRcAVhrz4gc/onbZQiZJvbJ1058BWKqkXCbVIg=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ck2jSCQPPVIlZ3Gmh5u88N9farB5Gh6FcjXzpS1VIzcjps0o1fgBvxfxyjgame2ED prQsRJfEGU75DkvuvKD43xMYH62s0dn4y/oneKwKXcVkIl0wDUKKUgGEeTJ1Oe9R1Z aipGcgqBMgqq64JcNacu3ZNMvHwwdOx2af8efcbo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by sourceware.org (Postfix) with ESMTPS id AA9C33858CD1 for ; Mon, 31 Jul 2023 14:24:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA9C33858CD1 Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-76ad842d12fso379839385a.3 for ; Mon, 31 Jul 2023 07:24:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690813494; x=1691418294; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ocVH+cRcAVhrz4gc/onbZQiZJvbJ1058BWKqkXCbVIg=; b=iVYbbvpFMyRFqya45VcWGY/U3JX4sFUHKTzOB2aC67j7R4WRwQa6TQdSIW2feMUvuW wFSWXpVCRrq5k5PEunp5zLB9Ok2Ayh9QaJ0PYztzwBUISwkpaoOXFqmH2V7q8pMT7N1e o02WxSV8adTWgOplVnDgh2gR4QmYTFuxKN8fYq7pv76eD4ZluL4MnYfVmdMnZF+dGg5D SUYgWyceINJmnIeg82DRkLwsTgRfHhCwBKYy1jpfNCaBjJxwQhGxmJV8Rtij+WitwF8s mf659n8qYGCcAdgCIFKS5Xmpeezql7P0whKWdv7QqXE/t0J7mjeAIAxWkvt1gVB1Xnax 5FJw== X-Gm-Message-State: ABy/qLZspT3GPTZHH+KjuGnGMW12bpIw5g1stCKHoY50Y19PNzabm/OD qZOZJ036dqHpYn+WHUnMZ1D4I/U/KswtSg== X-Google-Smtp-Source: APBJJlGLnS7AFcoGSiFMsAj8Z7WsFcHY89Dt9gqBM8wdMu3K6Azs7Lawyg8gnQIMxKevBsF2XH2UOQ== X-Received: by 2002:a05:620a:454d:b0:76c:a564:c8c8 with SMTP id u13-20020a05620a454d00b0076ca564c8c8mr6781396qkp.66.1690813493673; Mon, 31 Jul 2023 07:24:53 -0700 (PDT) Received: from slancast.remote.csb ([69.71.12.177]) by smtp.gmail.com with ESMTPSA id oo14-20020a05620a530e00b0075772c756e0sm3307484qkn.101.2023.07.31.07.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:24:53 -0700 (PDT) To: libc-alpha@sourceware.org Cc: Stanley Lancaster Subject: [PATCH] %Z [PATCH v6] Date: Mon, 31 Jul 2023 09:24:21 -0500 Message-Id: <20230731142420.23766-1-lancasterharp@gmail.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stanley Lancaster via Libc-alpha From: Stanley Lancaster Reply-To: Stanley Lancaster Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" --- time/strptime_l.c | 19 ++++++++++++++----- time/tst-strptime.c | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/time/strptime_l.c b/time/strptime_l.c index 85c3249fcc..1b84065c19 100644 --- a/time/strptime_l.c +++ b/time/strptime_l.c @@ -770,11 +770,20 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tmp, break; case 'Z': /* Read timezone but perform no conversion. */ - while (ISSPACE (*rp)) - rp++; - while (!ISSPACE (*rp) && *rp != '\0') - rp++; - break; + { + while (ISSPACE (*rp)) + rp++; + /* Read timezone but perform no conversion. */ + /* we recognize the format [-+a-zA-Z0-9]{3,} */ + const char* start_rp = rp; + + while ((*rp >= 'A' && *rp <= 'Z') || + (*rp >= 'a' && *rp <= 'z') || + (*rp >= '0' && *rp <= '9')) + rp++; + if (start_rp+3 < rp) + return NULL; + } case 'z': /* We recognize four formats: 1. Two digits specify hours. diff --git a/time/tst-strptime.c b/time/tst-strptime.c index 3dae9e0594..40145cb109 100644 --- a/time/tst-strptime.c +++ b/time/tst-strptime.c @@ -48,6 +48,8 @@ static const struct 6, 0, 0, 1 }, { "en_US.ISO-8859-1", "2000-01-01 08:12:21 PM", "%Y-%m-%d %I:%M:%S %p", 6, 0, 0, 1 }, + { "en_US.ISO-8859-1", "2000-01-01 08:12:21 AM CST/", "%Y-%m-%d %I:%M:%S %p %Z/", + 6, 0, 0, 1}, { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 }, { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 }, /* Most of the languages do not need the declension of the month names