Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2001 11:22:27 +0400 (MSD)
From:      maxim@macomnet.ru
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/28313: /bin/date -f is broken
Message-ID:  <200106210722.f5L7MRJ29127@news1.macomnet.ru>

next in thread | raw e-mail | index | archive | help

>Number:         28313
>Category:       bin
>Synopsis:       /bin/date -f is broken
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 21 00:30:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Maxim Konovalov
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:

	FreeBSD 5.0-CURRENT
	FreeBSD 4.3-STABLE

>Description:

	/bin/date -f is broken. Please take a look at
	How-To-Repeat section.

>How-To-Repeat:

	# date 200105310101
	Thu May 31 01:01:00 MSD 2001
	$ date -j -f "%m" 2 "+%b"
	Mar
	$ date -j -f "%m" 3 "+%b"
	Mar

>Fix:

Here is my hack, but AFAIK ru@freebsd.org has a more generic solution.

--- date.c.orig	Thu May 31 05:59:07 2001
+++ date.c	Thu May 31 05:58:31 2001
@@ -192,6 +192,7 @@
 
 	if (fmt != NULL) {
 		lt = localtime(&tval);
+		lt->tm_mday = 1;
 		t = strptime(p, fmt, lt);
 		if (t == NULL) {
 			fprintf(stderr, "Failed conversion of ``%s''"
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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