DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5BMGrb6p1042878 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 5BMGrb6p1042878 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=riyPA2qA X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B23F4BA2E07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1766422416; bh=OlolVqoIG+jR/ZiR22vD2min+UQUcU5Uy2JQG8i2lYg=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=riyPA2qAssMJA2NKdoVZoXzu7EiDaERsmdIILodOMwW2ZqUIBNC0YwncKBHvTB73M v7/wC4bkiDIjjTNDDWJ2HogJpnnSCMENwaxk2gkq89TqPtPz6LATedRcPCOG5xKUyf oceB71hwxFXkZi+O5HpRWuM3ujFMFM+oCvD15qmg= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C74994BA2E05 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C74994BA2E05 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766422396; cv=none; b=LkpGMsSsIAjsDhA3NNYvIGtbcE4nlzR2MGv89HqEeUyKKRJf8/KHtJ+Fa51s9J+2BeoELO3In2ce+nSOwNKsMM0VUyRzCyitu+NXexJgRLILVuESVi9719Hfb6z/TZdvHTOQv9XkV5zeYj4m4E0+DyW4OMZdIbVBaCa55D+IUXU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766422396; c=relaxed/simple; bh=dVov3eTIjj8L2HbWF4fkTJSxJxWzSBXyn3VfBwO3rKw=; h=Message-ID:Date:MIME-Version:From:Subject:To:DKIM-Signature; b=tiP68f+8+bVozyqs2FaPWaF+29C8esMSPHlzqi87ioimPoWgxNwg4y+8jGWVYdmuRuRsVjrgbQQUl5EYIBoFblXXY8MGnJH7BFFYCLWXv5ZNIX4c56BDwW5bRC7niJan3ViTGYwdmmFMt943rGxv5qXfN62WB97viMS5cFWcI6o= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C74994BA2E05 Message-ID: <11c18c03-22da-47aa-b5ab-65700022c3d3@SystematicSW.ab.ca> Date: Mon, 22 Dec 2025 09:53:13 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Why is stat slow? Content-Language: en-CA To: cygwin AT cygwin DOT com References: <74bdc787-9099-8e29-492a-588546b6eedb AT cs DOT umass DOT edu> <510a193d-633c-ddf1-68a7-a61b9847cfa8 AT cs DOT umass DOT edu> <30e1a743-0e08-4f00-aafc-82fe7dd9078d AT SystematicSW DOT ab DOT ca> <276f0623-d08a-9048-cfe8-fb93a83394b3 AT cs DOT umass DOT edu> Organization: Systematic Software In-Reply-To: <276f0623-d08a-9048-cfe8-fb93a83394b3@cs.umass.edu> X-Rspamd-Server: rspamout07 X-Rspamd-Queue-Id: BE25234 X-Stat-Signature: ofy56rfucu83xaju17xzst185ib7mdro X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361 X-Session-ID: U2FsdGVkX18H4TQSqqNdr7hxb3zCXX5YiyDVTq1MBqs= X-HE-Tag: 1766422394-770696 X-HE-Meta: U2FsdGVkX180zAGf9sJIMF9Lm7MHlpQ2DKX+yQnjJLJ7y7rqj2OZ+ikpJNZtXJO6t3oZhYl++z+jRreGufqJLYI6lKPa7ESC1m+CsXNrHuEzTvaI6NpYLA2EPMLHkwdR0CHwfmO0SzET6dvVl6I8aY53L1jCK3Mch+OtUYIdg8RmzwimS560m5qZWrGtJllJqVxNUFW5LpcjwLbS7xZSnUCFTNczHOsQExkIWEqJctZ+TtUmwqkLsYF56JIS6jRFQGHxuKGuKkFOGy0ai6NgiWHQ2/Q49S6grM6wccLx04t8qWTafaJdt7o6LMWXUxBLmw0vJIG1slwCwbFRuz1b5oFBLSknm6KR X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Brian Inglis via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Brian DOT Inglis AT SystematicSW DOT ab DOT ca Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 5BMGrb6p1042878 On 2025-12-22 09:39, Eliot Moss wrote: > On 12/22/2025 11:28 AM, Brian Inglis via Cygwin wrote: >> On 2025-12-22 08:35, Eliot Moss via Cygwin wrote: >>> On 12/22/2025 10:07 AM, Christian Franke via Cygwin wrote: >>>> Eliot Moss via Cygwin wrote: >>>>> I'm sure this has been asked before, more than once, but I am again wondering >>>>> what, specifically, makes stat (the program, but presumably also the syscall) >>>>> substantially slower on Cygwin compared to stat on WSL2.  I am talking about >>>>> an external HDD (not solid state) on my D: drive.  It shows under WSL 2 as >>>>> /mnt/d like this (output of mount): >>>>> >>>>> D:\ on /mnt/d type 9p (rw,noatime,aname=drvfs;path=D: >>>>> \;uid=0;gid=0;symlinkroot=/ >>>>> mnt/,cache=5,access=client,msize=65536,trans=fd,rfd=5,wfd=5) >>>>> >>>>> On Cygwin it shows up like this (yes, mount shows two lines): >>>>> >>>>> D: on /cygdrive/d type ntfs (binary,notexec,posix=0,user) >>>>> D: on /cygdrive/d type ntfs (binary,noacl,posix=0,user,noumount,auto) >>>>> >>>>> My /etc/fstab lines are: >>>>> >>>>> none /cygdrive cygdrive binary,noacl,posix=0,user 0 0 >>>>> d: /cygdrive/d ntfs binary,posix=0,user,auto,notexec 0 0 >>>> >>>> In the past, Cygwin did not support individual options for some /cygdrive/X. >>>> If this is still the case, "noacl" without "notexec" is effective for / >>>> cygdrive/d. Then Cygwin reads the header of each file to check for a >>>> possible "x" permission. >> >>>>> (Presumably this has something to do with two mounts showing ...) >>>>> >>>>> On D; I have a folder with hundreds of 2Gb files (they are backups, split into >>>>> 2Gb portions).  On Cygwin >>>>> >>>>> time stat gives >>>>> >>>>> real    2m12.425s >>>>> user    0m0.249s >>>>> sys     0m1.312s >> >>>> This would explain this long duration. >>>> >>>> Quick test: >>>> >>>> $ echo '#!/bin/sh' > /cygdrive/d/script.tmp >>>> $ ls -l /cygdrive/d/script.tmp >>>> -rwxr-xr-x .... <== notexec unset >>>> -rw-r--r-- .... <== notexec set >> >>> Aha!  I changed my /etc/fstab to be like this: >>> >>> none /cygdrive cygdrive binary,noacl,posix=0,user 0 0 >>> d: /d ntfs binary,posix=0,user 0 0 >>> >>> D: is still available via explicit /cygdrive/d, but that would be without the >>> noacl option.  Using /d now the previously slow stat completes in a few >>> seconds, reasonable for going over what is now 2000 files.  My memory of >>> exactly why is dim, but the noacl seems important for my C: drive.  Using the >>> ACLs on D: to determine executability seems good. >> >> Mapping drives to /? causes an issue if you ever want to get help from any >> non-Cygwin Windows console program that uses Windows help conventions /? -> / >> d: I believe using /\? avoids that. > > Interesting; so the suggested /etc/fstab line would be this? > > d: /\d ntfs binary,posix=0,user 0 0 > > How do I type a path, then, e.g., now I might have /d/foo ... ? > Would I have to type /\d/foo ? No change to fstab - just be wary of typing /? in a Cygwin shell command line. I once tried mapping my cygdrives under root / so every cmd help /? expanded to /c /d /f /g and I used it and forgot often enough to be annoying so reverted to /mnt. -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut -- Antoine de Saint-Exupéry -- 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