This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: fdisk -l is mute
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Wed, 17 Dec 2014 05:45:05 +0000 (UTC)
- Subject: Re: fdisk -l is mute
- Authentication-results: sourceware.org; auth=none
- 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>
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