[PATCH] Cygwin: Add /dev/disk/by-label and /dev/disk/by-uuid symlinks

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Nov 17 19:40:09 GMT 2023


On Nov 17 18:53, Christian Franke wrote:
> Corinna Vinschen wrote:
> > On Nov 17 17:45, Christian Franke wrote:
> > > Corinna Vinschen wrote:
> > > > On Nov 17 15:39, Christian Franke wrote:
> > > > > The last two /dev/disk subdirectories :-)
> > > > > 
> > > > > Note a minor difference: On Linux, empty /dev/disk subdirectories apparently
> > > > > never appear. A subdirectory is not listed in /dev/disk if it would be
> > > > > empty. Not worth the effort to emulate.
> > > > Agreed.  This is really great.  I just pushed your patch.
> > > > 
> > > > However, there's something strange in terms of by-label:
> > > > 
> > > > I have two partitions with labels:
> > > > 
> > > >     $ ls -l /dev/disk/by-label
> > > >     total 0
> > > >     lrwxrwxrwx 1 corinna vinschen 0 Nov 17 17:18 blub -> ../../sda3
> > > >     lrwxrwxrwx 1 corinna vinschen 0 Nov 17 17:18 blub2 -> ../../sdb2
> > > >     $
> > > > 
> > > > Now I change the label of sdb2 to the same "blub" string as on sda3:
> > > > 
> > > >     $ ls -l /dev/disk/by-label
> > > >     total 0
> > > >     $
> > > > 
> > > > I'd expected to see only one, due to the name collision, but en empty
> > > > dir is a bit surprising...  And it may occur more often than not, given
> > > > that the default label "New_Volume" probably won't get changed very
> > > > often.
> > > > 
> > > This is intentional and inherited from the very first patch, see the loop
> > > behind qsort(). If a range of identical names appear, all these entries are
> > > removed. If some "random" entry would be kept, it might no longer be the
> > > persistent link the user expects. We could possibly add some hash like done
> > > for by-id or append a number in such cases later. Need some more time to
> > > thing about it....
> > I see.  Admittedly, I don't know how Linux handles this either.
> 
> A quick test on Debian 12 with by-label suggests that the last duplicate
> wins. Also not very sophisticated :-)

Given this is all controlled by rather simple udev rules, see
/usr/lib/udev/rules.d/60-persistent-storage.rules, that's not
really surprising.

> IIRC in the past I've seen in another of these directories (by-id?) that
> '#N' was appended if duplicates occur.

I don't see anything like that in 60-persistent-storage.rules, though.
It has been removed at one point, it seems.

> > > I will sent a patch for the new-features doc soon.
> 
> Attached.

Thanks, pushed.


Corinna


More information about the Cygwin-patches mailing list