public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: Add /dev/disk/by-label and /dev/disk/by-uuid symlinks
Date: Mon, 20 Nov 2023 10:46:53 +0100	[thread overview]
Message-ID: <ZVsrDfTnL6Fy3BfM@calimero.vinschen.de> (raw)
In-Reply-To: <ZVsppVEdC+HW2NE5@calimero.vinschen.de>

On Nov 20 10:40, Corinna Vinschen wrote:
> Hi Christian,
> 
> This puzzles me:
> 
> On Nov 17 21:25, Christian Franke wrote:
> > @@ -610,7 +607,7 @@ get_by_id_table (by_id_entry * &table, fhandler_dev_disk::dev_disk_location loc)
> >    if (!table)
> >      return (errno_set ? -1 : 0);
> >  
> > -  /* Sort by name and remove duplicates. */
> > +  /* Sort by name and mark duplicates. */
> >    qsort (table, table_size, sizeof (*table), by_id_compare_name);
> >    for (unsigned i = 0; i < table_size; i++)
> 
> by_id_compare_name only compars the actual names...
> 
> >      {
> > @@ -619,12 +616,13 @@ get_by_id_table (by_id_entry * &table, fhandler_dev_disk::dev_disk_location loc)
> >  	j++;
> >        if (j == i + 1)
> >  	continue;
> > -      /* Duplicate(s) found, remove all entries with this name. */
> > -      debug_printf ("removing duplicates %d-%d: '%s'", i, j - 1, table[i].name);
> > -      if (j < table_size)
> > -	memmove (table + i, table + j, (table_size - j) * sizeof (*table));
> > -      table_size -= j - i;
> > -      i--;
> > +      /* Duplicate(s) found, append "#N" to all entries.  This never
> 
> ...but the names are identical.  So the *order* within the identically
> named entries depends on qsort's reshuffling of table
> entries.  Which in turn depends on outside factors like number of table
> entries and the ultimate position of the identical entries within the
> ordered table.
> 
> Having said that, I don't see how adding ordinals to the names can be
> unambiguous.  AFAICS, the numbers may change by just adding another
> disk (USB Stick) to the system...

Oops, that's not exactly what I was trying to say, sorry.

The problem is not adding ordinals to the name, AFAICS, the problem is
that the sorting function by_id_compare_name is not up to the task to
make sure the order is unambiguous within the entries of identical name.


Corinna

  reply	other threads:[~2023-11-20  9:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 14:39 Christian Franke
2023-11-17 16:23 ` Corinna Vinschen
2023-11-17 16:45   ` Christian Franke
2023-11-17 16:49     ` Corinna Vinschen
2023-11-17 17:53       ` Christian Franke
2023-11-17 19:40         ` Corinna Vinschen
2023-11-17 20:25           ` Christian Franke
2023-11-20  9:40             ` Corinna Vinschen
2023-11-20  9:46               ` Corinna Vinschen [this message]
2023-11-20 14:54                 ` Christian Franke
2023-11-20 20:02                   ` Corinna Vinschen
2023-11-21 11:24                   ` Christian Franke
2023-11-21 15:24                     ` Corinna Vinschen
2023-11-21 18:31                       ` Christian Franke
2023-11-21 18:41                         ` Corinna Vinschen
2023-11-22  9:18                           ` Corinna Vinschen
2023-11-22 16:31                             ` Christian Franke
2023-11-23 16:27                               ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZVsrDfTnL6Fy3BfM@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).