Re: [bug-gawk] gawk Regression: CR characters are not stripped on Windows

2018-03-05 Thread arnold
Andrey Repin  wrote:

> Greetings, arn...@skeeve.com!
>
> > Corinna Vinschen  wrote:
>
> >> Hi Arnold,
> >>
> >> On Mar  5 06:36, arn...@skeeve.com wrote:
> >> > Is there a way to distinguish cygwin from msys at compile time?
> >> > I would not object to restoring the behavior for msys only.
> >>
> >> __MSYS__ vs. __CYGWIN__
> >>
> >>
> >> Corinna
>
> > Excellent. I will probably do that, soon.
>
> Keep in mind that you should avoid relying on __CYGWIN__ if possible.
> Only if certain POSIX mandated functionality could not be implemented at all
> using WinAPI you may go for this macro to work around compatibility issues.

I don't think it's a problem; I am testing for MSYS.  The change
is now in git in posix/gawkmisc.c.

Thanks,

Arnold

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



Re: [bug-gawk] gawk Regression: CR characters are not stripped on Windows

2018-03-05 Thread Vince Rice
> On Mar 5, 2018, at 2:58 PM, Andrey Repin wrote:
> 
> Greetings, 
> 
>> Corinna Vinschen wrote:
>> 
>>> Hi Arnold,
>>> 
>>> On Mar  5 06:36, arn...@skeeve.com wrote:
 Is there a way to distinguish cygwin from msys at compile time?
 I would not object to restoring the behavior for msys only.
>>> 
>>> __MSYS__ vs. __CYGWIN__
>>> 
>>> 
>>> Corinna
>> 
>> Excellent. I will probably do that, soon.
> 
> Keep in mind that you should avoid relying on __CYGWIN__ if possible.
> Only if certain POSIX mandated functionality could not be implemented at all
> using WinAPI you may go for this macro to work around compatibility issues.

https://cygwin.com/acronyms/#PCYMTNQREAIYR (see  above, which
wasn’t redacted in your reply).
(And Arnold, you did the same thing with Corinna’s email address.)

Keep in mind that it was Corinna answering the question. Given the subject of 
this
discussion, and that Corinna gave the answer, he doesn’t really need to “avoid
relying on __CYGWIN__”.
--
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



Re: [bug-gawk] gawk Regression: CR characters are not stripped on Windows

2018-03-05 Thread Andrey Repin
Greetings, arn...@skeeve.com!

> Corinna Vinschen  wrote:

>> Hi Arnold,
>>
>> On Mar  5 06:36, arn...@skeeve.com wrote:
>> > Is there a way to distinguish cygwin from msys at compile time?
>> > I would not object to restoring the behavior for msys only.
>>
>> __MSYS__ vs. __CYGWIN__
>>
>>
>> Corinna
>>
>> -- 
>> Corinna Vinschen  Please, send mails regarding Cygwin to
>> Cygwin Maintainer cygwin AT cygwin DOT com
>> Red Hat

> Excellent. I will probably do that, soon.

Keep in mind that you should avoid relying on __CYGWIN__ if possible.
Only if certain POSIX mandated functionality could not be implemented at all
using WinAPI you may go for this macro to work around compatibility issues.


-- 
With best regards,
Andrey Repin
Monday, March 5, 2018 23:56:14

Sorry for my terrible english...


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



Re: [bug-gawk] gawk Regression: CR characters are not stripped on Windows

2018-03-05 Thread arnold
Corinna Vinschen  wrote:

> Hi Arnold,
>
> On Mar  5 06:36, arn...@skeeve.com wrote:
> > Is there a way to distinguish cygwin from msys at compile time?
> > I would not object to restoring the behavior for msys only.
>
> __MSYS__ vs. __CYGWIN__
>
>
> Corinna
>
> -- 
> Corinna Vinschen  Please, send mails regarding Cygwin to
> Cygwin Maintainer cygwin AT cygwin DOT com
> Red Hat

Excellent. I will probably do that, soon.

Thanks!

Arnold

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



Re: [bug-gawk] gawk Regression: CR characters are not stripped on Windows

2018-03-05 Thread Corinna Vinschen
Hi Arnold,

On Mar  5 06:36, arn...@skeeve.com wrote:
> Is there a way to distinguish cygwin from msys at compile time?
> I would not object to restoring the behavior for msys only.

__MSYS__ vs. __CYGWIN__


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat


signature.asc
Description: PGP signature


Re: [bug-gawk] gawk Regression: CR characters are not stripped on Windows

2018-03-05 Thread arnold
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  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