Subject: bug#71468: backref-multibyte-slow test fails on Cygwin

From: Collin Funk <[email-masked]>
Date: Sat, 01 Mar 2025 21:38:46 -0800

Hi Bruno,

You wrote:
> Building the current grep (git master) with the current Gnulib
> on Cygwin 3.5.3, I see a test failure:

> FAIL: backref-multibyte-slow

The issue here seems to be a carriage return emitted by Perl generated
in these lines:

+ gawk 'BEGIN {for (i=0; i<13000; i++) print "aba"}' /dev/null
++ LC_ALL=C
++ perl -le 'use Time::HiRes qw(time); my $s = time();
              system q,grep -E '\''^([a-z]).\1$'\'' in > junk,;
              my $elapsed = time() - $s; print int (1 + 10 * $elapsed)'
+ max_seconds=$'1\r'
+ test $'1\r' = 1

After that, the variable is used and causes an error to be emitted in
the output. Here is the diff with expected output:

+ diff -u out-en_US.UTF-8 in
--- out-en_US.UTF-8	2024-06-10 05:17:21.428471600 +0000
+++ in	2024-06-10 05:17:21.147110300 +0000
@@ -1,2 +1,13000 @@
-timeout: invalid time interval ‘1\rs’
-Try 'timeout --help' for more information.
+aba

Do you know what Perl is being used on the Cygwin CI machines?

As far as I can tell, you don't install the Cygwin Perl package in
many-platforms.yml [1]. GitHub says Windows CI machines come with Perl
installed [2], but I assume this would be some Windows distribution like
Strawberry Perl [3].

I haven't used Windows enough to know for sure, but I assume the Native
Windows Perl distributions emit a carriage return while the Cygwin
version does not. I believe that something similar occurs with Native
Windows Python vs. Cygwin Python.

Collin

[1] https://github.com/gnu-grep/ci-check/blob/36c4af9a80f2abf8aa67ab8d4c12e9a9c51c2595/.github/workflows/many-platforms.yml#L657
[2] https://github.com/actions/runner-images/blob/a88fc4db06ae2350cb3128627b7fe4b5ee847f8e/images/windows/Windows2022-Readme.md?plain=1#L23
[3] https://strawberryperl.com/