zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] size-sorting globs now work for giant files
@ 2012-06-17  1:14 Dima Kogan
  0 siblings, 0 replies; only message in thread
From: Dima Kogan @ 2012-06-17  1:14 UTC (permalink / raw)
  To: zsh-workers

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

There was a bug where globs like *(OL[1]) failed to return the largest
file if it was larger that 4GB in size. The bug was an improper int ->
long cast. Patch attached.

dima

[-- Attachment #2: 0001-zsh-glob-sorting-now-works-with-giant-files.patch --]
[-- Type: text/x-patch, Size: 737 bytes --]

>From e0e323f27b48180fe32680e2c6a17930c4e5a7ee Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@secretsauce.net>
Date: Sat, 16 Jun 2012 18:04:57 -0700
Subject: [PATCH] zsh glob sorting now works with giant files

globs like *(OL[1]) now correctly expand to the largest file even if its
size is larger that 4GB
---
 Src/glob.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Src/glob.c b/Src/glob.c
index d3ce733..ca2ffaf 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -997,7 +997,9 @@ gmatchcmp(Gmatch a, Gmatch b)
 	    break;
 	}
 	if (r)
-	    return (int) ((s->tp & GS_DESC) ? -r : r);
+	    return (s->tp & GS_DESC) ?
+	      (r < 0L ? 1 : -1) :
+	      (r > 0L ? 1 : -1);
     }
     return 0;
 }
-- 
1.7.10


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-06-17  1:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-17  1:14 [PATCH] size-sorting globs now work for giant files Dima Kogan

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