zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Bug Report: glob qualifier Lm-1 does not work
Date: Wed, 01 Sep 2010 09:36:36 -0700	[thread overview]
Message-ID: <100901093637.ZM9957@torch.brasslantern.com> (raw)
In-Reply-To: <20100901155416.GA8509@Lancelot>

On Sep 1, 11:54pm, Roy Zuo wrote:
}
} Some one just tells me that glob qualifier Lm-1 in zsh does not work, and I
} can confirm it is true. Whenever you do 
} 
}     ls *(Lm-1)
} 
} it complains "no matches found". Lm+1, Lk-1024, Lk-1, Lm-2 all work well. The
} only thing that does not work is Lm-1.

I think something related to this was discussed quite recently ... it's
a question of (a) rounding error and (b) using absolute less/greater
comparisons rather than <= or >=.  The comparison is made by scaling
the size of the file (read from the filesystem) *down* rather than by
multiplying the target units *up*, so any non-zero-sized file is always
treated as at having size at least one, no matter what the scale.  And
L-1 only matches files having size smaller than 1, which means that it
is semantically the same as L0, even with k or m inserted.

The same effect should occur for every other scaling factor, but the
smaller the scaling factor the fewer files are likely to be affected,
so probably you just don't notice.

That comparison has been that way ever since zsh existed; I don't know
why it was decided to do division on the file size rather than to do
multiplication on the units, other than perhaps to avoid integer
overflow when searching for very big files.


  parent reply	other threads:[~2010-09-01 16:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-01 15:54 Roy Zuo
2010-09-01 16:16 ` Jérémie Roquet
2010-09-01 16:38   ` Roy Zuo
2010-09-01 16:36 ` Bart Schaefer [this message]
2010-09-01 17:01 ` Peter Stephenson
2010-09-05 18:38   ` Bart Schaefer

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=100901093637.ZM9957@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).