From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90209 invoked by alias); 15 Apr 2019 20:01:39 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 90202 invoked by uid 89); 15 Apr 2019 20:01:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,KAM_COUK,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=201702, 2017-02, contrary, cygdrive X-HELO: mail-ed1-f53.google.com Received: from mail-ed1-f53.google.com (HELO mail-ed1-f53.google.com) (209.85.208.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Apr 2019 20:01:37 +0000 Received: by mail-ed1-f53.google.com with SMTP id j20so5602275edq.10 for ; Mon, 15 Apr 2019 13:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pinky-co-uk.20150623.gappssmtp.com; s=20150623; h=reply-to:from:to:references:in-reply-to:subject:date:organization :message-id:mime-version:content-transfer-encoding:thread-index :content-language; bh=LbGFXNlRKkslM7hWWPb/PBPGwKDtmJsMCuMlZ5yW1iY=; b=vke/r9J664DhmEWnfSiSR2XgrmctoJsW0EhG5X5lc/Bek/DcYpStEL6Bggo3VejgJB 9tyKKWGc818S7IwCB8Bocamw0eZ2NKbt/L+YEWG9wJRxW+qtlM8qlUYhLin9dHr9AT5x beCohRLlXcD8Zli1dQP9SyHgmNMgZwV7Ju79m1Miz8Bd5OmKPWdIK4VRCmjqqXy49G00 wSXAzBIviKI4spAyvAV1gaWx5pibsMoVdR3GgMOj2BRecJNsimhuy4ef98LfP2lM9NUk HcqunUDK5oImbQMxHVTOGLifRiq/+g7AviS+YhRrSN9YyNOD7Jc7TQnqv03cH7ioHf2u BBvg== Return-Path: Received: from edmund ([82.113.183.179]) by smtp.gmail.com with ESMTPSA id q20sm9334043ejb.65.2019.04.15.13.01.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 13:01:34 -0700 (PDT) Reply-To: From: To: References: In-Reply-To: Subject: RE: carriage return newline being appended when using redirection in binary mode Date: Mon, 15 Apr 2019 20:01:00 -0000 Message-ID: <006101d4f3c6$07126ff0$15374fd0$@pinky.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00101.txt.bz2 H Brian - Output from type and which chrisd@edmund:chrisd > type -a echo /usr/bin/ksh: whence: -a: unknown option chrisd@edmund:chrisd > which -a echo /usr/bin/echo /usr/bin/echo This behaviour of the redirection can also be replicated using sed, etc. chrisd@edmund:chrisd > od -c foo.txt 0000000 H e l l o \n 0000006 chrisd@edmund:chrisd > sed 's/Hello/Goodbye/' foo.txt | od -c 0000000 G o o d b y e \n 0000010 chrisd@edmund:chrisd > sed 's/Hello/Goodbye/' foo.txt > boo.txt chrisd@edmund:chrisd > od -c boo.txt 0000000 G o o d b y e \r \n 0000011 Curious case of pipe to cat then redirect chrisd@edmund:chrisd > sed 's/Hello/Goodbye/' foo.txt | cat > boo.txt chrisd@edmund:chrisd > od -c boo.txt 0000000 G o o d b y e \n 0000010 chrisd@edmund:chrisd > echo $CYGWIN nodosfilewarning codepage:utf-8 binmode Cheers Chris Day c: +44 7930 909 297 p: +44 115 714 0869 s: bigchrisday https://www.linkedin.com/in/chrisdayabinitio/ -----Original Message----- From: chris.day@pinky.co.uk Sent: 15 April 2019 12:57 To: 'cygwin@cygwin.com' Subject: carriage return newline being appended when using redirection in binary mode Hi - I'm having problems with carriage return newline being appended when using redirection in binary mode. If I pipe to cat and redirect the newline is preserved, which is odd. CYGWIN_NT-10.0 edmund 3.0.6(0.338/5/3) 2019-04-06 16:18 x86_64 Cygwin chrisd@edmund:chrisd > mount E:/abinitio/cygwin/bin on /usr/bin type ntfs (binary,auto) E:/abinitio/cygwin/lib on /usr/lib type ntfs (binary,auto) E:/abinitio/cygwin on / type ntfs (binary,auto) C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto) D: on /cygdrive/d type ntfs (binary,posix=0,user,noumount,auto) E: on /cygdrive/e type ntfs (binary,posix=0,user,noumount,auto) F: on /cygdrive/f type ntfs (binary,posix=0,user,noumount,auto) G: on /cygdrive/g type ntfs (binary,posix=0,user,noumount,auto) H: on /cygdrive/h type vfat (binary,posix=0,user,noumount,auto) Q: on /cygdrive/q type ntfs (binary,posix=0,user,noumount,auto) chrisd@edmund:chrisd > echo "Hello" Hello chrisd@edmund:chrisd > echo "Hello" | od -c 0000000 H e l l o \n 0000006 chrisd@edmund:chrisd > echo "Hello" > foo.txt chrisd@edmund:chrisd > od -c foo.txt 0000000 H e l l o \r \n 0000007 chrisd@edmund:chrisd > echo "Hello" | cat > foo.txt chrisd@edmund:chrisd > od -c foo.txt 0000000 H e l l o \n 0000006 This does seem contrary to the following posts https://sourceware.org/ml/cygwin/2017-02/msg00152.html https://sourceware.org/ml/cygwin/2017-02/msg00188.html https://sourceware.org/ml/cygwin/2017-02/msg00189.html Cheers Chris Day c: +44 7930 909 297 p: +44 115 714 0869 s: bigchrisday https://www.linkedin.com/in/chrisdayabinitio/ -- 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