delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/12/02/07:08:38

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Tue, 2 Dec 2008 13:08:40 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Avoid duplicate names in /proc/registry (which may crash find) ?
Message-ID: <20081202120840.GM12905@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4934461E DOT 5040708 AT t-online DOT de>
MIME-Version: 1.0
In-Reply-To: <4934461E.5040708@t-online.de>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Dec  1 21:16, Christian Franke wrote:
> When dirent.d_type support is added to /proc/registry (see attachment), 
> find 4.4.0-3 crashes on keys with duplicate names.
>
> Testcases:
>
> $ find-with-d_type \
> /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/ALG/ISV
>
> $ find-with-d_type \
> /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Services/Eventlog/Security
>
> These keys contain a key and a value with the same name and readdir() 
> returns both (with different d_type).
>
> Possible fix to avoid identical names:
>
>
> 1. Put keys and values in different namespaces, e.g.
>
> /proc/registry/path/name.key
> /proc/registry/path/name.val
>
> Drawback: Breaks backward compatibility.
>
>
> or:
>
> 2. In readdir(), record the key names in some set<> or hash-table. If (and 
> only if) a duplicate name is detected, return a modified name for the 
> value:
>
> /proc/registry/path/name
> /proc/registry/path/name%76  ('v')
>
> Drawback: Slows down readdir, introduces alias name for value.

Some random thoughts:

- Do we really need d_type support in the registry?  How often is
  that actually used?

- If find crashes in this situation, isn't this a bug in find which
  should be fixed in find?

- /proc/registry is a convenience for reading the registry.  Due to some
  funny definitions of the registry it's not a full solution.  You can't
  write this way, you can't even access the "(Default)" key values.
  I personally don't worry if some border cases don't work.  For the
  border cases and for the full access we have regtool.

  Having said that, I really don't know what's the best solution for
  these problems would be.  None of the above ideas are very attractive.
  For instance, in idea 1, the path would actually be

    /proc/registry/HKEY_LOCAL_MACHINE.key/SOFTWARE.key/Cygwin.key/blub.val

  Shouldn't we rather defer these border cases to regtool?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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

- Raw text -


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