[Patch] Encode invalid chars in /proc/registry entries

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Nov 16 11:09:00 GMT 2007

Hi Christian,

On Nov 15 22:56, Christian Franke wrote:
> Registry key and value names may contain chars which are not allowed within 
> file names ('/', '\', ":"). But Cygwin's /proc/registry returns these names 
> unchanged to the app. The obvious effect is that such entries cannot be 
> accessed.
> But if an entry name is identical to an existing path, more interesting 
> results occur. Cygwin itself adds registry entries which are testcases for 
> this issue :-))
> [...]
> The attached patch encodes the critical chars with %XX to avoid such 
> problems.
> Patch is tested with 1.5.24-2. Merge with HEAD looks good, but was not 
> actually tested. Therefore, no changelog provided yet.

Thanks for this patch.  Apart from the missing ChangeLog I'm inclined
to apply it to the upcoming 1.5.25 release, but I don't like to have it
in HEAD as is.

The reason is that the patch introduces more usages of CYG_MAX_PATH plus
static buffers of that size.  That's ok for 1.5, but that's not ok
anymore for 1.7.  We're heading to support PATH_MAX = ~32K paths.  The
registry also supports long paths, unfortunately with undefined max
length.  The current definition in MSDN(*) is

  Max name length of keys:      255 chars
  Max name length of values:  16383 chars
  Max tree depth:               512 levels

So, for HEAD I'd like to ask you to allow arbitrary path lengths in your
code.  Personally I could live with restricting registry paths to
PATH_MAX as well.

While you're digging in registry code anyway... would you be interested
to convert the entire registry code to wide char and long path names?
I'd be glad for any help.


(*) http://msdn2.microsoft.com/en-us/library/ms724872.aspx

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

More information about the Cygwin-patches mailing list