zsh-workers
 help / color / mirror / code / Atom feed
* zsh bug report -
@ 2015-04-02 12:59 pdysonuk
  2015-04-02 16:36 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: pdysonuk @ 2015-04-02 12:59 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1777 bytes --]

Hi

I think I may have found a bug. I posted <http://stackoverflow.com/questions/29073706/zsh-tail-function-not-displaying-correct-file> the problem on stack overflow as I thought it was my lack of understanding. Here is a copy of my post:

If I list the directory contents in most recent modified order and get the most recent file with: 
print dir/*(om[1])
I get the most recently modified file. However, if I just want the file name by using the :t modifier like: 
print dir/*(om[1]:t)
it returns the oldest modified file's file name. My understanding was that the modifier :t is the last action on the returned results and, therefore, it should return the file name of the most recently modified file. Does anyone know why I am getting this unexpected result and how to fix it?

Many Thanks

Paul

zsh <http://stackoverflow.com/questions/tagged/zsh>This behavior seems to be the case with all modifiers (a, e, l, etc.) not just t. The ordering seems to be consistent between different modifiers, but differs when there is a path component in the pattern: print *(om) produces a list ordered by date as expected as does print ./*(om). print *(om:t)*seems to be arbitrarily ordered, print ./*(om:t) seems to alphabetical. most curiously, with print */*(om:t) the returned list is ordered first by the modification date of the first matched glob and but then arbitrarily by the second glob. I suspect that this may be a bug in zsh. –  Adaephon <http://stackoverflow.com/users/2992551/adaephon> Mar 17 at 6:52 <http://stackoverflow.com/questions/29073706/zsh-tail-function-not-displaying-correct-file#comment46417465_29073706>


Please could you let me know if this is actually a bug or is it my lack of understanding in using zsh?

Many Thanks

Paul


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: zsh bug report -
  2015-04-02 12:59 zsh bug report - pdysonuk
@ 2015-04-02 16:36 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2015-04-02 16:36 UTC (permalink / raw)
  To: pdysonuk, zsh-workers

On Apr 2,  1:59pm, pdysonuk@gmail.com wrote:
}
} Please could you let me know if this is actually a bug or is it my
} lack of understanding in using zsh?

It's actually a bug, and a fairly silly one at that.

diff --git a/Src/glob.c b/Src/glob.c
index 33facde..ad29223 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -386,8 +386,8 @@ insert(char *s, int checked)
     while (!inserts || (news = dupstring(*inserts++))) {
 	if (colonmod) {
 	    /* Handle the remainder of the qualifier:  e.g. (:r:s/foo/bar/). */
-	    s = colonmod;
-	    modify(&news, &s);
+	    char *mod = colonmod;
+	    modify(&news, &mod);
 	}
 	if (!statted && (gf_sorts & GS_NORMAL)) {
 	    statfullpath(s, &buf, 1);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-02 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-02 12:59 zsh bug report - pdysonuk
2015-04-02 16:36 ` Bart Schaefer

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).