Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jan 2016 00:42:02 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 206752] [patch] /bin/date format conversion bug
Message-ID:  <bug-206752-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206752

            Bug ID: 206752
           Summary: [patch] /bin/date format conversion bug
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: jrm@ftfl.ca
          Keywords: patch

Created attachment 166294
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D166294&action=
=3Dedit
svn diff

% date -j -f %Y-%m 2015-02 '+%B %Y'
March 2015

In the code, a tm structure is initially created with the current time.  If
input_fmt and new_date are supplied, then the appropriate values in that tm
structure are overwritten.  The problem is that this can lead to invalid da=
tes
when only a partial input_fmt/new_date are supplied like above.  In the exa=
mple
above, the tm_mday is left as is (today is the 29th day of the month), but =
the
tm_mon is overwritten with 01 (February) leading to an invalid date.

The attached patch fixes the above issue by setting the default tm_mday to =
1,
when an input_fmt is supplied.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-206752-8>