X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,FREEMAIL_REPLY,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <1656998784.20100531033519@mtu-net.ru> References: <20100513181249 DOT GE13784 AT cupro DOT opengvs DOT com> <2BF01EB27B56CC478AD6E5A0A28931F2F01D44 AT A1DAL1SWPES19MB DOT ams DOT acs-inc DOT net> <20100526114733 DOT GG10652 AT calimero DOT vinschen DOT de> <1254830174 DOT 20100526174227 AT mtu-net DOT ru> <20100526143428 DOT GN10652 AT calimero DOT vinschen DOT de> <326990670 DOT 20100530001515 AT mtu-net DOT ru> <20100530055757 DOT GA3251 AT trixie DOT casa DOT cgf DOT cx> <1656998784 DOT 20100531033519 AT mtu-net DOT ru> Date: Sun, 30 May 2010 17:51:23 -0600 Message-ID: Subject: Re: Reading /proc/registry/... returns extra char From: Steven Collins To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Sun, May 30, 2010 at 17:35, Andrey Repin wrote: > Greetings, Christopher Faylor! > >>>>> >> > $ cat >a.dat >>>>> >> > /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Contr= ol/Syst >>>>> >> > emBootDevice >>>>> >>>>> > This trailing NUL character was always there, already with Cygwin 1= .5. >>>>> > It's part of the file content. =A0If strings are stored with a trai= ling >>>>> > NUL in a file, you don't want Cygwin to remove it for you, right? >>>>> >>>>> Wrong. The training NULL is a string value terminator for REG_SZ vari= ables, >>>>> also a string separator for REG_MULTI_SZ ones. (Which ends with a spa= re NULL) >>>>> It must not be exposed to the user. >>> >>>> I disagree. =A0When you're using tools like regtool, you're right. =A0= But >>>> when accessing the registry as *files* via the virtual /proc filesyste= m, >>>> you want the file content. >>> >>>Yep. And I certainly not expect the NULL in text files. You know, not ev= ery >>>console program is binary-safe when working with STDIO? Not even cygwin,= as we >>>can see in this thread. >>> >>>> And the file contains the trailing NUL in REG_SZ and REG_EXPAND_SZ val= ues, >>>> and multiple NULs in REG_MULTI_SZ values. >>> >>>That's right and true, when you're working with interface directly, but.= .. all >>>the programs I've used in the past, and all the interfaces, they do not = expose >>>trailing NULL to the client application. >>>In this case, /proc/registry is an interface, but cat is the application. > >> NAME >> =A0 =A0 =A0 =A0cat - concatenate files and print on the standard output > >> I don't see anything in cat's description which claims it should know >> that some files are special and should be handled differently. > > I didn't said about cat, but rather about file it reading from. > >>>> What do you suppose Cygwin should do with the NULs in REG_MULTI_SZ val= ues? >>>> Just remove them? >>> >>>Convert them to appropriate EOL sequences. And back to NULL's on write. = As per >>>definition of a text as "multiple strings". >>>You don't need to argue over it, just document it properly :) > >> Converting a NUL to a EOL would be very strange behavior. > > Strange? I don't think so. I expect text data from text file. Not binary > stream. And if the registry were a text file you would be exactly correct in your expectations, but the registry is a binary file with some text embedded in it. >> I don't think you really know what you're asking for. > > I know. Look at windows own regedit and Registry Browser FAR plugin as two > examples. > They do such two-way conversion transparently for user. Because they are purpose built applications designed to work with the binary format of the registry. If you want this kind of behavior under cygwin through the /proc/registry interface you need to write a filter or utility to provide it. It should not be a modification of cat which is intended to read the raw data from is input and write it to its output. > > -- > WBR, > =A0Andrey Repin (anrdaemon AT freemail DOT ru) 31.05.2010, <3:29> > > Sorry for my terrible english... > > > -- > Problem reports: =A0 =A0 =A0 http://cygwin.com/problems.html > FAQ: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 http://cygwin.com/faq/ > Documentation: =A0 =A0 =A0 =A0 http://cygwin.com/docs.html > Unsubscribe info: =A0 =A0 =A0http://cygwin.com/ml/#unsubscribe-simple > > -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple