[Patch] Encode invalid chars in /proc/registry entries
Christian Franke
Christian.Franke@t-online.de
Thu Nov 15 21:57:00 GMT 2007
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 :-))
An app that descends dirs by chdir() continues outside of /proc/registry
and may finally re-enter /proc/registry:
$ find /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Cygnus Solutions/
/proc/registry/.../Cygnus Solutions/Cygwin/
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2//
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2//bin
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2//bin/822-date
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2//bin/a2p.exe
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2//bin/aclocal-1.10
...
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2//bin/znew
...
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2//proc/registry/...
If an app descends by path concatenation (like ncdu), infinite recursion
may occur if entry name is "/":
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2//
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2////
/proc/registry/.../Cygnus Solutions/Cygwin/mounts v2//////
...
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.
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin-1.5.24-2-regnames-encode.patch
Type: text/x-patch
Size: 4014 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20071115/5ad94f46/attachment.bin>
More information about the Cygwin-patches
mailing list