zsh-workers
 help / color / mirror / code / Atom feed
From: Vin Shelton <acs@alumni.princeton.edu>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: zsh-workers <zsh-workers@zsh.org>
Subject: Re: [Bug] $jobstates does not work in $()
Date: Thu, 3 Mar 2022 17:04:20 -0500	[thread overview]
Message-ID: <CACeGjnXXv1eHP5_L3hFUjhvk1WBTQzcVhyf3L-uMV00snJpFUg@mail.gmail.com> (raw)
In-Reply-To: <ac5c19d9717be49ea3aed6d3c6c90634ab6c3902.camel@ntlworld.com>

[-- Attachment #1: Type: text/plain, Size: 6782 bytes --]

I don't see how you could have provoked this, Peter, but in the latest
sources, I'm seeing a test failure under i3 in Arch:

ZTST_verbose=2 make TESTNUM=W03 check
cd Test ; make check
make[1]: Entering directory '/opt/build/zsh-2022-03-03/Test'
if test -n "gcc"; then \
  cd .. && DESTDIR= \
  make MODDIR=`pwd`/Test/Modules install.modules > /dev/null; \
fi
if test -z "$ZTST_handler"; then \
  ZTST_handler=runtests.zsh; \
fi; \
if ZTST_testlist="`for f in ../../../src/zsh-2022-03-03/Test/W03*.ztst; \
           do echo $f; done`" \
 ZTST_srcdir="../../../src/zsh-2022-03-03/Test" \
 ZTST_exe=../Src/zsh \
 ../Src/zsh +Z -f ../../../src/zsh-2022-03-03/Test/$ZTST_handler; then \
 stat=0; \
else \
 stat=1; \
fi; \
sleep 1; \
rm -rf Modules .zcompdump; \
exit $stat
../../../src/zsh-2022-03-03/Test/W03jobparameters.ztst: starting.
ZTST_getsect: read section name: prep
ZTST_getchunk: read code chunk:
  if zmodload zsh/zpty 2> /dev/null; then
    zpty_start() {
      export PS1= PS2=
      zpty -d
      zpty zsh "${(q)ZTST_testdir}/../Src/zsh -fiV +Z"
    }
    zpty_input() {
      zpty -w zsh "${(F)@}" $'\n'
    }
    zpty_line() {
      local REPLY
      integer i
      for (( i = 0; i < ${1:-1}; ++i )); do
        zpty -r zsh REPLY
        print -r -- ${REPLY%%($'\r\n'|$'\n')}
      done
    }
    zpty_stop() {
      # exit twice in case of check_jobs
      zpty -w zsh $'exit\nexit\n'
      # zpty gives no output when piped without these braces (?)
      { zpty -r zsh } | sed $'/[^[:space:]]/!d; s/\r$//;'
      zpty -d
      :
    }
    if ! zmodload zsh/parameter 2> /dev/null; then
      ZTST_unimplemented='the zsh/parameter module is not available'
    fi
  else
    ZTST_unimplemented='the zsh/zpty module is not available'
  fi
ZTST_execchunk: status 0
ZTST_getchunk: read code chunk:

ZTST_getsect: read section name: test
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  zpty_start
ZTST_getchunk: read code chunk:
  zpty_start
  zpty_input 'sleep 3 &'
  zpty_input 'print $jobstates'
  zpty_input '(print $jobstates)'
  zpty_input 'jobs -s'
  zpty_stop
ZTST_test: examining line:
*>\[1] [0-9]##
ZTST_getredir: read redir for '>':
\[1] [0-9]##
ZTST_test: examining line:
*>running:+:*=running
ZTST_getredir: read redir for '>':
running:+:*=running
ZTST_test: examining line:
*>running:+:*=running
ZTST_getredir: read redir for '>':
running:+:*=running
ZTST_test: examining line:
*>zsh:*SIGHUPed*
ZTST_getredir: read redir for '>':
zsh:*SIGHUPed*
ZTST_test: examining line:

Running test: $jobstate for running job in main shell and subshell
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.46005/ztst.in, output: /tmp/zsh.ztst.46005/ztst.out,
error: /tmp/zsh.ztst.46005/ztst.terr
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
[1] 46016
zsh: failed to load module `zsh/parameter':
/opt/zsh-2022-03-03/lib/zsh/5.8.1.1-dev/zsh/parameter.so: cannot open
shared object file: No such file or directory
zsh/parameter
zsh: failed to load module `zsh/parameter':
/opt/zsh-2022-03-03/lib/zsh/5.8.1.1-dev/zsh/parameter.so: cannot open
shared object file: No such file or directory
zsh/parameter
zsh: warning: 1 jobs SIGHUPed
ZTST_test: and standard error:

Pattern match failed, line mismatch (4/6):
 <\[1] [0-9]##
 <running:+:*=running
 <running:+:*=running
 <zsh:*SIGHUPed*
 >[1] 46016
 >zsh: failed to load module `zsh/parameter':
/opt/zsh-2022-03-03/lib/zsh/5.8.1.1-dev/zsh/parameter.so: cannot open
shared object file: No such file or directory
 >zsh/parameter
 >zsh: failed to load module `zsh/parameter':
/opt/zsh-2022-03-03/lib/zsh/5.8.1.1-dev/zsh/parameter.so: cannot open
shared object file: No such file or directory
 >zsh/parameter
 >zsh: warning: 1 jobs SIGHUPed
Test ../../../src/zsh-2022-03-03/Test/W03jobparameters.ztst failed: output
differs from expected as shown above for:
  zpty_start
  zpty_input 'sleep 3 &'
  zpty_input 'print $jobstates'
  zpty_input '(print $jobstates)'
  zpty_input 'jobs -s'
  zpty_stop
Was testing: $jobstate for running job in main shell and subshell
../../../src/zsh-2022-03-03/Test/W03jobparameters.ztst: test failed.
**************************************
0 successful test scripts, 1 failure, 0 skipped
**************************************
make[1]: *** [Makefile:190: check] Error 1
make[1]: Leaving directory '/opt/build/zsh-2022-03-03/Test'
make: *** [Makefile:263: check] Error 2

TIA,
  Vin

On Wed, Mar 2, 2022 at 3:19 PM Peter Stephenson <p.w.stephenson@ntlworld.com>
wrote:

> On Wed, 2022-03-02 at 09:44 +0000, Daniel Shahaf wrote:
> > Peter Stephenson wrote on Tue, 01 Mar 2022 10:40 +00:00:
> > Is this testable?  Sorry, haven't got time to write a test myself right
> now.
>
> We could do something like this.
>
> pws
>
> diff --git a/Test/W02jobs.ztst b/Test/W02jobs.ztst
> index b09f2ac62..d52888dd9 100644
> --- a/Test/W02jobs.ztst
> +++ b/Test/W02jobs.ztst
> @@ -144,12 +144,14 @@
>    zpty_start
>    zpty_input 'sleep 3 &'
>    zpty_input 'jobs -r'
> +  zpty_input '(jobs -r)'
>    zpty_input 'print -- -'
>    zpty_input 'jobs -s'
>    zpty_stop
>  0:`jobs -r` and `jobs -s` with running job
>  *>\[1] [0-9]##
>  *>\[1]  + running*sleep*
> +*>\[1]  + running*sleep*
>  *>-
>  *>zsh:*SIGHUPed*
>
> diff --git a/Test/W03jobparameters.ztst b/Test/W03jobparameters.ztst
> new file mode 100644
> index 000000000..474adfaec
> --- /dev/null
> +++ b/Test/W03jobparameters.ztst
> @@ -0,0 +1,49 @@
> +# Tests for interactive job control with parameter state
> +
> +%prep
> +
> +  if zmodload zsh/zpty 2> /dev/null; then
> +    zpty_start() {
> +      export PS1= PS2=
> +      zpty -d
> +      zpty zsh "${(q)ZTST_testdir}/../Src/zsh -fiV +Z"
> +    }
> +    zpty_input() {
> +      zpty -w zsh "${(F)@}" $'\n'
> +    }
> +    zpty_line() {
> +      local REPLY
> +      integer i
> +      for (( i = 0; i < ${1:-1}; ++i )); do
> +        zpty -r zsh REPLY
> +        print -r -- ${REPLY%%($'\r\n'|$'\n')}
> +      done
> +    }
> +    zpty_stop() {
> +      # exit twice in case of check_jobs
> +      zpty -w zsh $'exit\nexit\n'
> +      # zpty gives no output when piped without these braces (?)
> +      { zpty -r zsh } | sed $'/[^[:space:]]/!d; s/\r$//;'
> +      zpty -d
> +      :
> +    }
> +    if ! zmodload zsh/parameter 2> /dev/null; then
> +      ZTST_unimplemented='the zsh/parameter module is not available'
> +    fi
> +  else
> +    ZTST_unimplemented='the zsh/zpty module is not available'
> +  fi
> +
> +%test
> +
> +  zpty_start
> +  zpty_input 'sleep 3 &'
> +  zpty_input 'print $jobstates'
> +  zpty_input '(print $jobstates)'
> +  zpty_input 'jobs -s'
> +  zpty_stop
> +0:$jobstate for running job in main shell and subshell
> +*>\[1] [0-9]##
> +*>running:+:*=running
> +*>running:+:*=running
> +*>zsh:*SIGHUPed*
>
>
>

[-- Attachment #2: Type: text/html, Size: 9050 bytes --]

  reply	other threads:[~2022-03-03 22:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  0:46 Carl Agrell
2022-03-01 10:40 ` Peter Stephenson
2022-03-02  9:44   ` Daniel Shahaf
2022-03-02 20:18     ` Peter Stephenson
2022-03-03 22:04       ` Vin Shelton [this message]
2022-03-03 23:07         ` Bart Schaefer
2022-03-04  2:14           ` Jun T
2022-03-04 13:04             ` Daniel Shahaf
2022-03-04 13:13               ` Vin Shelton
2022-03-06  4:18               ` Jun T
2022-03-07 14:22                 ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACeGjnXXv1eHP5_L3hFUjhvk1WBTQzcVhyf3L-uMV00snJpFUg@mail.gmail.com \
    --to=acs@alumni.princeton.edu \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).