dash 0.5.11.2: somehow falsely waits

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

 



Hello.

There is another issue with at least dash (the others not yet
tested).  I cloned the git repo and it is still present at
6ba88b3ed28fb4b52f20b730194c4ad3d8aad037.

With the original test script of what is in "Re: dash 0.5.11.2,
busybox sh 1.32.0, FreeBSD 12.2 sh: spring TTOU but should not
i think" the sleeper will randomly wake too early for whatever
reason.  The sleeper is:

  i=
  trap 'i=1' USR1 # "reaper (actually a notify timer only) is up"
  (
      parent=${$}
      sleeper= int=0 hot=0
      trap '' EXIT HUP QUIT CHLD
      trap 'exit 0' INT
      trap '
         int=1 hot=1
         [ -n "${sleeper}" ] && kill -TERM ${sleeper} >/dev/null 2>&1
      ' USR1
      trap '
         int=1 hot=0
         [ -n "${sleeper}" ] && kill -TERM ${sleeper} >/dev/null 2>&1
      ' USR2
      trap '
         [ -n "${sleeper}" ] && kill -TERM ${sleeper} >/dev/null 2>&1
         echo "Stopping job reaper"
         exit 0
      ' TERM

      # traps are setup, notify parent that we are up and running
      kill -USR1 ${parent} >/dev/null 2>&1

      while :; do
         int=0
         /bin/sleep ${JOBWAIT} &
         sleeper=${!}
         wait ${sleeper}

This wait does not seem to work as it should.
I can run this test on OpenBSD (sh,ksh), NetBSD (sh,ksh), Solaris
(xpg4/sh) and on Linux with bash and i think also mksh and it just
works.  With dash i get things as below.

         sleeper=
         [ "${int}${hot}" = 01 ] && kill -USR1 ${parent} >/dev/null 2>&1
      done
   ) </dev/null & #>/dev/null 2>&1 &
   JOBREAPER=${!}

So with date before+after and a shrunken set of tests look like

  Sun Dec 20 02:36:27 CET 2020
  make[1]: Entering directory '/tmp/.nail/y'
  make[1]: warning: -j4 forced in makefile: resetting jobserver mode.
  Mode: --check, binary: ./s-nail
  Trying to detect UTF-8 locale via /tmp/.nail/y/./s-nail
  Using Unicode locale en_US.utf8
  Job number derived from MAKEFLAGS: 4
  Will do up to 4 tests in parallel, with a 20 second timeout
  Starting job reaper (timeout of 20 seconds)
  .. waiting for job reaper to come up
  ... [1=environ] [2=loptlocenv] [3=macro_param_shift] [4=csop] .. waiting
  SLEEPER USR1
  SLEEPER USR2
  [environ]
  1:ok 2:ok 3:ok 4:ok 5:ok
  !! Timeout: reaped job 1 [environ]
  [loptlocenv]

  !! Timeout: reaped job 2 [loptlocenv]
  [macro_param_shift]
  1:ok
     [Debug/Devel: nullified errors]
     reproducible_build: shift: cannot shift 2 of 1 parameters
     reproducible_build: shift: cannot shift 2 of 1 parameters
  [csop]
  1:ok
  ... [1=eval] [2=X_Y_opt_input_go_stack] [3=X_errexit] [4=Y_errexit] .. waiting
  SLEEPER USR1
  SLEEPER USR2
  [eval]
  1:ok
  [X_Y_opt_input_go_stack]
  1:ok 2:ok 3:ok 4:ok 5:ok 6:ok 7:ok 8:ok 9:ok 10:ok cmdline:ok 11:ok
  [X_errexit]
  1:ok 2:ok 3:ok 4:ok 5:ok 6:ok 7:ok 8:ok 9:ok 10:ok 11:ok 12:ok 13:ok 14:ok
  [Y_errexit]
  1:ok 2:ok 3:ok 4:ok 5:ok 6:ok
  ... [1=S_freeze] [2=f_batch_order] .. waiting
  SLEEPER USR1
  SLEEPER USR2
  [S_freeze]
  1:ok 2:ok 3:ok 4:ok 5:ok 6:ok 7:ok
  [f_batch_order]
  1:ok 2:ok
  Stopping job reaper
  44 tests: 44 ok, 2 failure(s).  0 test(s) skipped
  make[1]: Leaving directory '/tmp/.nail/y'
  Sun Dec 20 02:36:29 CET 2020

Total run time 2 seconds, the sleep was 20 seconds, it should
never have been woken up.  With bash and mksh it just works.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux