delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/02/23/03:33:42

X-Spam-Check-By: sourceware.org
Message-ID: <45DEA6F7.1050603@hima.com>
Date: Fri, 23 Feb 2007 09:33:59 +0100
From: Sven Severus <s DOT severus AT hima DOT com>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Why binary mode?
References: <022320070030 DOT 27766 DOT 45DE3598000BA38700006C7622007358340A050E040D0C079D0A AT comcast DOT net>
In-Reply-To: <022320070030.27766.45DE3598000BA38700006C7622007358340A050E040D0C079D0A@comcast.net>
X-Spam-Processed: mail.hima.com, Fri, 23 Feb 2007 09:33:17 +0100 (not processed: message from valid local sender)
X-MDRemoteIP: 192.168.100.10
X-Return-Path: s DOT severus AT hima DOT com
X-Envelope-From: s DOT severus AT hima DOT com
X-MDaemon-Deliver-To: cygwin AT cygwin DOT com
X-MDAV-Processed: mail.hima.com, Fri, 23 Feb 2007 09:33:18 +0100
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Eric Blake schrieb:
>> This is, what I expect, after reading the Cygwin FAQ:
>> "When processing in text mode, [...] written to the file [...] 
>> you in fact get "Hello\r\n". Upon reading this combination, 
>> the \r is removed [...]".
>> Why is it in fact not removed when reading with cat?
>>     
>
> The FAQ is outdated.  Would you care to volunteer to help
> maintain it?  Reading the NEWS for coreutils, cat was changed
> upstream in the last two years or so to always be binary-only,
> to more closely comply with POSIX rules that state that
> cat must operate on all file types, not just text files.
> If cat used default mode, it would corrupt true binary
> files that lived in text mounts.
>   
OK, thanks for this hint...
And thanks too for your offer, to help maintaining the FAQ.
But unfortunately I have a boss who claims to use myself
at full capacity ;-> ... you know what I mean?


Lev Bishop schrieb:
>> Why is it in fact not removed when reading with cat?
>>     
> Because cat is required by posix to read in binmode. Try, for example: 
> $ echo peng >p.txt && read CO <p.txt && od -c <<<"$CO"
> 0000000   p   e   n   g  \n
I see, that's fine. I will use this construct instead of the command
expansion with cat. Thanks.


Norton Allen schrieb:
> Which apparently means that the original doc he referred to (Cygwin
> User's Guide, chapter "Text and Binary modes" ) should be updated. I
> think the fact that cat reads in binmode is surprising (though it makes
> sense if you think about it) so the behavior should be prominently
> noted. Certainly the shell idiom of using cat to read text files is
> widespread. Makes you wonder whether cat shouldn't have an option added
> to read in text mode (that'd be an upstream question).
>   
Lev Bishop schrieb:
> It has been discussed to add a cygwin-local cat --text option, but
> rejected on the basis that since it would be cygwin-only and
> nonstandard, one might as well use the equally nonstandard d2u instead
> of cat. I believe there was at one point some attempt to get such an
> option upstream, but upstream resisted this. I'm sure this is
> mentionned in the archives somewhere.
>   
Thanks for your explanations.

Best regards,
Sven

-- 

Mit freundlichen Grüßen

Dipl. Inform. Sven Severus
Softwareentwicklung
----------------------------------------------------------
HIMA Paul Hildebrandt GmbH + CO KG
Abt: Entwicklung Software
Albert-Bassermann-Strasse 28
68782 Bruehl
Germany

Tel: +49 6202 709-289
Fax: +49 6202 709-299
E-Mail: s DOT severus AT hima DOT com
Internet: www.hima.de


--

HIMA Paul Hildebrandt GmbH + Co KG, Postfach 12 61, 68777 Bruehl bei Mannheim
Kommanditgesellschaft, Sitz Bruehl, Deutschland - Registergericht Mannheim HRA 421017
Ust-ID: DE 144286400, St.Nr: 43038 00190

Persoenlich haftende Gesellschafterin Paul Hildebrandt Verwaltungsgesellschaft mbH, 
Sitz Bruehl, Deutschland - Registergericht Mannheim HRB 420588

Geschaeftsfuehrer: Dipl.-Betriebswirt Steffen Philipp, Dipl.-Kfm. Peter Swiczinsky




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019