delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/02/22/07:20:23

X-Spam-Check-By: sourceware.org
Message-ID: <45DD8A8F.2050406@hima.com>
Date: Thu, 22 Feb 2007 13:20:31 +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: <45DD6C91 DOT 5040406 AT hima DOT com>
In-Reply-To: <45DD6C91.5040406@hima.com>
X-Spam-Processed: mail.hima.com, Thu, 22 Feb 2007 13:19:54 +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, Thu, 22 Feb 2007 13:19:55 +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

Thank you, Corinna.

Now I think I have a fundamental understandig problem:
I agree, that this behavior ist not to be expected in a binary 
mounted directory. I tested this for confirmation, according to 
your suggestion, and you are right.

But in a textmode mounted directory, 'echo peng >p.txt' creates
a 6 byte long file containing 'p' 'e' 'n' 'g' '\r' '\n'.
OK, exactly as expected. Now I thought, 'cat p.txt' would open 
this file for reading in textmode, according to the default rule.

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?

Thanks for any response.

Best regards,
Sven



On Feb 22 11:29, Corinna Vinschen wrote:
>> $ mount
>> c:\cygwin\usr\X11R6\lib\X11\fonts on /usr/X11R6/lib/X11/fonts type system (binmode)
>> C:\cygwin\bin on /usr/bin type system (textmode)
>> C:\cygwin\lib on /usr/lib type system (textmode)
>> c:\cygwin\tmp on /tmp type system (binmode)
>> C:\cygwin on / type system (textmode)
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Your home is mounted textmode.
>
>> c: on /c type system (textmode)
>> $ pwd
>> /home/es_sv
>> $ echo peng >p.txt && CO=$(cat p.txt) && od -c <<<"$CO"
>> 0000000   p   e   n   g  \r  \n
>> 0000006
>
> Which explains this behaviour.  The tools are using the default mode,
> which is textmode in your case.  I suggest replacing all textmode
> mounts with binmode mounts.
>
>
> Corinna


-- 

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