delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/03/26/18:35:46

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,HS_INDEX_PARAM
X-Spam-Check-By: sourceware.org
Message-ID: <268051.64734.qm@web88306.mail.re4.yahoo.com>
X-RocketYMMF: ilatypov
Date: Fri, 26 Mar 2010 16:35:35 -0700 (PDT)
From: Ilguiz Latypov <ilatypov AT infradead DOT org>
Subject: update on tr feasibility in text mode docs
To: cygwin AT cygwin DOT com
MIME-Version: 1.0
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

--0-1724877961-1269646535=:64734
Content-Type: text/plain; charset=us-ascii


The current documentation on Cygwin text mode heuristic relies on a bug in a GNU tool.  That bug was fixed.

 http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/doc/textbinary.sgml?rev=1.11&content-type=text/x-cvsweb-markup&cvsroot=src

 The script</para>

 <screen>
 <![CDATA[
 #!/bin/sh
 # Remove \r from the file given as argument
 tr -d '\r' < "$1" > "$1".nocr
 ]]>
 </screen>
 <para> will not work on a text mounted systems because the \r will be 
 reintroduced on writing.I believe GNU tr switched to always-binary output on January 1, 1999, according to its change log,

  http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=87f9e231c340b939bf691842df8fb30e88402acd

The Cygwin example
should probably be more explicit by offering C code with the
fopen() "w" mode and a counter-example with the "wb" mode.

I tested tr's binary output in a text mount using the attached script,

  https://savannah.gnu.org/bugs/?27983

The script showed that cygport's build of xargs and the pristine biuld of GNU gzip failed to use the explicit binary mode where they should.

-- 
--0-1724877961-1269646535=:64734
Content-Type: application/x-sh; name="text-mode.sh"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="text-mode.sh"

IyEgL2Jpbi9iYXNoIC1lCgojIERlbW9uc3RyYXRlIHRoZSBiZWhhdmlvdXIg
b2YgQ3lnd2luJ3MgZGVmYXVsdCBmaWxlIG9wZW4gbW9kZSB3aGljaCBkZXBl
bmRzIG9uCiMgdGhlIG1vdW50IG9wdGlvbiBhbmQgb24gdGhlICJiaW5tb2Rl
IiB3b3JkIGluICRDWUdXSU4uCgojIEFsc28gZGVtb25zdHJhdGUgdGhhdCB0
aGUgR05VICJ0cmFuc2xhdGUiIHV0aWxpdHkgZnJvbSBjb3JldXRpbHMsICJ0
ciIsCiMgYWx3YXlzIHNhdmVzIG91dHB1dCBpbiBiaW5hcnkgbW9kZSBzaW5j
ZSB0aGUgY2hhbmdlIGluIGl0cyBzb3VyY2UgY29kZSBvbgojIEphbnVhcnkg
MSwgMTk5OS4KIwojICAgaHR0cDovL2dpdC5zYXZhbm5haC5nbnUub3JnL2dp
dHdlYi8/cD1jb3JldXRpbHMuZ2l0O2E9Y29tbWl0ZGlmZjtoPTg3ZjllMjMx
YzM0MGI5MzliZjY5MTg0MmRmOGZiMzBlODg0MDJhY2QKIwojIFRoaXMgcmVm
dXRlcyB0aGUgY3VycmVudCAoYXMgb2YgTm92ZW1iZXIgMjAwOSkgZG9jdW1l
bnRhdGlvbiBvbiBDeWd3aW4gd2hpY2gKIyBzYXlzIHRoYXQgd2l0aCAidHIi
LCAidGhlIFxyIHdpbGwgYmUgcmVpbnRyb2R1Y2VkIG9uIHdyaXRpbmcsIgoj
CiMgICBodHRwOi8vc291cmNlcy5yZWRoYXQuY29tL2N5Z3dpbi9jeWd3aW4t
dWctbmV0L3VzaW5nLXRleHRiaW5hcnkuaHRtbAojCiMgVGhlICJ0ZXh0IiB2
cy4gImJpbmFye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MgZm9yICgoaT0xO2k8PSR7bn07aSsrKSkgOyBkbyBlY2hvICIke2Rp
cn0vZmlsZSR7aX0udHh0IiA7IGhleGR1bXAgLUMgIiR7ZGlyfS9maWxlJHtp
fS50eHQiIDsgZG9uZQpybSAtcmYgIiR7ZGlyfSIKCg==


--0-1724877961-1269646535=:64734
Content-Type: text/plain; charset=us-ascii

--
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
--0-1724877961-1269646535=:64734--

- Raw text -


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