delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/08/16/17:54:35

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BBAE63854803
Authentication-Results: sourceware.org; dmarc=none (p=none dis=none)
header.from=SystematicSw.ab.ca
Authentication-Results: sourceware.org;
spf=none smtp.mailfrom=systematicsw.ab.ca
X-Authority-Analysis: v=2.4 cv=Ac10o1bG c=1 sm=1 tr=0 ts=611ade7f
a=T+ovY1NZ+FAi/xYICV7Bgg==:117 a=T+ovY1NZ+FAi/xYICV7Bgg==:17
a=IkcTkHD0fZMA:10 a=w_pzkKWiAAAA:8 a=CCpqsmhAAAAA:8 a=ejknC5xS72zp2OFXFO8A:9
a=QEXdDO2ut3YA:10 a=DF2yQvBCbgwA:10 a=sRI3_1zDfAgwuvI8zelB:22
a=ul9cdbp4aOFLsgKbc677:22
To: cygwin AT cygwin DOT com
References: <CAPJ9Yc8KMkmkCsZH7HwzHD59ju41L0svOcCskd3e0OG4qJ8Gxw AT mail DOT gmail DOT com>
<YRp7abUpIAqLCod3 AT calimero DOT vinschen DOT de>
<9a770c83-62ef-6849-16e7-e6956f4d2fab AT SystematicSw DOT ab DOT ca>
<YRqzOZAiDEfkHBM+@calimero.vinschen.de>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Organization: Systematic Software
Subject: Re: Duplicates in /proc/partitions
Message-ID: <e2dffabb-149b-b332-036e-821632796238@SystematicSw.ab.ca>
Date: Mon, 16 Aug 2021 15:54:06 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <YRqzOZAiDEfkHBM+@calimero.vinschen.de>
X-CMAE-Envelope: MS4xfJxbxQTqgLeVqU1XKxwZtJtY3nDB/U1FFEGbVCd+0V1Dr69NVG1IcNWRxuf3I4eLyoSwD+KZSBLHUElrJuNuSsTBtNzseDf+jlx/f66gU+GwXvnueG09
5CvabmL8LviMSi/6YlAe0p0nQUj9wLnI87WZa2/J5RMU7IXhNkagrpkiAFAsjmBQOffiWJ+r8JVQPb+yDU3CzOKW5xRZ1db3d8w=
X-Spam-Status: No, score=-1169.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL,
RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE,
TXREP autolearn=no 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>
Reply-To: 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>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 17GLsZNO020357

On 2021-08-16 12:49, Corinna Vinschen via Cygwin wrote:
> On Aug 16 10:56, Brian Inglis wrote:
>> On 2021-08-16 08:51, Corinna Vinschen via Cygwin wrote:
>>> On Aug 13 12:56, David Balažic via Cygwin wrote:
>>>> [...]
>>>> $ cat /proc/partitions
>>>> major minor  #blocks  name   win-mounts
>>>>
>>>>       8     0 1000204632 sda
>>>>       8     1    102400 sda1
>>>>       8     2     16384 sda2
>>>>       8     3 999571820 sda3   C:\
>>>>       8     4    510976 sda4
>>>>       8    16  62522712 sdb
>>>>       8    17   4096000 sdb1   D:\
>>>>       8    18  58424664 sdb2
>>>>       8    16  62522712 sdb
>>>>       8    17   4096000 sdb1   D:\
>>>>       8    18  58424664 sdb2   E:\
>>>> [...]
>>>> So the second listing shows sdb twice. Also E: does not seem to exist
>>>> (see below).
>>>
>>> So, second report.  Which OS is that on?  I don't have any physical
>>> Windows machine anymore, so I have a bit of a problem to reproduce this.
>>>
>>> As I wrote in https://cygwin.com/pipermail/cygwin/2021-August/249012.html,
>>> I don't see how Cygwin would be able to duplicate entries, unless the OS
>>> itself duplicates entries.
>>>
>>> Somebody who can duplicate this issue would have to single step through
>>> function format_proc_partitions, see
>>>
>>> https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/fhandler_proc.cc;h=66d19ab82f;hb=HEAD#l1686
>>>
>>> and check what actually happens in the above cases.
>>
>> Could those with the symptoms not provide useful information using a script
>> run in an elevated admin shell listing the relevant contents of Windows
>> objects accessed by format_proc_partitions from /proc/sys/ similar to the
>> attached script and log from my system, where the correspondence is obvious?
> 
> Not sure if that helps, but it's worth a try.
> 
> Other than that, I created a standalone application, shamelessly copying
> the code from Cygwin's function format_proc_partitions() and tweaked it
> to drop Cygwin internals.
> 
> The core of the function doesn't actually need Cygwin internals. It's
> basically a double loop calling Windows functions and just using Cygwin
> internals to print out major and minor numbers and the device name.  The
> standalone application simply fakes those.
> 
> This allows any person who *can* reproduce the problem to run the code
> under a debugger like GDB and debug what's going wrong.
> 
> I attached the code to this mail.  Store it under the name "proc_partition.c".  Compile it in two different ways, first with optimization:
> 
> $ gcc -g -O2 -o proc_partition_O2 proc_partition.c -lntdll
> 
> Run it:
> 
> $ ./proc_partition_O2
> 
> If the output contains duplicates, take a note, but otherwise
> ignore it for now.
> 
> Next, build it without optimization for easier debugging:
> 
> $ gcc -g -o proc_partition proc_partition.c -lntdll
> 
> Run it:
> 
> $ ./proc_partition
> 
> If the output contains duplicates, great!  Now you can run it under
> GDB and step through and see where it goes awry.  If it doesn't, you'll
> have to debug the optimized version, which is sometimes a bit weird.
> I'd be really glad if this allows us to reproduce the issue.
> 
> If none of them reproduces the issue... uhm... anyway, let's try first.

Might be easier for users if they could just run a verbose diagnostic, 
that checks everything and dumps everything, maybe under strace, rather 
than navigate gcc and/or gdb.

Provide it like snapshots with sha512sum and sig?

[Even sysadmins would rather not deal with development tools if 
possible, and in many orgs, for audit, internal, and security controls, 
are prohibited from doing so, and that extends to many application 
support and usage roles, due to anti-fraud, audit, and security 
controls, originally directed towards org financial reporting, under 
regulations like US SOX, "EuroSOX" audit directives like 8th Company Law 
Directive on Statutory Audit (Directive 2006/43/EC), and national 
regulatory equivalents.]

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

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