URL: <https://savannah.gnu.org/bugs/?62089>
Summary: find -size -1024k different from -size -1M Project: findutils Submitted by: None Submitted on: Mon 21 Feb 2022 02:12:06 AM UTC Category: find Severity: 3 - Normal Item Group: Wrong result Status: None Privacy: Public Assigned to: None Originator Name: Originator Email: Open/Closed: Open Release: 4.7.0 Discussion Lock: Any Fixed Release: None _______________________________________________________ Details: I'm trying to count the image files by size, here is what I got: find -size -1024k different from -size -1M ``` $ find data/images/ -type f -name '*.jpg' | wc 878161 878161 27220516 # total number of jpg files $ find data/images/ -type f -name '*.jpg' -size -500k | wc 878065 878065 27217540 # number of files whose size < 500k $ find data/images/ -type f -name '*.jpg' -size -1M | wc 356 356 11036 # number of files whose size < 1M ``` So how come it's only 356 (much less than 878065)? Anyone can explain? or tell me what's going wrong? Then I tried `-1024k`, instead of `-1M`, which returns reasonable number: ``` $ find data/images/ -type f -name '*.jpg' -size -1024k | wc 878119 878119 27219214 ``` So, why `-1M` behaved so wrong? Below is my machine's system info: ``` $ which find /usr/bin/find $ dpkg -S /usr/bin/find findutils: /usr/bin/find $ dpkg -l findutils Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-=======================================-========================-========================-==================================================================================== ii findutils 4.6.0+git+20170828-2 amd64 utilities for finding files--find, xargs $ find --version find (GNU findutils) 4.7.0-git Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Eric B. Decker, James Youngman, and Kevin Dalley. Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2) $ cat /etc/issue.net Ubuntu 18.04.2 LTS $ uname -a Linux 4.15.0-55-generic #60-Ubuntu SMP Tue Jul 2 18:22:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux ``` _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?62089> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/