[Top][All Lists]

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

"wait" bug, now or ever?

From: Larry Clapp
Subject: "wait" bug, now or ever?
Date: Fri, 10 Oct 2008 12:47:47 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

Greetings, list,

A coworker of mine scatters "wait" around his code a lot.  I've seen
"wait" after "echo" (and no, he's not waiting on some previously
backgrounded process):

  echo something

He asserts "The wait command waits until a program has *completely*
finished", or words to that effect.

Basically he says he's seen where a program does some redirection,
exits, and the file isn't done yet:

  some_program > some_file
  # some_file isn't finished yet!
  # Now it's done!

I have not cornered him on the exact circumstances in which he's seen
this behavior, but I certainly never have -- but on the other hand,
I've used ksh and zsh my entire career; bash, as such, is new to me.

I'm certainly not gonna say it's impossible ("If it happens, it's
possible!" :), but I would be willing to explore the possibility that
perhaps he misinterpreted what he saw.

Here are my thoughts on this behavior, most likely first:

  - I tend to think he had some code at one point that he didn't
    completely understand (or had forgotten some details of) that was
    running stuff in background and he didn't realize it, and he
    experienced this problem, and the "wait" fixed it, so he's
    scattered "waits" around his scripts ever since.
  - bash had (or has) a bug, possibly only seen when running on
    multi-core machines
  - Linux had/has a similar bug

(Note that I've no idea of the relative likelihood of the last two,
just that, in my estimation, they trail the first one by a large

So anyway, I wanted to enquire whether there was ever a known bug of
this kind in bash or Linux, or whether anyone else has ever observed
this behavior, or if anyone could theorize as to a possible cause?
(For example in zsh, if you use multios, you could see something like
this (see multios in zshmisc(1)).  Does bash have a gotcha like this?)

(I also plan to corner him on the exact circumstances of this bug, but
wanted to explore this avenue in parallel.)


-- Larry

reply via email to

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