From nobody@FreeBSD.org  Thu Jun  3 06:27:22 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2C18E106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  3 Jun 2010 06:27:22 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 00D068FC18
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  3 Jun 2010 06:27:22 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o536RLk8039129
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 3 Jun 2010 06:27:21 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o536RLgE039128;
	Thu, 3 Jun 2010 06:27:21 GMT
	(envelope-from nobody)
Message-Id: <201006030627.o536RLgE039128@www.freebsd.org>
Date: Thu, 3 Jun 2010 06:27:21 GMT
From: Valeriu Mihailov <valeriu@mail.utm.md>
To: freebsd-gnats-submit@FreeBSD.org
Subject: date dont show the number of the last day of the year
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         147354
>Category:       bin
>Synopsis:       date(1) doesn't show the number of the last day of the year
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    brian
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 03 06:30:01 UTC 2010
>Closed-Date:    Sat Jun 12 02:05:34 UTC 2010
>Last-Modified:  Sat Jun 12 02:10:01 UTC 2010
>Originator:     Valeriu Mihailov
>Release:        7.2-RELEASE
>Organization:
Technical University of Moldova
>Environment:
FreeBSD  7.2-RELEASE FreeBSD 7.2-RELEASE #1: Fri Sep 11 18:07:19 MSD 2009     root@mvp:/usr/src/sys/amd64/compile/MY  amd64
[
>Description:
command date dont show the number of the last day of the year :  30 december work and 31 december dont work

>How-To-Repeat:
# date -v30d -v12m "+%j"
364
# date -v31d -v12m "+%j"
31d: Cannot apply date adjustment

>Fix:


>Release-Note:
>Audit-Trail:

From: "Valeriu Mihailov" <valeriu@mail.utm.md>
To: <bug-followup@FreeBSD.org>,
	"Valeriu Mihailov" <valeriu@mail.utm.md>
Cc:  
Subject: Re: bin/147354: date(1) doesn't show the number of the last day of the year
Date: Thu, 3 Jun 2010 10:34:36 +0300

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_001E_01CB0308.5CCC5DB0
 Content-Type: text/plain;
 	charset="koi8-r"
 Content-Transfer-Encoding: quoted-printable
 
 RECTIFYING:  date dont show number of the 31 day in months
 
 # date -v31d -v01m "+%j"
 31d: Cannot apply date adjustment
 # date -v28d -v02m "+%j"
 059
 # date -v29d -v02m "+%j"
 059
 # date -v30d -v02m "+%j"
 059
 # date -v31d -v02m "+%j"
 31d: Cannot apply date adjustment
 # date -v30d -v03m "+%j"
 089
 # date -v31d -v03m "+%j"
 31d: Cannot apply date adjustment
 # date -v31d -v05m "+%j"
 31d: Cannot apply date adjustment
 # date -v31d -v07m "+%j"
 31d: Cannot apply date adjustment
 # date -v31d -v08m "+%j"
 31d: Cannot apply date adjustment
 # date -v31d -v10m "+%j"
 31d: Cannot apply date adjustment
 # date -v31d -v12m "+%j"
 31d: Cannot apply date adjustment
 ------=_NextPart_000_001E_01CB0308.5CCC5DB0
 Content-Type: text/html;
 	charset="koi8-r"
 Content-Transfer-Encoding: quoted-printable
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <HTML><HEAD>
 <META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
 <META content=3D"MSHTML 6.00.2900.3676" name=3DGENERATOR>
 <STYLE></STYLE>
 </HEAD>
 <BODY bgColor=3D#ffffff>
 <DIV><FONT face=3DArial size=3D2>RECTIFYING:&nbsp; date dont show number =
 of the 31=20
 day in months</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
 <DIV><FONT face=3DArial size=3D2># date -v31d -v01m "+%j"<BR>31d: Cannot =
 apply date=20
 adjustment<BR># date -v28d -v02m "+%j"<BR>059<BR># date -v29d -v02m=20
 "+%j"<BR>059<BR># date -v30d -v02m "+%j"<BR>059<BR># date -v31d -v02m=20
 "+%j"<BR>31d: Cannot apply date adjustment<BR># date -v30d -v03m=20
 "+%j"<BR>089<BR># date -v31d -v03m "+%j"<BR>31d: Cannot apply date=20
 adjustment</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2># date -v31d -v05m "+%j"<BR>31d: Cannot =
 apply date=20
 adjustment</FONT></DIV>
 <DIV><FONT size=3D2><FONT face=3DArial># date -v31d -v07m "+%j"<BR>31d: =
 Cannot apply=20
 date adjustment</FONT></FONT></DIV>
 <DIV><FONT size=3D2><FONT face=3DArial>
 <DIV><FONT size=3D2><FONT face=3DArial>
 <DIV><FONT size=3D2><FONT face=3DArial># date -v31d -v08m "+%j"<BR>31d: =
 Cannot apply=20
 date adjustment
 <DIV><FONT size=3D2><FONT face=3DArial># date -v31d -v10m "+%j"<BR>31d: =
 Cannot apply=20
 date adjustment</FONT></FONT></DIV>
 <DIV>
 <DIV><FONT size=3D2><FONT face=3DArial># date -v31d -v12m "+%j"<BR>31d: =
 Cannot apply=20
 date=20
 adjustment</FONT></FONT></DIV></DIV></FONT></FONT></DIV></FONT></FONT></D=
 IV></FONT></DIV></FONT></BODY></HTML>
 
 ------=_NextPart_000_001E_01CB0308.5CCC5DB0--
 
Responsible-Changed-From-To: freebsd-bugs->brian 
Responsible-Changed-By: brian 
Responsible-Changed-When: Thu Jun 3 08:14:47 UTC 2010 
Responsible-Changed-Why:  
I wrote this code... 

The -v switch in date(1) is intended to work this way; it applies the 
adjustments in order.  So, while 'date -v31d -v12m' won't work when the 
current month has less than 31 days, 'date -v12m -v31d' will always work. 

The rationalle behind this is that because adjustments may be relative 
rather than absolute (or may even be a mixture), they must be applied in 
order.  For example, to find the last day of February, 2012 you can use 
'date -v1d -v3m -v2012y -v-1d +%d', and the arguments are not commutitive. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147354 
State-Changed-From-To: open->feedback 
State-Changed-By: brian 
State-Changed-When: Thu Jun 3 08:21:16 UTC 2010 
State-Changed-Why:  
I believe this bug can be closed.  Valeriu, can you confirm that this is 
ok?  Do you think any updates are needed with the documentation? 

Thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147354 

From: "Valeriu Mihailov" <valeriu@mail.utm.md>
To: <bug-followup@FreeBSD.org>,
	"Valeriu Mihailov" <valeriu@mail.utm.md>
Cc:  
Subject: Re: bin/147354: date(1) doesn't show the number of the last day of the year
Date: Thu, 3 Jun 2010 14:46:31 +0300

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_0004_01CB032B.8E13F220
 Content-Type: text/plain;
 	charset="koi8-r"
 Content-Transfer-Encoding: quoted-printable
 
 Hi Brian.
 
 All work very well.
 
 Now I understand - "Flags are processed in the order given. " :)
 But in man documentation in all examples, to which I looked for writing =
 my scripts, is reverse order. :)
 
 I think, should make changes in documentation (show this examples).
 
 With best regards,
    Valeriu.
 
 ------=_NextPart_000_0004_01CB032B.8E13F220
 Content-Type: text/html;
 	charset="koi8-r"
 Content-Transfer-Encoding: quoted-printable
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <HTML><HEAD>
 <META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
 <META content=3D"MSHTML 6.00.2900.3676" name=3DGENERATOR>
 <STYLE></STYLE>
 </HEAD>
 <BODY bgColor=3D#ffffff>
 <DIV><FONT face=3DArial size=3D2>Hi Brian.</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
 <DIV><FONT face=3DArial size=3D2>All work very well.</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
 <DIV><FONT face=3DArial size=3D2>Now I understand - "Flags are processed =
 in the=20
 order given. " :)</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2>But in man documentation in all =
 examples, to which=20
 I looked for writing my scripts,&nbsp;</FONT><FONT face=3DArial =
 size=3D2>is reverse=20
 order. :)</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
 <DIV>
 <DIV><FONT face=3DArial size=3D2>I think, should make changes in =
 documentation (show=20
 this examples).</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
 <DIV><FONT face=3DArial size=3D2>With best regards,</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2>&nbsp; &nbsp;Valeriu.</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></DIV></BODY></HTML>
 
 ------=_NextPart_000_0004_01CB032B.8E13F220--
 
State-Changed-From-To: feedback->patched 
State-Changed-By: brian 
State-Changed-When: Fri Jun 4 06:57:30 UTC 2010 
State-Changed-Why:  
I've adjusted the documentation to explain the subtleties of setting absolute 
days; r208795.  I'll MFC in two weeks given re@ permission. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147354 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/147354: commit references a PR
Date: Fri,  4 Jun 2010 06:57:12 +0000 (UTC)

 Author: brian
 Date: Fri Jun  4 06:56:58 2010
 New Revision: 208795
 URL: http://svn.freebsd.org/changeset/base/208795
 
 Log:
   Explain that setting an absolute day value can fail and that the month should
   usually be set first when using -v.
   
   Adjust an example that sets the day to 30 before setting the month to 3 in
   accordance with this approach as the example would always fail in February!
   
   PR:		147354
   MFC after:	2 weeks
 
 Modified:
   head/bin/date/date.1
 
 Modified: head/bin/date/date.1
 ==============================================================================
 --- head/bin/date/date.1	Fri Jun  4 06:35:36 2010	(r208794)
 +++ head/bin/date/date.1	Fri Jun  4 06:56:58 2010	(r208795)
 @@ -32,7 +32,7 @@
  .\"     @(#)date.1	8.3 (Berkeley) 4/28/95
  .\" $FreeBSD$
  .\"
 -.Dd June 2, 2007
 +.Dd June 3, 2010
  .Dt DATE 1
  .Os
  .Sh NAME
 @@ -219,6 +219,14 @@ When the date is adjusted to a specific 
  the resulting timezone will be set so that the date matches the earlier of
  the two times.
  .Pp
 +It is not possible to adjust a date to an invalid absolute day, so using
 +the switches
 +.Fl v No 31d Fl v No 12m
 +will simply fail five months of the year.
 +It is therefore usual to set the month before setting the day; using
 +.Fl v No 12m Fl v No 31d
 +always works.
 +.Pp
  Adjusting the date by months is inherently ambiguous because
  a month is a unit of variable length depending on the current date.
  This kind of date adjustment is applied in the most intuitive way.
 @@ -339,9 +347,9 @@ will display the last day of February in
  .Pp
  .Dl "Tue Feb 29 03:18:00 GMT 2000"
  .Pp
 -So will do the command:
 +So will the command:
  .Pp
 -.Dl "date -v30d -v3m -v0y -v-1m"
 +.Dl "date -v3m -v30d -v0y -v-1m"
  .Pp
  because there is no such date as the 30th of February.
  .Pp
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: Brian Somers <brian@FreeBSD.org>
To: "Valeriu Mihailov" <valeriu@mail.utm.md>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/147354: date(1) doesn't show the number of the last day of
 the year
Date: Fri, 4 Jun 2010 00:01:48 -0700

 --Sig_/Uwl21UXBFCnoiVL+TgZ7MFY
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: quoted-printable
 
 You're right.  Hopefully r208795 makes things clearer.
 
 Thanks.
 
 On Thu, 3 Jun 2010 11:50:04 GMT "Valeriu Mihailov" <valeriu@mail.utm.md> wr=
 ote:
 >  Hi Brian.
 > =20
 >  All work very well.
 > =20
 >  Now I understand - "Flags are processed in the order given. " :)
 >  But in man documentation in all examples, to which I looked for writing =
 =3D
 >  my scripts, is reverse order. :)
 > =20
 >  I think, should make changes in documentation (show this examples).
 
 --=20
 Brian Somers                                          <brian@Awfulhak.org>
 Don't _EVER_ lose your sense of humour !               <brian@FreeBSD.org>
 
 --Sig_/Uwl21UXBFCnoiVL+TgZ7MFY
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Disposition: attachment; filename=signature.asc
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (FreeBSD)
 
 iQCVAwUBTAik4g7tvOdmanQhAQIhDQQArBSR+7jC0gOCSOTWmXrqpjCdlZzJAzZe
 X3rP3GQcQPhtyEq9fZOn/p1VdMkrYHL8fQe+K2NjXehVqQrzH54hORMzq6WSrIxB
 2ksq/pU5Nh9dSW8tCLQu0Qf7AHB7fRKVoo3eSpxksvJa+YDigFAi8Rd2GEQuQAWo
 QhGeoYgKEAM=
 =g3i1
 -----END PGP SIGNATURE-----
 
 --Sig_/Uwl21UXBFCnoiVL+TgZ7MFY--
State-Changed-From-To: patched->closed 
State-Changed-By: brian 
State-Changed-When: Sat Jun 12 02:05:03 UTC 2010 
State-Changed-Why:  
Merged to 8.1, r209086 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147354 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/147354: commit references a PR
Date: Sat, 12 Jun 2010 02:00:30 +0000 (UTC)

 Author: brian
 Date: Sat Jun 12 02:00:15 2010
 New Revision: 209086
 URL: http://svn.freebsd.org/changeset/base/209086
 
 Log:
   MFC r208795; additional date -v detail
   
   PR:		147354
   Approved by:	re (kib)
 
 Modified:
   stable/8/bin/date/date.1
 Directory Properties:
   stable/8/bin/date/   (props changed)
 
 Modified: stable/8/bin/date/date.1
 ==============================================================================
 --- stable/8/bin/date/date.1	Sat Jun 12 01:45:29 2010	(r209085)
 +++ stable/8/bin/date/date.1	Sat Jun 12 02:00:15 2010	(r209086)
 @@ -32,7 +32,7 @@
  .\"     @(#)date.1	8.3 (Berkeley) 4/28/95
  .\" $FreeBSD$
  .\"
 -.Dd June 2, 2007
 +.Dd June 3, 2010
  .Dt DATE 1
  .Os
  .Sh NAME
 @@ -219,6 +219,14 @@ When the date is adjusted to a specific 
  the resulting timezone will be set so that the date matches the earlier of
  the two times.
  .Pp
 +It is not possible to adjust a date to an invalid absolute day, so using
 +the switches
 +.Fl v No 31d Fl v No 12m
 +will simply fail five months of the year.
 +It is therefore usual to set the month before setting the day; using
 +.Fl v No 12m Fl v No 31d
 +always works.
 +.Pp
  Adjusting the date by months is inherently ambiguous because
  a month is a unit of variable length depending on the current date.
  This kind of date adjustment is applied in the most intuitive way.
 @@ -339,9 +347,9 @@ will display the last day of February in
  .Pp
  .Dl "Tue Feb 29 03:18:00 GMT 2000"
  .Pp
 -So will do the command:
 +So will the command:
  .Pp
 -.Dl "date -v30d -v3m -v0y -v-1m"
 +.Dl "date -v3m -v30d -v0y -v-1m"
  .Pp
  because there is no such date as the 30th of February.
  .Pp
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
