From: Greg Klanderman <gak@klanderman.net>
To: Zsh list <zsh-workers@sunsite.dk>
Subject: bug in ztrftime(): '%e' and '%f' specifiers swapped
Date: Fri, 26 Jun 2009 16:40:25 -0400 [thread overview]
Message-ID: <19013.12857.274684.466725@gargle.gargle.HOWL> (raw)
Hi Peter,
I just tracked down a bug in 'cvs' completion, in particular the logic
in _cvs_modified_entries, and found the problem is due to your changes
in Src/utils.c, revision 1.210:
| revision 1.210
| date: 2009/03/02 10:12:17; author: pws; state: Exp; lines: +56 -15
| 26614 + 26615: history -t <fmt> plus ztrftime "-" format modifier
You have inadvertently swapped the meanings of the '%e' and '%f' format
specifiers. This patch should do the trick:
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.225
diff -u -r1.225 utils.c
--- Src/utils.c 5 Jun 2009 11:15:53 -0000 1.225
+++ Src/utils.c 26 Jun 2009 20:18:41 -0000
@@ -2489,10 +2489,10 @@
*buf++ = '0' + tm->tm_mday / 10;
*buf++ = '0' + tm->tm_mday % 10;
break;
- case 'e':
+ case 'f':
strip = 1;
/* FALLTHROUGH */
- case 'f':
+ case 'e':
if (tm->tm_mday > 9)
*buf++ = '0' + tm->tm_mday / 10;
else if (!strip)
However, I find this equivalent patch to be more readable:
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.225
diff -u -r1.225 utils.c
--- Src/utils.c 5 Jun 2009 11:15:53 -0000 1.225
+++ Src/utils.c 26 Jun 2009 20:32:52 -0000
@@ -2490,9 +2490,8 @@
*buf++ = '0' + tm->tm_mday % 10;
break;
case 'e':
- strip = 1;
- /* FALLTHROUGH */
case 'f':
+ strip = strip || (fmt[-1] == 'f');
if (tm->tm_mday > 9)
*buf++ = '0' + tm->tm_mday / 10;
else if (!strip)
@@ -2500,10 +2499,9 @@
*buf++ = '0' + tm->tm_mday % 10;
break;
case 'K':
- strip = 1;
- /* FALLTHROUGH */
case 'H':
case 'k':
+ strip = strip || (fmt[-1] == 'K');
if (tm->tm_hour > 9)
*buf++ = '0' + tm->tm_hour / 10;
else if (!strip) {
@@ -2515,9 +2513,8 @@
*buf++ = '0' + tm->tm_hour % 10;
break;
case 'L':
- strip = 1;
- /* FALLTHROUGH */
case 'l':
+ strip = strip || (fmt[-1] == 'L');
hr12 = tm->tm_hour % 12;
if (hr12 == 0)
hr12 = 12;
Note: I didn't test either of those as I will not be able to build
until I update my autoconf.
Btw, are the zsh extension format specifiers documented?
thanks,
greg
next reply other threads:[~2009-06-26 20:40 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <gak@klanderman.net>
2009-06-26 20:40 ` Greg Klanderman [this message]
2009-06-26 21:23 ` Peter Stephenson
2009-06-26 21:57 ` Greg Klanderman
2010-02-05 17:01 have '&' automatically disown? Greg Klanderman
2010-02-05 17:33 ` Peter Stephenson
2010-02-05 17:36 ` Peter Stephenson
2010-02-06 3:26 ` Greg Klanderman
2010-02-07 18:20 ` Peter Stephenson
2010-02-07 21:06 ` Greg Klanderman
2010-02-07 21:34 ` Peter Stephenson
2010-02-07 22:36 ` Bart Schaefer
2010-09-02 14:57 ` Greg Klanderman
2010-09-05 19:11 ` Bart Schaefer
2010-09-06 1:50 ` Greg Klanderman
2010-02-07 21:59 ` Mikael Magnusson
-- strict thread matches above, loose matches on Subject: below --
2009-05-17 4:55 PATCH: make PROMPT_SP end-of-line marker configurable Greg Klanderman
2009-05-17 17:27 ` Peter Stephenson
2009-05-17 18:04 ` Greg Klanderman
2009-05-17 19:23 ` Peter Stephenson
2009-05-18 1:00 ` Greg Klanderman
2009-05-18 18:27 ` Greg Klanderman
2009-01-13 7:32 treatment of empty strings - why is this not a bug? Greg Klanderman
2009-01-13 19:24 ` Peter Stephenson
2009-01-13 22:08 ` Peter Stephenson
2009-01-15 20:11 ` Greg Klanderman
2009-01-15 20:29 ` Peter Stephenson
2009-01-16 10:02 ` Peter Stephenson
2009-01-15 20:28 ` Greg Klanderman
2009-01-15 20:34 ` Peter Stephenson
2009-01-16 4:19 ` Bart Schaefer
2009-01-16 17:35 ` Greg Klanderman
2009-01-16 17:55 ` Peter Stephenson
2009-01-16 19:40 ` Greg Klanderman
2009-01-16 23:26 ` Richard Hartmann
2009-01-17 3:45 ` Bart Schaefer
2009-01-17 3:35 ` Bart Schaefer
2009-01-17 5:31 ` Greg Klanderman
2009-01-17 17:53 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19013.12857.274684.466725@gargle.gargle.HOWL \
--to=gak@klanderman.net \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).