X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=3.2 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT X-Spam-Check-By: sourceware.org Date: Sun, 30 May 2010 00:15:15 +0400 From: Andrey Repin Reply-To: Andrey Repin Message-ID: <326990670.20100530001515@mtu-net.ru> To: Corinna Vinschen Subject: Re: Reading /proc/registry/... returns extra char In-Reply-To: <20100526143428.GN10652@calimero.vinschen.de> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 Greetings, Corinna Vinschen! >> >> > $ cat >a.dat >> >> > /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Syst >> >> > emBootDevice >> >> > This trailing NUL character was always there, already with Cygwin 1.5. >> > It's part of the file content. If strings are stored with a trailing >> > 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 variables, >> also a string separator for REG_MULTI_SZ ones. (Which ends with a spare NULL) >> It must not be exposed to the user. > I disagree. When you're using tools like regtool, you're right. But > when accessing the registry as *files* via the virtual /proc filesystem, > you want the file content. Yep. And I certainly not expect the NULL in text files. You know, not every 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 values, > 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. > What do you suppose Cygwin should do with the NULs in REG_MULTI_SZ values? > 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 :) BTW, is there a way to create value of certain type through /proc/registry ? (Link to documentation would be enough, I don't have local cygwin installation ATM) -- WBR, Andrey Repin (anrdaemon AT freemail DOT ru) 30.05.2010, <0:05> Sorry for my terrible english... -- 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