Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug Report: glob qualifier Lm-1 does not work



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.



Messages sorted by: Reverse Date, Date, Thread, Author