X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; q=dns; s=default; b=HJKz miKAuSsfnPPpVerL5kp8qBERjrcsTxSq3ckJqOOIY2XlkhQLl89uWy98GK+LrzRs WmW+AxPYb2KGJssp6hTc7+uJtNVEeNt3LRT5lW1nYhGJn1Cca0Z4HTBU+KUE0PYm uqdzIc4Xw62GiYLjxT0cjfB0+DXDOL9pYLPDq/M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; s=default; bh=SO4aeQ5eQp lYL7E1spzFdh5oxSg=; b=W0PW/eR58J5e5jJeJ0901Olfn5JCfsu2N9W1f0NQ/p 8OxL73OrIDJC2uomG13Bc9cOcp469Ar4JiDR1McOrJ+wyUytcISgz13cN91+sWlz mYig4m9I+xLf8uSmEUo7U/u1Ww7aWkIpmpRjej+jUKsnhxjAGq+ozG/U9GnBMZPv U= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f178.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IZFFRfWBcKlyf44YbJz6skjgxMnp/RmEnXVKbkqz4Lw=; b=aJdsd14CCT3Gf89Tdz7yXbCjHu7GWDyoyEc9oTNTBIiA2Kecse1q+/93s4EeXEi0rg slbzeEjia3nIYAqF8AbS7Or/BDsc/JTf0opLTLvP6hWenb/EpnPEGwNYo8kZ6xAbQPSu cgkl3NbJIi/wbPZK2GiI3zsHUpMzpLD4FIGUqPz3SwCAsxeR8HWcuysUx6K+Drsk/Jgq 8maMsoGcUvoqknXwhw1RkoFpnE1A05FdVLBP6jS5HDNTvEOkAFWSwbm+sjyCV9dLdnCw SVRODq1xu9puewkV1bneK6zlsOad1CBswafpSX/yyz06MZk1hud4NFi/cY0JAmGjYztJ h2NA== X-Gm-Message-State: AHPjjUgxL8rvZlz9d7ZLlq7BkuZkPckfQhfpmyswprBFbr2PbxcHpPFU 6JJ6R/v1HeG6L/00njsvPD3Ik81f6Q== X-Google-Smtp-Source: AOwi7QDI+++k6tt3w6Pi9sQeoojR2WUFjr89LDwUfx3kLNhM3r1e7LfjT8okgmarR+Hu5p/A60ImCl+vlS8PkS41Pmw= X-Received: by 10.237.59.177 with SMTP id r46mr19885698qte.253.1505194688357; Mon, 11 Sep 2017 22:38:08 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <7ed18312-4929-8299-d186-9cb0aa541a93@redhat.com> References: <7ed18312-4929-8299-d186-9cb0aa541a93 AT redhat DOT com> From: Nikolay Melekhin Date: Tue, 12 Sep 2017 08:38:07 +0300 Message-ID: Subject: Re: Extra CR symbol from backticks on Cygwin 2.9.0 To: Eric Blake Cc: cygwin AT cygwin DOT com Content-Type: text/plain; charset="UTF-8" Hi Eric, Thanks! This option is what I am looking for. However I cannot agree with you on bash behavior in Cygwin. Section of command substitution in bash documentation says: https://www.gnu.org/software/bash/manual/bash.html#Command-Substitution "...with any trailing newlines deleted." That is why I expected that bash should remove trailing newlines in command substitution results, which are CRLF on Windows. From my point of view, bash in Cygwin should follow the same rule on Linux and Windows: remove trailing newlines in command substitution. So remove trailing CRLF on Windows. Best regards, Nikolay Melekhin 2017-09-12 1:00 GMT+03:00 Eric Blake : > On 09/11/2017 04:27 PM, Nikolay Melekhin wrote: >> >> I'd expect that Cygwin must remove CRLF symbols from backtick results, > > You expected wrong - by default Cygwin does the same as Linux, which > does NOT remove CR from command substitution (only LF). > >> but remove only LF symbol. It gets different results on Windows and >> Linux. Result on Windows has additional CR symbol and for example >> string comparision, which is working in Linux, fails in Windows. > > It is NOT a bug in Cygwin, but in your failure to sanitize your input. > You'd get the same behavior on Linux if you pass in CR bytes. That said, > >> >> Is any kind of an option/setting which removes such CRs or it is a bug >> in Cygwin? > > Read the release announcements: Cygwin bash DOES have an 'igncr' shell > option (set -o igncr) that does exactly what you are asking for - it > makes bash ignore CR characters in command substitutions and other places: > > https://cygwin.com/ml/cygwin-announce/2017-01/msg00047.html > > The option is not on by default, but exists because it is a common > desire when you can't be bothered to otherwise sanitize CR out of your > input stream. > > -- > Eric Blake, Principal Software Engineer > Red Hat, Inc. +1-919-301-3266 > Virtualization: qemu.org | libvirt.org > -- 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