Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <17B78BDF120BD411B70100500422FC6309E58A@IIS000> From: Bernard Dautrevaux To: "'Pavel Tsekov'" Subject: RE: The /proc/registry file system and file/directory names with slashes Date: Tue, 4 Jun 2002 17:40:58 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" > -----Original Message----- > From: Pavel Tsekov [mailto:ptsekov AT syntrex DOT com] > Sent: Tuesday, June 04, 2002 4:49 PM > To: cygwin AT cygwin DOT com > Subject: The /proc/registry file system and file/directory names with > slashes > > > Hello, there! :) > > I thought this needs to be in the ml archives :) > > I have seen this in the past but never paid too much attention to the > fact i.e. the registry can contain keys/values with forward/backward > slashes in them. Now as I've spent some time investigating the cygwin > /proc/registry support it seems this is a real PITA. The problem is > that the cygwin dll internally converts the paths it works with from > POSIX to Win32 and from Win32 to POSIX - this in some cases renders > the registry paths totaly unusable though they may were > POSIX-ly valid. > Well I don't know what POSIX says about backslashes but linux doesn't > seem to have problems with them, neither does Solaris 8. While this > seems to be possible to handle with some quirks in the code or a > custom path_conv class, the other case i.e. forward slashes > seem to be a real nasty :( > Maybe the forward slash can be replaced with some other > character on the fly > and only the registry fhandler will see the real name ?! :) > > Oh well :) Hope this one wasn't too annoing :) Well, it seems to be quite annoying... Just think at how the *cygwin* mount table is stored in the registry: the mount point characteristics for "/" is stored in key "HKLM\Software\Cygnus solutions\Cygwin\mounts v2\/" and the one for "/usr/bin" in "HKLM\Software\Cygnus solutions\Cygwin\mounts v2\/usr/bin", that is in key "/usr/bin" in "mounts v2", not in subkey "bin" of key "usr"... In fact I fall into this exact culprit when writing my own registry access classes: I started by converting slashes to backslahes for calling Win32 registry routine, thinking it was simpler to type, in C or C++, "HKLM/SoftWare/Xyz" than "HKLM\\Software\\Xyz", with the risk to forget to double one backslash from time to time. However when I tried to access the cygwin mount table, all this fall apart and I had to stop converting AND change all my key names to use backslashes instead of slashes. Now when mixing this with /proc/registry, the result is, err..., disturbing 8-0) In fact I don't really see a *good* solution to the "to convert or not to convert" dilemna :-( Converting slashes to backslashes seems interesting, as /proc/registry is a POSIX path and requiring people write "/proc/registry/HKLM\\SoftWare\\My application\\Options\\start position" is a bit complicated; converting '/' to '\\' will simplify this to "/proc/registry/HKLM/SoftWare/My application/Options/start position" but will mess up "/proc/registry/HKLM\\SoftWare\\My application\\Options\\read/write mode" ;-( Not converting means quite messy key/path names and the impossibility to use standard POSIX tools (like basename, dirname, ...) to manipulate key names; this will make registry manipulation from shell script a real PITA and thus severely hinder the usefulness of /proc/registry :-( And the last solution (converting some other character in the key part, that is after /proc/registry/, to a slash while converting slashes to backslashes, this is quite inelegant and needs to find a character that is both simple to use in shell (probably we should avoid # for example) AND is not usable in a key name. The problem is that the documentation clearly states that "Key names cannot include a backslash (\), but any other printable or unprintable character can be used" (from "Structure of the Registry" in the "Platform SDK" Registry documentation) ... 8-( Oh god; why does Micro$oft decided to create this monstruous mess, with backslashes where other expect slashes? probably to be able to use slashes where others expect dashes :-) but that's life and we have to live with this! Bernard -------------------------------------------- Bernard Dautrevaux Microprocess Ingenierie 97 bis, rue de Colombes 92400 COURBEVOIE FRANCE Tel: +33 (0) 1 47 68 80 80 Fax: +33 (0) 1 47 88 97 85 e-mail: dautrevaux AT microprocess DOT com -------------------------------------------- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/