GNU bug report logs - #16782
date: reject invalid %[X] format characters

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Severity: wishlist; Reported by: fuz@HIDDEN; dated Mon, 17 Feb 2014 17:46:02 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Changed bug title to 'date: reject invalid %[X] format characters' from 'Insensitive behavior in date when given invalid fomatting string' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 16782 <at> debbugs.gnu.org:


Received: (at 16782) by debbugs.gnu.org; 21 Oct 2018 21:31:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 21 17:31:48 2018
Received: from localhost ([127.0.0.1]:34743 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gELK8-0006Qy-Gc
	for submit <at> debbugs.gnu.org; Sun, 21 Oct 2018 17:31:48 -0400
Received: from mail-it1-f182.google.com ([209.85.166.182]:40582)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>)
 id 1gELK6-0006Lx-LN; Sun, 21 Oct 2018 17:31:47 -0400
Received: by mail-it1-f182.google.com with SMTP id i191-v6so10184868iti.5;
 Sun, 21 Oct 2018 14:31:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=ndrxk0GZxZLZDx6HAihB44QTesN6gbXXkT+x2z4d2+g=;
 b=q0L+KS1o/0cdy7h0eQwv5dyP6f5utzCpn0nn5gXFh8+Ns2zKhn4NPsCMOFoufS3ahE
 /q1W186JOZ2C/RrUlred5m7K/y/gJwoeMpgYF/lqRwF1gVpcjcLX32517khpl1+rAJm5
 7uT+hU/tq29WUjRS1gP+5+6GGF7TAsQvFuvlc3mfOO49cOzr569DSeBhXTG2dm2KHY6o
 /i94OaLLvaCw3d9f2yJSlJDBbQKByddMuCZ+VJFSpCYuuIki1hhGMFCGibqmtXKtK1r2
 yKsi0dFLEGOQCerQ/JCJJ62nBr0RWNtJzuW974/9mwYw5q8lXP5QZSPtEfiJ4oY6SUXK
 p7wA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=ndrxk0GZxZLZDx6HAihB44QTesN6gbXXkT+x2z4d2+g=;
 b=SwOopCbVB8eFFU9CjasiY/xEBDhc71i+54dCeC4jifGaIp3w3cdOZic+4CqP9sMYuo
 2oS+fDgyoZL0wta9EwPVdIZdQFopuQ0+Is/6UoxRHDLDs7g7wFG+ZtYB76+tY81FtllE
 hAxataDUG7kY+UoG0A4qMIHfTepysLW0+LOvUu/0PoBEbLW/0HDAUezKYxpoQ4W/m4uA
 L7y0d7hFzhh9x7D1E5Amt5GiiUggTu9tX26TFhR5PZzqKbc7l4UUHR28JI4B4haQym1L
 xFebG03hEMc0yImmxcPqdHzGPWupvMyGB9ixHezKfaOsut2VFhQfr7d7rK4Hte50t5Qh
 O+9A==
X-Gm-Message-State: ABuFfohhSkMdBVElyFiUIrEXqu85epnIH+FtiODIw81O8f6CxINd4EKO
 Ax2v7+9NLepSvFOngUYyeoZHXS01
X-Google-Smtp-Source: ACcGV61ZMDtUzPAOmW8w7kpBhYbRUPrf/jO0xvjEWgnn6PN8duhjK8hFkHgvpk5MD+UVftrDUVDIYA==
X-Received: by 2002:a02:1a05:: with SMTP id 5-v6mr31044864jai.50.1540157500332; 
 Sun, 21 Oct 2018 14:31:40 -0700 (PDT)
Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38])
 by smtp.googlemail.com with ESMTPSA id
 y18-v6sm291941ioj.86.2018.10.21.14.31.38
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 21 Oct 2018 14:31:39 -0700 (PDT)
Subject: Re: bug#16782: Insensitive behavior in date when given invalid
 fomatting string
To: 16782 <at> debbugs.gnu.org
References: <20140217174201.GA21772@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <a6d273f6-5d77-0a77-5643-dc8edfbbbe52@HIDDEN>
Date: Sun, 21 Oct 2018 15:31:37 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <20140217174201.GA21772@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 16782
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 16782 wishlist
retitle 16782 date: reject invalid %[X] format characters
stop

(triaging old bugs)

Hello,

On 17/02/14 10:42 AM, fuz@HIDDEN wrote:
> Consider the following set of date invocations:
> 
>      $ date +%05
>      00%05
>      $ date +%Y%#05
>      20140%#05
>      $ date +x%7
>      x     %7
>      $ date "+%7 xyz"
>          %7 xyz
>      $ date "+%7q xyz"
>          %7q xyz
> 
> GNU date behaves strangely when given an invalid formatting string. GNU date
> does not inform the user about the invalid formatting string; instead it outputs
> padding as if the flags and field-width

It seems your message was never replied to. Sorry about that.

Indeed, this would be a nice improvement, contrast:

   $ printf "+%7 xyz"
   -bash: printf: ` ': invalid format character

   $ /src/printf "+%7 xyz"
   +./src/printf: %7 : invalid conversion specification

   $ ./src/printf "+%7q xyz"
   +./src/printf: %7q: invalid conversion specification

Marking this as a "wishlist" item.

-assaf





Information forwarded to bug-coreutils@HIDDEN:
bug#16782; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Feb 2014 17:45:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 17 12:45:19 2014
Received: from localhost ([127.0.0.1]:56886 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WFSFr-0004CJ-96
	for submit <at> debbugs.gnu.org; Mon, 17 Feb 2014 12:45:19 -0500
Received: from eggs.gnu.org ([208.118.235.92]:37579)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <fuz@HIDDEN>) id 1WFSAL-000427-J5
 for submit <at> debbugs.gnu.org; Mon, 17 Feb 2014 12:39:38 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <fuz@HIDDEN>) id 1WFSAB-0002RF-4j
 for submit <at> debbugs.gnu.org; Mon, 17 Feb 2014 12:39:32 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:59238)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <fuz@HIDDEN>)
 id 1WFSAB-0002R8-1i
 for submit <at> debbugs.gnu.org; Mon, 17 Feb 2014 12:39:27 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39251)
 by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <fuz@HIDDEN>)
 id 1WFSA6-0004Tc-6W
 for bug-coreutils@HIDDEN; Mon, 17 Feb 2014 12:39:26 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <fuz@HIDDEN>) id 1WFSA1-0002OZ-Df
 for bug-coreutils@HIDDEN; Mon, 17 Feb 2014 12:39:22 -0500
Received: from fuz.su ([5.135.162.8]:42555)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <fuz@HIDDEN>)
 id 1WFSA1-0002O1-7g
 for bug-coreutils@HIDDEN; Mon, 17 Feb 2014 12:39:17 -0500
Received: by fuz.su (Postfix, from userid 1000)
 id 02BDC20431; Mon, 17 Feb 2014 18:42:01 +0100 (CET)
Date: Mon, 17 Feb 2014 18:42:01 +0100
From: fuz@HIDDEN
To: bug-coreutils@HIDDEN
Subject: Insensitive behavior in date when given invalid fomatting string
Message-ID: <20140217174201.GA21772@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
 protocol="application/pgp-signature"; boundary="a8Wt8u1KmwUX3Y2C"
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 17 Feb 2014 12:45:17 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)


--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Consider the following set of date invocations:

    $ date --version
    date (GNU coreutils) 8.20
    Copyright (C) 2012 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by David MacKenzie.
    $ date +%05
    00%05
    $ date +%Y%#05
    20140%#05
    $ date +x%7
    x     %7
    $ date "+%7 xyz"
        %7 xyz
    $ date "+%7q xyz"
        %7q xyz

GNU date behaves strangely when given an invalid formatting string. GNU date
does not inform the user about the invalid formatting string; instead it outputs
padding as if the flags and field-width, flags and E/O modifier were the whole
formatting string, then the unchanged formatting string. This behavior is not
incorrect as of POSIX.1-2008, as the standard does not specify the behavior of
date in case of an invalid format string, yet it is highly unexpected and weird.

I suggest changing GNU date to output incorrect parts of a formatting string
as-is (as done by the date shipped with Solaris) and possibly exiting with a
non-zero exit status.

Yours sincerely,
Robert Clausecker

--a8Wt8u1KmwUX3Y2C
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iQIcBAEBAgAGBQJTAknpAAoJEKg2eTlR210lAfMQAIXIpde332otlJWvSQUkqQT7
VCXYaVQA8g4xb1EjfyiGX2DEHFu09kyek8RjviTJGOqYs6pQ1Lm/PJW8Gqck2oEo
54MYC1qY6F1pHEXeLHjR274x6gB10k3haagyT93l1dyF6FviqlZrOV8ZX33H84yI
zOIMYzUJCWNBH/tbWenPZWvugSDZ9YbDAj88VonUjfewTDbKVAxcTruhFk6Iwok9
QmBvOnvdMzHqV+TKuSZxIc+bPct+EjNcejlLD0YVvyiuwxHzBgdVafTB4zfmReho
nEeQf/ouKvEe4a358ezo7ICCFX0KnMnHDH5DgkmHGW1Wbw+K/eXavk1F8kXFWeb8
FZyV+E5m5LluugfcugeSXjz5M/75eGIpu6pQwp+m0gZGwxtlk/yslAnZAXGCdYu6
hub9ykOSpIV27x8ddzWrk9XS0dHH+U3DnfnQOxBt+67x74mtJiL8Ea3TCp3DzoMU
loNtuSdjtxd+5c2rxyRhP4oAWbR7O9Zj0oGnI6EoGqmjy/0Yciud/PXLqbZkbOsB
+0oovbTvvqfXzfIRS+31xX+tZTAOkicGv2xZyC76nxOnzvLJ+WpF6Ze7VPiEACDc
XjiOZumCbDUVa53D/9Aq3pLaeDEmaD2EeoRcDEU//UzWc0Lky2NqLzl/2sZE9WJi
JEOWie6BkaYmdNW3Vld/
=haf2
-----END PGP SIGNATURE-----

--a8Wt8u1KmwUX3Y2C--




Acknowledgement sent to fuz@HIDDEN:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#16782; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 21 Oct 2018 21:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.