All of lore.kernel.org
 help / color / mirror / Atom feed
* dash 0.5.11.2: somehow falsely waits
@ 2020-12-20  1:43 Steffen Nurpmeso
  2020-12-21 19:36 ` Steffen Nurpmeso
  2021-01-06  4:47 ` Herbert Xu
  0 siblings, 2 replies; 9+ messages in thread
From: Steffen Nurpmeso @ 2020-12-20  1:43 UTC (permalink / raw)
  To: DASH shell mailing list

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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dash 0.5.11.2: somehow falsely waits
  2020-12-20  1:43 dash 0.5.11.2: somehow falsely waits Steffen Nurpmeso
@ 2020-12-21 19:36 ` Steffen Nurpmeso
  2020-12-21 19:58   ` Steffen Nurpmeso
  2021-01-06  4:47 ` Herbert Xu
  1 sibling, 1 reply; 9+ messages in thread
From: Steffen Nurpmeso @ 2020-12-21 19:36 UTC (permalink / raw)
  To: DASH shell mailing list

Hello on a Monday.

Steffen Nurpmeso wrote in
 <20201220014300.8lXtI%steffen@sdaoden.eu>:
 |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}
 |         sleeper=
 |         [ "${int}${hot}" = 01 ] && kill -USR1 ${parent} >/dev/null 2>&1
 |      done
 |   ) </dev/null & #>/dev/null 2>&1 &
 |   JOBREAPER=${!}

What seems to work absolutely reliable on Linux is

   i=
   trap 'i=1' USR1 # "reaper (actually a notify timer only) is up"
   (
      parent=${$}
      sleeper=
      trap '' EXIT HUP QUIT CHLD
      trap 'exit 0' INT
      trap '
         (
            trap 'exit 1' TERM
            /bin/sleep ${JOBWAIT}
            kill -USR1 ${parent} >/dev/null 2>&1
         ) </dev/null &
         sleeper=${!}
      ' USR1
      trap '
         [ -n "${sleeper}" ] && kill -TERM ${sleeper} >/dev/null 2>&1
         sleeper=
      ' 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
         sleep >/dev/null 2>&1
      done
   ) </dev/null & #>/dev/null 2>&1 &
   JOBREAPER=${!}

Unfortunately this causes all sorts of trouble on a lot of other
shells on Solaris at least, with and without backgrounding the
sleeper and waiting on it in the USR1 trap.

--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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dash 0.5.11.2: somehow falsely waits
  2020-12-21 19:36 ` Steffen Nurpmeso
@ 2020-12-21 19:58   ` Steffen Nurpmeso
  0 siblings, 0 replies; 9+ messages in thread
From: Steffen Nurpmeso @ 2020-12-21 19:58 UTC (permalink / raw)
  To: DASH shell mailing list

one more note..

Steffen Nurpmeso wrote in
 <20201221193621.eKxnM%steffen@sdaoden.eu>:
 |Steffen Nurpmeso wrote in
 | <20201220014300.8lXtI%steffen@sdaoden.eu>:
 ||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

I seem to get a hundred percent reliability when i insert a

         </dev/null ${cat} >/dev/null

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

Hope that helps, ciao!

--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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dash 0.5.11.2: somehow falsely waits
  2020-12-20  1:43 dash 0.5.11.2: somehow falsely waits Steffen Nurpmeso
  2020-12-21 19:36 ` Steffen Nurpmeso
@ 2021-01-06  4:47 ` Herbert Xu
  2021-01-06 20:44   ` Steffen Nurpmeso
  1 sibling, 1 reply; 9+ messages in thread
From: Herbert Xu @ 2021-01-06  4:47 UTC (permalink / raw)
  To: Steffen Nurpmeso; +Cc: dash

Steffen Nurpmeso <steffen@sdaoden.eu> wrote:
> 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.

Can you please retest with 6359d7aa739b9f02f622805f4dbddeaf0ae61981?

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dash 0.5.11.2: somehow falsely waits
  2021-01-06  4:47 ` Herbert Xu
@ 2021-01-06 20:44   ` Steffen Nurpmeso
  2021-01-07  2:50     ` Herbert Xu
  0 siblings, 1 reply; 9+ messages in thread
From: Steffen Nurpmeso @ 2021-01-06 20:44 UTC (permalink / raw)
  To: Herbert Xu; +Cc: dash

Hello.

Herbert Xu wrote in
 <20210106044708.GA28288@gondor.apana.org.au>:
 |Steffen Nurpmeso <steffen@sdaoden.eu> wrote:
 |> 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.
 |
 |Can you please retest with 6359d7aa739b9f02f622805f4dbddeaf0ae61981?

It works fine with the patch from the other message (repository at
kernel.org does not know about the commit).

Thanks for fixing,

--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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dash 0.5.11.2: somehow falsely waits
  2021-01-06 20:44   ` Steffen Nurpmeso
@ 2021-01-07  2:50     ` Herbert Xu
  2021-01-07 19:00       ` Steffen Nurpmeso
  0 siblings, 1 reply; 9+ messages in thread
From: Herbert Xu @ 2021-01-07  2:50 UTC (permalink / raw)
  To: Steffen Nurpmeso; +Cc: dash

Steffen Nurpmeso <steffen@sdaoden.eu> wrote:
>
> |Can you please retest with 6359d7aa739b9f02f622805f4dbddeaf0ae61981?
> 
> It works fine with the patch from the other message (repository at
> kernel.org does not know about the commit).

Thanks for confirming.  It's strange that you can't find the
commit though because it appears to be there:

https://git.kernel.org/pub/scm/utils/dash/dash.git/commit/?id=6359d7aa739b9f02f622805f4dbddeaf0ae61981

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dash 0.5.11.2: somehow falsely waits
  2021-01-07  2:50     ` Herbert Xu
@ 2021-01-07 19:00       ` Steffen Nurpmeso
  2021-01-07 21:07         ` Herbert Xu
  0 siblings, 1 reply; 9+ messages in thread
From: Steffen Nurpmeso @ 2021-01-07 19:00 UTC (permalink / raw)
  To: Herbert Xu; +Cc: dash

Herbert Xu wrote in
 <20210107025037.GA376@gondor.apana.org.au>:
 |Steffen Nurpmeso <steffen@sdaoden.eu> wrote:
 |>
 |>|Can you please retest with 6359d7aa739b9f02f622805f4dbddeaf0ae61981?
 |> 
 |> It works fine with the patch from the other message (repository at
 |> kernel.org does not know about the commit).
 |
 |Thanks for confirming.  It's strange that you can't find the
 |commit though because it appears to be there:
 |
 |https://git.kernel.org/pub/scm/utils/dash/dash.git/commit/?id=6359d7aa73\
 |9b9f02f622805f4dbddeaf0ae61981

Oh yes, that i have and used, plus the patch.  It seems i implied
that you referred to a new commit with the sigblock code .. which
you were not.

--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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dash 0.5.11.2: somehow falsely waits
  2021-01-07 19:00       ` Steffen Nurpmeso
@ 2021-01-07 21:07         ` Herbert Xu
  2021-01-07 21:48           ` Steffen Nurpmeso
  0 siblings, 1 reply; 9+ messages in thread
From: Herbert Xu @ 2021-01-07 21:07 UTC (permalink / raw)
  To: Steffen Nurpmeso; +Cc: dash

On Thu, Jan 07, 2021 at 08:00:18PM +0100, Steffen Nurpmeso wrote:
>
> Oh yes, that i have and used, plus the patch.  It seems i implied
> that you referred to a new commit with the sigblock code .. which
> you were not.

The new patch hasn't been merged yet.  You can track its status
through patchwork at:

https://patchwork.kernel.org/project/dash/list/

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dash 0.5.11.2: somehow falsely waits
  2021-01-07 21:07         ` Herbert Xu
@ 2021-01-07 21:48           ` Steffen Nurpmeso
  0 siblings, 0 replies; 9+ messages in thread
From: Steffen Nurpmeso @ 2021-01-07 21:48 UTC (permalink / raw)
  To: Herbert Xu; +Cc: dash

Herbert Xu wrote in
 <20210107210712.GA3821@gondor.apana.org.au>:
 |On Thu, Jan 07, 2021 at 08:00:18PM +0100, Steffen Nurpmeso wrote:
 |>
 |> Oh yes, that i have and used, plus the patch.  It seems i implied
 |> that you referred to a new commit with the sigblock code .. which
 |> you were not.
 |
 |The new patch hasn't been merged yet.  You can track its status
 |through patchwork at:
 |
 |https://patchwork.kernel.org/project/dash/list/

Thanks.

--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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-01-07 21:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-20  1:43 dash 0.5.11.2: somehow falsely waits Steffen Nurpmeso
2020-12-21 19:36 ` Steffen Nurpmeso
2020-12-21 19:58   ` Steffen Nurpmeso
2021-01-06  4:47 ` Herbert Xu
2021-01-06 20:44   ` Steffen Nurpmeso
2021-01-07  2:50     ` Herbert Xu
2021-01-07 19:00       ` Steffen Nurpmeso
2021-01-07 21:07         ` Herbert Xu
2021-01-07 21:48           ` Steffen Nurpmeso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.