Date: Wed, 27 Feb 2013 11:01:25 +1100 From: Greg 'groggy' Lehey <grog@FreeBSD.org> To: Jilles Tjoelker <jilles@stack.nl> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Peter Jeremy <peterj@FreeBSD.org>, src-committers@FreeBSD.org Subject: Re: svn commit: r247274 - in head: bin/test tools/regression/bin/test Message-ID: <20130227000125.GA7223@eureka.lemis.com> In-Reply-To: <20130226000227.GA80718@stack.nl> References: <201302251905.r1PJ5fKF085179@svn.freebsd.org> <20130226000227.GA80718@stack.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
--RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tuesday, 26 February 2013 at 1:02:27 +0100, Jilles Tjoelker wrote: > On Mon, Feb 25, 2013 at 07:05:41PM +0000, Peter Jeremy wrote: >> Author: peterj >> Date: Mon Feb 25 19:05:40 2013 >> New Revision: 247274 >> URL: http://svnweb.freebsd.org/changeset/base/247274 > >> Log: >> Enhance test(1) by adding provision to compare any combination of the >> access, birth, change and modify times of two files, instead of only >> being able to compare modify times. The builtin test in sh(1) will >> automagically acquire the same expansion. > >> Approved by: grog >> MFC after: 2 weeks > > What do you need this for? Lots of things. For example, I need it to compare photos I have created and then set the timestamp to the time of exposure. The only way I can establish that the image is newer is via the creation timestamp. In the past I've wished I had the functionality for other reasons I now forget. Peter has other reasons again. I expect other users to also find this useful. Arguably comparing different kinds of timestamps is not very useful, but then, that's "arguably". Others might find a use for it. > If it is not needed very often, this test can > be done more portably (older FreeBSD and GNU) as > [ -n "$(find -L FILE1 -prune -newerXY FILE2 2>/dev/null)" ] That's really ugly. It's also difficult for the casual reader to understand. > I have generally been rather reluctant in adding things to sh(1) and > even more so if they are completely new. Someone proposed something > rather similar (except that it added a time string parser -- even more > code) in PR bin/57054 and I rejected it in 2009. That was a much larger chunk of code. And times change. In December 1998 I added an -S option to ls(1), and jkh (my mentor) refused it on the basis of bloat. In June 2005, keramida submitted similar functionality, and it was committed as revision 146924. It's also functionality that I use frequently. Re bloat. Here's before and after: text data bss dec hex filename 25645 1152 4720 31517 7b1d /bin/ls 26718 1168 4840 32726 7fd6 /bin/ls A little over a kilobyte. Peter even went to the trouble of keeping the size of the operator table entries the same. I think the additional size is justifiable. Greg -- Sent from my desktop computer. Finger grog@FreeBSD.org for PGP public key. See complete headers for address and phone numbers. This message is digitally signed. If your Microsoft MUA reports problems, please read http://tinyurl.com/broken-mua --RnlQjJ0d97Da+TV1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlEtTNQACgkQIubykFB6QiO7sQCfc/WV5Xbi4kxv+tn+1EMR6LCO DroAn3dbK/kQpgRG2xuJflfqmK389BN6 =NPID -----END PGP SIGNATURE----- --RnlQjJ0d97Da+TV1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130227000125.GA7223>