delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/03/05/08:36:23

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:from:message-id:date:to:subject:references
:in-reply-to:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=dSiiiU7EatIxXGX7
feiBr72e6MDywjxYUlAAzFgUhwWI+o7fHf1RUwYPPhwjJaC+JOOIiNbyxI6+DfdH
/q9yoWN/1LNXwL3tpMEF36aGUFkpuJ3skTxCq3EBybJ3q0A9yMrff/JdqSOgWkIZ
tgHIA8Sk58tnYPRah8wmpADv+lo=
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:from:message-id:date:to:subject:references
:in-reply-to:mime-version:content-type
:content-transfer-encoding; s=default; bh=lb5fE3hBv0k5KOlRK2zlm6
Z0E7g=; b=noZA2bewrQI+IAdPG1GpOOfUZM7WA+hRj6uTzdj54izgbk4Ism14t3
55d37QpjvnPj4R3k8+Vdmol+vw5jE1FceeK1d22B+VZgfXorIDZVzkGAe9UC85Lo
FQPZSOLKz7uO5DY9Pp/zTBDRscWmzpc4ZHxjLYWuPVEoLkZhSud14=
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Minimal, arnold, 4.2.0, states
X-HELO: freefriends.org
X-Envelope-From: arnold AT skeeve DOT com
From: arnold AT skeeve DOT com
Message-Id: <201803051336.w25Da6xe018344@freefriends.org>
Date: Mon, 05 Mar 2018 06:36:06 -0700
To: orgads AT gmail DOT com, eliz AT gnu DOT org, cygwin AT cygwin DOT com, bug-gawk AT gnu DOT org
Subject: Re: [bug-gawk] gawk Regression: CR characters are not stripped on Windows
References: <CAGHpTB+bfbts=fOBSQPN7c-NDh8FTXR+EauhDhiVrqbgawcYoA AT mail DOT gmail DOT com>
In-Reply-To: <CAGHpTB+bfbts=fOBSQPN7c-NDh8FTXR+EauhDhiVrqbgawcYoA@mail.gmail.com>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0

Is there a way to distinguish cygwin from msys at compile time?
I would not object to restoring the behavior for msys only.

Thanks,

Arnold

Orgad Shaneh <orgads AT gmail DOT com> wrote:

> Hi,
>
> Cross-posting per Eli Zaretskii's request.
>
> CR characters used to be automatically stripped on Windows (MSYS2 and
> Cygwin environments). This is broken in 4.2.0.
>
> Minimal example:
> echo -en "foo\r\n\r\nbar\r\n" > foo.txt
> awk '/^$/ { print "found" }' foo.txt # This worked with 4.1.4 and
> doesn't work with 4.2.0
> awk '/^\r$/ { print "found" }' foo.txt # This works with 4.2.0 and
> doesn't work with 4.1.4
>
> Bisected to commit 5db38f775d9ba239e125d81dff2010a2ddacb48e:
> (* gawkmisc.c (cygwin_premain0, cygwin_premain2): Remove.
> No longer needed).
>
> Apparently it's still needed...
>
> This issue was reported in https://github.com/git-for-windows/git/issues/1524
>
> Proposed patch is attached.
>
> As Eli said, this change was deliberate. But this has several drawbacks.
>
> 1. The gawk info page states that:
>
> > Under MS-Windows, 'gawk' (and many other text programs) silently
> > translates end-of-line '\r\n' to '\n' on input and '\n' to '\r\n' on
> > output.
>
> and on Feb 8 the following section was added:
>
> > Recent versions of Cygwin open all files in binary mode.  This means
> > that you should use 'RS = "\r?\n"' in order to be able to handle
> > standard MS-Windows text files with carriage-return plus line-feed line
> > endings.
>
> This breaks compatibility between different gawk versions. What were
> the reasons for this change in cygwin, and why was it pushed upstream?
>
> 2. Git and other tools automatically convert text files to CRLF on
> Windows. This means that any awk script that runs on both platforms
> must use RS = "\r?\n". One example that was broken by this behavior
> change is gerrit's commit-msg hook[1], which scans for empty lines by
> /^$/ regexp.
>
> Please consider reverting this change. Patch attached.
>
> [1] https://gerrit.googlesource.com/gerrit/+/376a7bbb64f1b3f13c261f4efa0af0e8538cfe9b/resources/com/google/gerrit/server/tools/root/hooks/commit-msg#101
>
> - Orgad

--
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

- Raw text -


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