From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 3eaa1638 for ; Wed, 23 Jan 2019 04:28:23 +0000 (UTC) Received: (qmail 15148 invoked by alias); 23 Jan 2019 04:28:08 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44012 Received: (qmail 14303 invoked by uid 1010); 23 Jan 2019 04:28:08 -0000 X-Qmail-Scanner-Diagnostics: from mail-it1-f196.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(209.85.166.196):SA:0(-1.9/5.0):. Processed in 3.001828 secs); 23 Jan 2019 04:28:08 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=FYjq9XAQHcxiPoUR5C6BzrcAvA0yDoejxcsngyX5OUo=; b=mtCBG3SGn8QdKL0jFGi5qDdYtQJcRkdwYUAfpMQFE+3irBozhwi1PK5nrResA4GGzy JxQ2QXbLHxwXBzSpmqqQCfAsj3WA3MKXySTHzI2OTlxfht0eWUgXhlhlGcZOkGD5IzI9 BPrxDbJdE1rDWAAbi/TW4Xa5P8yLbRgTDfUFSFnKzn4/uF+H/j50dYukmhjWElr9dXiF zLet7EgLpiZqwZVD4mpaBnsieMVHKkZWtCi2bjRfwb3bjTcm93GQ3KUAfDAAqqJUHE8H VrkKfLXpW7UKAogs/nL4zGTcmNqgZ9YR2KQEQ1P9FVnN6EIO11c6cML1aDMShNNopYdV Zzfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=FYjq9XAQHcxiPoUR5C6BzrcAvA0yDoejxcsngyX5OUo=; b=o0YtDB/R+5gvfvzHVj7WxybiT0UZaAsb8GPB3nOa0QRFnDar1Jh/XGMzCAiijGgUu/ CvbmRCuxBF9iP/5IqmiO2C/6+cgNiR7s9r0zNsHRTzZRezfDQF1c+/YJyoGrvJamiEcM C7FNbf1UO9eFQbwMKlH6hACWyjRTue6WHZW5B44h0ZnKfBs5Hpyg7YhAgYClcNFx3vNI fnvQ+xVEkJdo+XTeD7bSkQNI9TAnSu7Nt6AHguVWLRDRtQXIde2MhTQPtmD3x71/mceF wXJiYM0ndxC/zSuVhC5peX/qYROm/DEvClX86vZ2UrJZDJ838QJMp0PdJJGB1PT+b+s+ dbFQ== X-Gm-Message-State: AJcUukdQu+ivxFbO0b5op+scHGi5xLVO2wOYWFb5Fp/BzqZgXEHrQtrC GkYlz2uI89mk1ZlOI4F7ffBv6g== X-Google-Smtp-Source: ALg8bN6+mRqjiOjBA+KZ987jn27jqxaWY9+R0uyGy0TwRfm8GQ6CRaxw+0pBvx7a5t24FaPIpt5XTQ== X-Received: by 2002:a05:660c:344:: with SMTP id b4mr763871itl.51.1548217681439; Tue, 22 Jan 2019 20:28:01 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\)) Subject: Re: [PATCH] Tests/X04: use temporary pattern matching for OpenBSD missing leading 0m From: dana In-Reply-To: Date: Tue, 22 Jan 2019 22:27:59 -0600 Cc: Zsh hackers list Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Sebastian Gniazdowski X-Mailer: Apple Mail (2.3445.100.39) On 22 Jan 2019, at 09:27, Sebastian Gniazdowski = wrote: >phy1729 reports that OpenBSD doesn't include a leading 0m in its >control codes output. Thus, X04 tests fail on that OS. The failure is due to $termcap[me] on OpenBSD using \e(B\e[m where the = test expects \e[0m. After normalising to the latter and stripping \e(B from = the output, it passes. Fiddling about with hard-coded escape sequences feels pretty brittle to me, but i guess that's what we're already doing, so... hopefully it's at least better than just dropping the sequence entirely. (I also fixed some white space; included as a separate diff below.) Tested on macOS and OpenBSD. It passed for Matthew as well. dana diff --git a/Test/X04zlehighlight.ztst b/Test/X04zlehighlight.ztst index e14517490..9e3b2681b 100644 --- a/Test/X04zlehighlight.ztst +++ b/Test/X04zlehighlight.ztst @@ -29,6 +29,8 @@ integer i for (( i =3D 0; i < ${1:-1}; ++i )); do zpty -r zsh REPLY + # Normalise me/sgr0 to \e[0m. We also need to strip \e(B in = zpty_stop() + REPLY=3D${REPLY//${termcap[me]}/$'\x1b[0m'} # P is for "preserve", and induces keeping some # expected color codes to test region_highlight, # etc. - the color codes are made a regular text. @@ -54,7 +56,7 @@ # zpty gives no output when piped without these braces (?) # The while loop with // substitution is to convert `e^Mexit' # into `exit' (see zpty_line). The sed commands remove escapes - { zpty -r zsh } | sed -e $'/[^\t\r ]/!d' -e $'s/\r$//' -e = $'s/\x1b\\[[0-9;]*m//g' | while read REPLY; do = REPLY=3D${REPLY//(#b)((?(#c0,1))$cm(?(#c0,1)))/${${${(M)match[2]:#${match[= 3]}}:+${match[2]}}:-${${match[1]##[[:space:]]##}%%[[:space:]]##}}}; = print -rn -- "$REPLY"; done + { zpty -r zsh } | sed -e $'/[^\t\r ]/!d' -e $'s/\r$//' -e = $'s/\x1b\\[[0-9;]*m//g' -e $'s/\x1b([A-Z]//g' | while read REPLY; do = REPLY=3D${REPLY//(#b)((?(#c0,1))$cm(?(#c0,1)))/${${${(M)match[2]:#${match[= 3]}}:+${match[2]}}:-${${match[1]##[[:space:]]##}%%[[:space:]]##}}}; = print -rn -- "$REPLY"; done zpty -d : } diff --git a/Test/X04zlehighlight.ztst b/Test/X04zlehighlight.ztst index 9e3b2681b..b6a8c35fd 100644 --- a/Test/X04zlehighlight.ztst +++ b/Test/X04zlehighlight.ztst @@ -56,7 +56,12 @@ # zpty gives no output when piped without these braces (?) # The while loop with // substitution is to convert `e^Mexit' # into `exit' (see zpty_line). The sed commands remove escapes - { zpty -r zsh } | sed -e $'/[^\t\r ]/!d' -e $'s/\r$//' -e = $'s/\x1b\\[[0-9;]*m//g' -e $'s/\x1b([A-Z]//g' | while read REPLY; do = REPLY=3D${REPLY//(#b)((?(#c0,1))$cm(?(#c0,1)))/${${${(M)match[2]:#${match[= 3]}}:+${match[2]}}:-${${match[1]##[[:space:]]##}%%[[:space:]]##}}}; = print -rn -- "$REPLY"; done + { zpty -r zsh } | + sed -e $'/[^\t\r ]/!d' -e $'s/\r$//' -e $'s/\x1b\\[[0-9;]*m//g' = -e $'s/\x1b([A-Z]//g' | + while read REPLY; do + = REPLY=3D${REPLY//(#b)((?(#c0,1))$cm(?(#c0,1)))/${${${(M)match[2]:#${match[= 3]}}:+${match[2]}}:-${${match[1]##[[:space:]]##}%%[[:space:]]##}}} + print -rn -- "$REPLY" + done zpty -d : }