bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison 3.5.93 released [beta]


From: Akim Demaille
Subject: Re: Bison 3.5.93 released [beta]
Date: Thu, 7 May 2020 08:11:28 +0200

Hi Jannick,

> Le 6 mai 2020 à 11:28, Jannick <address@hidden> a écrit :
> 
> Hi Akim,
> 
> On Mon, 4 May 2020 19:14:08 +0200, Akim Demaille wrote:
>> Hi Jannick,
>> 
>>> Le 4 mai 2020 à 09:50, Jannick <address@hidden> a écrit :
> 
>>> On Windows10/MSYS2 still two test failures - presumably EOL issues 
>>> which, if I am not mistaken, cannot be solved by 'diff -u'.
>> 
>> I'm not sure, given that you don't have the problem with the other 
>> tests.  Yet I have no idea what's going on.
> 
> Testing against today's beta release 3.5.94 did not change anything, 
> unfortunately.

I was not expecting it to.

> I investigated that the above mentioned failure does stem from an EOL issue, 
> since adding in 'examples/test' the diff flag '--strip-trailing-cr' solved it.

I'm confused.

First, it was my understanding that diff was supposed to compare
text files, which, for me, meant ignoring the difference between
DOS-EOL and Unix-EOL.  The Autoconf documentation reads:

`cmp'
     `cmp' performs a raw data comparison of two files, while `diff'
     compares two text files.  Therefore, if you might compare DOS
     files, even if only checking whether two files are different, use
     `diff' to avoid spurious differences due to differences of newline
     encoding.

So I believed merely using 'diff' sufficed.  I can confirm that on
this macOS box, GNU diff does not ignore the difference between \r\n
and \n, unless I pass the --strip-trailing-cr option.


Most tests pass on your box, except Bistro, and the Java ones.  For
the Java ones, I am confused again, I expected 'println' to issue \r\n
on Windows, but I guess that's not the point of Java's portability.
So I'll have to use --strip-trailing-cr when available (and I suspect
it is available when I really need it: on Windows).


In the case of Bistro, I don't think we have an EOL issue: all the
first tests pass.  The real problem starts when we begin testing
the <tab> completion:

bistromathic: FAIL: 13$
bistromathic: diff:$
  --- exp^I2020-05-06 10:42:42.198098700 +0200$
  +++ eff^I2020-05-06 10:42:42.421794800 +0200$
  @@ -2,4 +2,4 @@$
   (       -       atan    cos     exp     ln      number  sin     sqrt$
   > (1+$
   > $
  -err: ^G1.4: syntax error: expected - or ( or number or function or variable 
before end of file$
  +err: 1.4: syntax error: expected - or ( or number or function or variable 
before end of file$


I don't want to fight this, so I'll just bail out at this point.

So I plan to install the appended patch.  Could you please try it?
I attach examples/test and examples/c/bistromathic/bistromathic.test
to drop into your source tree before testing again.

Cheers!


Attachment: test
Description: Binary data

Attachment: bistromathic.test
Description: Binary data




commit f9d6172a0fc9f395a526e8545f82070fcc29bcfc
Author: Akim Demaille <address@hidden>
Date:   Thu May 7 08:00:17 2020 +0200

    examples: beware of portability issue on Windows
    
    Reported by Jannick.
    https://lists.gnu.org/r/bug-bison/2020-05/msg00040.html
    https://lists.gnu.org/r/bug-bison/2020-05/msg00066.html
    
    * examples/test (diff_opts): Use --strip-trailing-cr if supported, to
    avoid \n vs. \r\n issues.
    * examples/c/bistromathic/bistromathic.test: When on MSYS, don't try
    to check autocompletion.

diff --git a/examples/c/bistromathic/bistromathic.test 
b/examples/c/bistromathic/bistromathic.test
index 495146bd..2ef8bc03 100755
--- a/examples/c/bistromathic/bistromathic.test
+++ b/examples/c/bistromathic/bistromathic.test
@@ -41,10 +41,11 @@ echo >perfect '> 0
 echo >ok '0'
 echo '0' | prog >effective
 
-if diff perfect effective >/dev/null 2>&1; then
+echo "checking for readline output"
+if diff perfect effective; then
     # Alles ist gut.
     strip_prompt=false
-elif diff ok effective >/dev/null 2>&1; then
+elif diff ok effective; then
     strip_prompt=true
 else
     skip "this is not the GNU Readline we expect"
@@ -257,14 +258,22 @@ err: Cleanup: popping nterm input (1.1-4: )' -p
 # From now on, the differences between versions of GNU Readline are
 # too painful to try to cope with.
 if $strip_prompt; then
-    echo "SKIP: this is not the GNU Readline we expect"
-    if $exit; then
-        exit 0
-    else
-        exit 1
-    fi
+  echo "SKIP: this is not the GNU Readline we expect"
+  exit $status
 fi
 
+# On Windows10/MSYS2 the ^G coming from <tab> completion is not
+# emitted the same way
+# (https://lists.gnu.org/r/bug-bison/2020-05/msg00076.html).
+echo "checking for kernel name"
+case `uname -s` in
+  (MSYS*)
+    echo "SKIP: this is Windows/MSYS"
+    exit $status
+    ;;
+esac
+
+
 # Check completion after an operator.
 sed -e 's/\\t/ /g' >input <<EOF
 (1+\t\t
diff --git a/examples/test b/examples/test
index c80e919e..f58eed9e 100755
--- a/examples/test
+++ b/examples/test
@@ -34,6 +34,13 @@ cwd=$(pwd)
 # See bistromathic.test.
 strip_prompt=false
 
+# If diff supports --strip-trailing-cr, use it, to avoid EOL issues
+# when testing Java programs on Windows.
+echo "checking for diff --strip-trailing-cr"
+if diff --strip-trailing-cr "$1" "$1"; then
+  diff_opts=--strip-trailing-cr
+fi
+
 # The exercised program.
 abs_medir=$cwd/examples/$medir
 if test -x "$abs_medir/$me"; then
@@ -129,7 +136,7 @@ run ()
   } >eff
 
   if test $sta_eff -eq $sta_exp; then
-    if diff eff exp >/dev/null 2>&1; then
+    if diff $diff_opts eff exp >/dev/null 2>&1; then
       echo "$me: PASS: $number"
     else
       echo "$me: FAIL: $number"
@@ -140,7 +147,7 @@ run ()
       echo "$me: effective output:"
       sed -e 's/^/  /' eff
       echo "$me: diff:"
-      diff -u exp eff | sed -e 's/^/  /'
+      diff $diff_opts -u exp eff | sed -e 's/^/  /'
       status=1
     fi
   else



reply via email to

[Prev in Thread] Current Thread [Next in Thread]