zsh-workers
 help / color / mirror / code / Atom feed
From: Dima Kogan <dima@secretsauce.net>
To: zsh-workers@zsh.org
Subject: [PATCH] size-sorting globs now work for giant files
Date: Sat, 16 Jun 2012 18:14:40 -0700	[thread overview]
Message-ID: <20120616181440.54ae2392@shorty.local> (raw)

[-- 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


                 reply	other threads:[~2012-06-17  1:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20120616181440.54ae2392@shorty.local \
    --to=dima@secretsauce.net \
    --cc=zsh-workers@zsh.org \
    /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).