[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16782: Insensitive behavior in date when given invalid fomatting str

From: fuz
Subject: bug#16782: Insensitive behavior in date when given invalid fomatting string
Date: Mon, 17 Feb 2014 18:42:01 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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 
    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
    $ date +%Y%#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

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]