delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/12/17/00:45:47

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:date:message-id:references
:mime-version:content-type:content-transfer-encoding; q=dns; s=
default; b=YapM3Fh4Ie3R4Eq3WhbxnkzBz2ypJXI2sJGy4U/rGi8BzMi1/usLl
wlc8CEHetdpVQhYKv89UFiPgAvJbQ6bplu05HDb3qOZ6wABlQok840xNGe1APGC9
KMwrCJ2TgDdgOKpeEQDTEdxQ46kKchzOI/hl3+nUVh8DjUj2TnB+vE=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:date:message-id:references
:mime-version:content-type:content-transfer-encoding; s=default;
bh=TO/M3BqXY64KoiqJFQQAJ8FHxv8=; b=j1w5gjaw3xwO1XZsVicLfY8uxP2o
nEaoifJQVKBPYwJYEnX8/G1kHbL0wCyOKRw/GWGny9EpN5IsRWiKpA3wd0KRGhMC
Qv2zOIZf8FoTsDcl5GS03QIqsXABEsOS/jPhv6QuGcB5DwkCRna/MGi3GDOyHagW
BVQETRB3hxemnlI=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: plane.gmane.org
To: cygwin AT cygwin DOT com
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Subject: Re: fdisk -l is mute
Date: Wed, 17 Dec 2014 05:45:05 +0000 (UTC)
Lines: 74
Message-ID: <loom.20141217T052000-586@post.gmane.org>
References: <9D9AC45310887B40A7245734E850FBE11192AEE0 AT FS-MX02 DOT frontier DOT local> <5488BD32 DOT 9090502 AT t-online DOT de> <20141211102335 DOT GC3810 AT calimero DOT vinschen DOT de> <5489D67D DOT 4060104 AT t-online DOT de> <20141211174551 DOT GJ3810 AT calimero DOT vinschen DOT de>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes

Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:

> 
> On Dec 11 18:38, Christian Franke wrote:
> > Corinna Vinschen wrote:
> > >On Dec 10 22:37, Christian Franke wrote:
> > >>Fergus Daly wrote:
> > >>>If util-linux is installed then
> > >>>$ /usr/sbin/fdisk
> > >>>returns a list of options as expected; but choosing one of them
> > >>>$ /usr/sbin/fdisk -l
> > >>>is mute.
> > >>>In the past this has returned filesystem summaries as expected.
> > >>>Windows 7, all up to date.
> > >>>Anybody else?
> > >>Could reproduce this.
> > >>
> > >>The option -l still works if a device is specified:
> > >>
> > >># fdisk -l /dev/sdX
> > >>...
> > >>Disk /dev/sda: 1.8 TiB, ...
> > >>
> > >>Is this probably because the format of /proc/partitions has changed due to
> > >>the new (& useful!) win-mounts column?
> > >The win-mount column is empty for disk entries, only filled for
> > >partitions.  In theory that shouldn't bother fdisk which only looks
> > >for disk entries.  Or, does it?
> > >
> > >
> > 
> > It doesn't.
> > 
> > A quick look in the source shows that the function sysfs_devname_to_devno()
> > now only checks the path /sys/block/sdX/dev if the device name does not
> > start with /dev/. I presume upstream has removed a fallback to /dev/sdX
> > because this is no longer required on Linux.
> 
> Hey, I'm off the hook on that one, cool! :)

As Cygwin does not provide /sys/block/sdX/dev, should fdisk be patched for
Cygwin to enumerate and prefix the device names from /proc/partitions with
/dev/ so that --list without arguments works as expected? 

If I could configure the ! package, I could test if a patch like the
following would work: 

--- origsrc/util-linux-2.25.2/lib/sysfs.c	2014-10-24 03:21:20.311387900 -0600
+++ src/util-linux-2.25.2/lib/sysfs.c	2014-12-16 22:16:58.076483200 -0700
@@ -60,6 +60,22 @@ dev_t sysfs_devname_to_devno(const char
 		else
 			name += 5;	/* unaccesible, or not node in /dev */
 	}
+#ifdef __CYGWIN__
+	else {
+		/*
+		 * Create path to /dev/<name>
+		 */
+		int len = snprintf(buf, sizeof(buf),
+				 "/dev/%s", name);
+		struct stat st;
+
+		if (len < 0 || (size_t) len + 1 > sizeof(buf))
+			return 0;
+
+		if (stat(buf, &st) == 0)
+			dev = st.st_rdev;
+	}
+#endif
 
 	if (!dev && parent && strncmp("dm-", name, 3)) {
 		/*




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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