X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3E163846400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1609958521; bh=/NVR4vBerELmbUMj7Duu6EL43l2GM2IFtmIs0uJ/3cw=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=q9BeCkRlpgzTN+izPFw7BMn2uVYrSNam84dIWJVdbmBGo/tYp4aHAAGCLnNGEKTFx dmpwRvOFMzPxxog0PprsdIr8hzKgeNIpq9MOCOimR6aauKR/Sh8bUCMWGybG72Ccqh 63vAIpzRSS0F2zeVEabF5Nchs5OoOgx88Ru+5Jyo= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BD418384C00B X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Subject: Re: "ls" sorts wrongly if given large number of files To: cygwin AT cygwin DOT com References: Message-ID: Date: Wed, 6 Jan 2021 19:41:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Language: de-DE X-Provags-ID: V03:K1:7O7Q55FQY4DqV7AetDpeGkYVmUKsqSXrGZzam2TpluikuX8WFIf vjJqIJw/krMAV9izv201J1vrUVZqfQxZ/lrbrXB2ubw6tkhPUxir7msvrNMa7eqCX4x+APL ESvqvY82AHzi2VRNGLGBWacUW2cj45cK68+K+gvFlx6K2SaIu50whErJKZjxuWsZ5cFf20w +7XuCLnK7Q7EbF/9vqJwg== X-UI-Out-Filterresults: notjunk:1;V03:K0:4gTDtjAWUQM=:IdAFWk1pN2SY1XdxOzP03E bJp+SJPA6LjrJlt7+SDG2368lKf3WAWMsFSRmyOg7RYYDqT3T2KZSIwTL9oy+9NXPRrCs2/CE t6pmk/j1/W527+h5DUS2x2Qf8h8K6MakKnw47rX2ZwMuWCW7CyEfy/N5iVzXJdJ12vkEyI/on DXVg/lrbuelenc1eYk9BaMGH6x7fVI0HErDNoipy+xS1sSN50FH/ZrXrhKpd9HZlixp2j9UJu pG83lZHJZLP3w94PfHR9Z5O8N3ItmxKarj+G1rw3ZP15/BdefGEVH3r47YeMljF0YY3CfE/9q uzv1vtbxlXOd7UlCCYjFvP953GhzKnNYO6dnC/DHdqOVhNzBsK2YGLQNP9spZk7v3W7ODsM8D QmIn0w1VQHGUal/1yO9b+JOWMfQqw2f9psx7Fk20gTMUMJqVQhHi04U23fRqa571y2exXipEV jx6rT4YTh3eMg4lINPIl3XUPmyMjnTmCIeF5NAGKfXd0LQCXglIbCMa6ISJG8k881F0sfBswv 6ijTfNOByukktqOesXGRxbIRr5Tm7/CEVTlCKdDlHzqxgysfm8MViTQ9ravkiC7f03H9XKPp6 XE0Wmmr2uL0uSznLOZXC1io3qMeP4/bjmFufl/4XInrYZdRGiBa3P/f5uiKztF1HHmxc1FkyA Wz47EZpkJqdv0fMahcgVbZgxL8fcUl+wxnaG46L3uP8exANUei4/mg7qgme9IXwO25xMnuv9Z IS0i/70QkXXpGrTn0vx0pd1wYtjA5uXJkVzv1LftzYc5ULKfrrtVdjZC0GpEPOWdAy290kP8f Q+gbvn1pLQL7fVM+ltHBnnS5H5nrraPzQQeTQYNYYdh+bu1cQH7g3mAHwcawPH/Cvgf3QxV19 Q3NPRs1pD7BeDceYEZ8Q== X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GB_FREEMAIL_DISPTO, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Frank-Ulrich Sommer via Cygwin Reply-To: Frank-Ulrich Sommer Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 106IgS7W018179 Am 06.01.2021 um 19:17 schrieb Kamran via Cygwin: > Hi all > > "ls" (version 8.26) sorts wrongly if given large number of files via "find" or "xargs" > > For example: > > find -type f -exec ls -oS -h {} + > > OR > > find -type f -print0 | xargs -0r ls -oS -h > > Gives following data. Sorry for the long listing, and wrapped lines. But search for "setup.ini" which is about 17 MB, it is sorted AFTER very small files. > > In fact it seams that sorting is restarted from that file (subsequent files are again sorted). Note also that removing "-h" from "ls" command lines results in the same problem. > > (output is trimmed to remove unnecessary data, i.e. perms/user/date-time, but order is the same) > >  26M ./release/gcc/gcc-core/gcc-core-10.2.0-1.tar.xz >  24M ./release/binutils/binutils-2.34+1git.de9c1b7cfe-1.tar.xz > [...] > 108 ./release/python2/python/python-2.7.16-1.tar.xz >  108 ./release/python-gobject/python-gobject-2.28.7-1.tar.xz >   46 ./release/tcl-tk/tcltk/tcltk-20120206-1.tar.bz2 >   32 ./release/man-db/man/man-2.6.7-2.tar.xz >   32 ./release/popt/popt-1.16-2.tar.xz >   32 ./release/procps-ng/procps/procps-3.3.10-1.tar.xz >  17M ./setup.ini > 5.7M ./release/vim/vim-common/vim-common-8.2.0486-1.tar.xz > 4.6M ./release/w32api-headers/w32api-headers-8.0.0-1.tar.xz > 1.8M ./release/vim/vim-doc/vim-doc-8.2.0486-1.tar.xz > [...] > 16K ./release/xeyes/xeyes-1.1.2-1.tar.xz >  15K ./release/xf86-video-dummy/xf86-video-dummy-0.3.8-1.tar.xz >  12K ./release/util-linux/libuuid1/libuuid1-2.33.1-2.tar.xz > xargs uses multiple calls to ls and find calls ls once for each matching file so in the two mentioned cases ls will not get to see the full list and thus can't sort all the files. This is the expected bahviour and not special to cygwin. -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple