zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Rounding of glob qualifiers?
Date: Mon, 26 Jul 2010 10:13:53 +0100	[thread overview]
Message-ID: <20100726101353.7048f070@csr.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1007231555390.14779@hp.internal>

On Fri, 23 Jul 2010 16:09:33 -0400 (EDT)
"Benjamin R. Haskell" <zsh@benizi.com> wrote:
> The rounding seems a bit odd here:
> 
> ## some files less than, equal to, and greater than 1024 bytes
> $ ls -l {lt,eq,gt}-1k
> -rw------- 1 bhaskell users 1023 2010-07-23 16:08 lt-1k
> -rw------- 1 bhaskell users 1024 2010-07-23 16:08 eq-1k
> -rw------- 1 bhaskell users 1025 2010-07-23 16:08 gt-1k
> 
> ## why does lt-1k match here:
> $ print -l *-1k(L-1024)
> lt-1k
> 
> ## and here:
> $ print -l *-1k(Lk1)
> eq-1k
> lt-1k
> 
> ## but not here?
> $ print -l *-1k(Lk-1)
> zsh: no matches found: *-1k(Lk-1)
> 
> 
> Not claiming it's a 'bug', per se, but what's the rationale for
> rounding up?  Seems similar to the 'a' glob qualifier caveat with
> 'whole units', but I didn't see an explanation similar to
> fractional-part-is-discarded for 'L'.

Yes, it's the same point, because it's the same logic.  It should really be
described higher up.

I'm not sure it's ever actually useful to discard the fractional part when
comparing less than or greater than; equality is a bit different because
when you want a file a certain number of K it's unlikely you wan't it to be
exactly that size, just more than the next unit down and less than the next
unit up.  You get the behaviour for other comparisons out of consistency
with this.

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


      reply	other threads:[~2010-07-26  9:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 20:09 Benjamin R. Haskell
2010-07-26  9:13 ` Peter Stephenson [this message]

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=20100726101353.7048f070@csr.com \
    --to=peter.stephenson@csr.com \
    --cc=zsh-users@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).