bug-coreutils
[Top][All Lists]
Advanced

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

Re: elusive failure in tests/stty/basic-1 on HP-UX


From: Jim Meyering
Subject: Re: elusive failure in tests/stty/basic-1 on HP-UX
Date: Fri, 30 Jun 2006 12:34:47 +0200

address@hidden (Bob Proulx) wrote:
> For a while now I have been seeing intermittent failures of the
> tests/stty/basic-1 test on HP-UX 11.11.  They are most
> frustratingly^Winterestingly not repeatable.  Most of the time the
> test passes.  But sometimes, every so often, the test fails with this
> output:
>
>   stty: missing argument to `rows'
>   Try `stty --help' for more information.
>
> Finally I was able to capture the failure with VERBOSE=yes set and see
> what is happening.  Here is the test code.  It looks reasonable to me.
> (However once sed is used I would probably go the entire way and do it
> all with sed instead of the longer pipeline.  :-)

I suspect I wrote it that way because I *knew* tr ';' '\n'
would do what I want (since we're guaranteed to be using the
just-built GNU tr here), while I wasn't sure using sed to
insert newlines would be portable enough.

>   # Build a list of all boolean options stty accepts on this system.
>   options=`stty -a|tail -n +2|tr ';' '\n'|sed '/ = /d;s/^ //;s/-//g'`
>
> First, here is the successful output:
>
>   + + stty -a
>   + tail -n +2
>   + sed / = /d;s/^ //;s/-//g
>   + tr ; \n
>   options=
>
>   parenb parodd cs8 hupcl cstopb cread clocal
...
> However the failing output is much different:
>
>   + + stty -a
>   + tail -n +2
>   + tr ; \n
>   + sed / = /d;s/^ //;s/-//g
>   options=rows 0
>   columns 0
...
>   parenb
>   parodd
...
>   + test rows = parenb
>   + stty rows
>   stty: missing argument to `rows'
>   Try `stty --help' for more information.
>   + fail=1
>
> Of course that looks to be impossible output given the script.  But

Not impossible, just the result of stty thinking the console is
very narrow.  You can reproduce the problem by running this:

  stty columns 1; stty -a; stty columns 80

> that is the result so it must have happened.  The stty command must
> have produced more output than was expected by the tail -n +2 pushing
> the first line into the third line.  But I have no idea how.
>
> Is it reasonable to change that test code to something like this?  I
> think it would react better in this case.
>
>   stty -a | sed '/speed/d;/rows/d;/columns/d;/ = /d;s/-//g'
>
> And then the failing extra unknown output, that is currently getting
> deleted by tail -n +2, should show up and be observed.  It should fail
> the test and we would capture that problem.

Thanks a lot for tracking that down.
With all of your analysis, I think we can fix it now.
I've made this change:

2006-06-30  Jim Meyering  <address@hidden>

        * tests/stty/basic-1: Work around an intermittent test failure
        on HP-UX 11.11.  Report and analysis from Bob Proulx.
        http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/7475

Index: tests/stty/basic-1
===================================================================
RCS file: /fetish/cu/tests/stty/basic-1,v
retrieving revision 1.16
diff -u -p -r1.16 basic-1
--- tests/stty/basic-1  5 Sep 2004 07:22:21 -0000       1.16
+++ tests/stty/basic-1  30 Jun 2006 10:28:57 -0000
@@ -38,7 +38,10 @@ stty -raw -F no/such/file 2>/dev/null &&
 stty -raw -a 2>/dev/null && fail=1
 
 # Build a list of all boolean options stty accepts on this system.
-options=`stty -a|tail -n +2|tr ';' '\n'|sed '/ = /d;s/^ //;s/-//g'`
+# Don't depend on terminal width.  Put each option on its own line,
+# remove all non-boolean ones, then remove any leading hyphens.
+sed_del='/^speed/d;/^rows/d;/^columns/d;/ = /d'
+options=`stty -a | tr -s ';' '\n' | sed "s/^ //;$sed_del;s/-//g"`
 
 # Take them one at a time, with and without the leading `-'.
 for opt in $options; do




reply via email to

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