delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/08/19/06:04:28

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34A5239AF4E4
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1629367467;
bh=9GJE81s4He9Jpgb09DkIhdiEq9lsvdbRzoqXge2ElQc=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=Qkhirbq0Id0dbzvjs3H4nWvx3i/pGX4LWoTtUvKp4etvqDtlmLex3NYQKO5uiVfmg
/hab7VgX8R8DR38IxALQRCL27qWJj3BmdQRURoOp31hx//lyrcZxNPASn8ZUNyvdf7
wUKrQgZWSm+jj4Vonkh94/l569fPz35ZCJhdb5TQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FE51385841F
Date: Thu, 19 Aug 2021 12:03:12 +0200
To: cygwin AT cygwin DOT com
Subject: Re: Duplicates in /proc/partitions
Message-ID: <YR4sYNqO+bVYuCHd@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <YRp7abUpIAqLCod3 AT calimero DOT vinschen DOT de>
<9a770c83-62ef-6849-16e7-e6956f4d2fab AT SystematicSw DOT ab DOT ca>
<YRqzOZAiDEfkHBM+@calimero.vinschen.de>
<DM8PR09MB70958FD69B70B19E187BD682A5FE9 AT DM8PR09MB7095 DOT namprd09 DOT prod DOT outlook DOT com>
<YRu++uklGOPynvdf AT calimero DOT vinschen DOT de>
<DM8PR09MB709560E2652D35DBE54217C9A5FF9 AT DM8PR09MB7095 DOT namprd09 DOT prod DOT outlook DOT com>
<YR0g29R5sQpEio9A AT calimero DOT vinschen DOT de>
<DM8PR09MB7095852064F71BCCBBFB998AA5FF9 AT DM8PR09MB7095 DOT namprd09 DOT prod DOT outlook DOT com>
<DM8PR09MB7095EE5F6B0192EC6F42823BA5FF9 AT DM8PR09MB7095 DOT namprd09 DOT prod DOT outlook DOT com>
<DM8PR09MB7095D416926BFC028E6BBC21A5FF9 AT DM8PR09MB7095 DOT namprd09 DOT prod DOT outlook DOT com>
MIME-Version: 1.0
In-Reply-To: <DM8PR09MB7095D416926BFC028E6BBC21A5FF9@DM8PR09MB7095.namprd09.prod.outlook.com>
X-Provags-ID: V03:K1:8831H+MRtLHpmwTe5MK9gnzbJDdveWJv9AaF5EYpTco1ibOgTmg
JcvvuXJ0/taJDjiyhA2sVv5UlXJnIKnnbYaJe9M5lrzYLqABlTaU48V5hVgGq0BHNw2iL2/
vqlXizrzRMoiKBqOkIZn39GERyF90HOXmDtIzKXzo+yR4WzOvyylzBCi1s34mxsy6Qo2qFj
Bbdj5oigi2jLJS4EbovJg==
X-UI-Out-Filterresults: notjunk:1;V03:K0:/1sLAuN+Q6c=:cAxDN3798d8zGq6q36p1j0
MLtquJOvomftrv3HhyYjBmDFdo6Wps/grdSUE3tVAtJ6sIkgb2R1su//q1A3KQJEiPaSPrNsZ
Kvxn4fh1VqxGQFvkv2mSmUQy88Pqrc3DLe7Zww9j+AVyNWsidO6o0EiKrlcN8sDDXwxIh9gKN
c5yH+Zy6Eaeb1qtHiv92QRTCeicsj83t93W6xNAz71nUNV9uN4ozP7OT3dDhZd3nC+2yTDriS
s1Mm2qxzMPMQ7yn5sM2dd4bkw+a7om9XsD8xME1ZV86PUkGnmJM4KpoaCV4Bj5D/CVUFdkUqR
HA8Maf/9odbSo/SVa9+L+Ib3gRTMNF3RDs4O4lOQdwsUWs9ZgEB+/yt9flqhOaUK3XX8yiv/J
wKpSKMBldslKVmVVQfGhaZS8tY/3YGpeDqEq4w7U6DkGKjAqZCXtFJ9Od865TtfjiGH07r6I2
VB8SGZKoNlCDDIief+ImiZA32lh+zNLkBFSsKKAjSKhE6lxRqShRfH4LTr9LnJKvolTHOvMt9
m6wFtmY8PEgCoWJWACwRYoAO99h4pph/+IJ620VE46zA+555MFjeDulByXi7DYkwwRUs6iCgE
ozYLC00fA6ZdazXLtcIu2PpWyqBnPNZzjbFmgCABBHTJkWbhyMt1RBg7qbjpQrithSDiikk/T
kIgEgB2rWe5z/woozMMDkc2RO1qO0hc28AKa8QOm5MY0AhYB2jqax9hchR/dXs0jJ7t2LKZoK
+CItpxdRvWufQFFyaYQ5CobDvV8YHYmW9an9dSlIVXWj2Fv1/aC7StzkzRXYPW/22yXGe5nPf
XLE9XgQtlexebhG4gRGEctvSmN0WP4/eT4kaMsOozwh0Hfk9OSbzbjmpts6UPySwNGT5ZgSqC
AYAqr8m7sGE8j4TPqaEA==
X-Spam-Status: No, score=-99.9 required=5.0 tests=BAYES_00,
GOOD_FROM_CORINNA_CYGWIN, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS,
RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,
SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Aug 18 18:36, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote:
> > And I just confirmed that if I print the context right before NtOpenFile(), and just do
> > the "continue",
> 
> But then I also tried this:  I removed the "continue" before "NtOpenFile()" and allowed it to proceed,
> but I moved NtClose(devhdl) right after the "printf" statement (that we were tweaking), and
> inserted the "continue" there, so it does not proceed with enumerating of the partitions.
> And so again, I got the output that matches my disks without the duplication.  So this actually
> exonerates NtOpenFile() :-)
> 
> $ ./proc_partition
> context = 282
> major minor  #blocks  name   win-mounts
> 
>     8     0 500107608 sda (282, Harddisk0, 144)
> context = 299
>     8    16 1000204632 sdb (299, Harddisk1, 144)
> context = 314
>     8    32 1000204632 sdc (314, Harddisk2, 144)
> context = 329
>     8    48 1000204632 sdd (329, Harddisk3, 144)
> context = 339
>     8    64 234431064 sde (339, Harddisk4, 144)
> context = 352
> DeviceIoControl (Harddisk5\Partition0, IOCTL_DISK_GET_PARTITION_INFO{_EX}) 5    8    80         0 sdf (352, Harddisk5, 144)

Unfortunately I can't reproduce the issue.  I created a couple of
virtual drives and added them to my W10 and my W7 VM, but to no avail.
The output always makes sense, e. g.,

$ ./proc_partition.exe
major minor  #blocks  name   win-mounts

    8     0  54525952 sda (169, Harddisk0)
    8     1    102400 sda1
    8     2  54420480 sda2    C:\
    8    16   1048576 sdb (181, Harddisk1)
    8    17   1045504 sdb1    E:\
    8    32   1048576 sdc (189, Harddisk2)
    8    33     32768 sdc1
    8    34   1013760 sdc2    H:\
    8    48   1048576 sdd (199, Harddisk3)
    8    49   1045504 sdd1    F:\
    8    64   1048576 sde (207, Harddisk4)
    8    65     32768 sde1
    8    66   1013760 sde2    G:\

The only interesting difference I can observe on Windows 7 is
that the offset changes quite often, compared to Windows 10.

I wonder if the Win32 API functions GetVolumeNameForVolumeMountPointW
or GetVolumePathNamesForVolumeNameW are the potiential culprit.

Can you apply the following patch, which disables the "win-mounts" output
and try again?

--- proc_partition.c.orig	2021-08-19 12:01:25.480105116 +0200
+++ proc_partition.c	2021-08-19 12:01:47.134099288 +0200
@@ -178,7 +178,7 @@ main ()
 	    swprintf (fpath, sizeof fpath,
 		      L"\\\\?\\GLOBALROOT\\Device\\%ls\\Partition%u\\",
 		      dbi->ObjectName.Buffer, part_num);
-	    if (GetVolumeNameForVolumeMountPointW (fpath, gpath, MAX_PATH)
+	    if (0 && GetVolumeNameForVolumeMountPointW (fpath, gpath, MAX_PATH)
 		&& GetVolumePathNamesForVolumeNameW (gpath, mp_buf,
 						     NT_MAX_PATH, &len))
 	      {


Thanks,
Corinna

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019