bug-bash
[Top][All Lists]
Advanced

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

Re: exit status issue


From: Dallas Clement
Subject: Re: exit status issue
Date: Fri, 18 Nov 2011 14:23:54 -0600

On Fri, Nov 18, 2011 at 2:07 PM, Greg Wooledge <address@hidden> wrote:
>> Notice that the child process pid=6747 exits with status 0
>
> Where does it say that?  How are you even invoking strace here?  I don't
> know how to read this output, nor do I know how to reproduce it.

[pid  6747] execve("/bin/touch", ["touch", "/mnt/array1/.accesstest"],
[/* 14 vars */]) = 0

The = 0 at the end is the exit status.

I know it's complicated but this script is run as a daemon.  Was using
strace with -f option to follow through forks, i.e.

strace -f -e execve ./diskmon_exec.sh  start > /mnt/array1/share/strace.txt 2>&1

>> I just upgrade my bash from version 3.21 to 4.2 and I'm still seeing
>> this problem.
>
> Simplify the script, and reproduce the problem with something we can
> actually read and understand.  For example,
>
> #!/bin/bash
> f() {
>  touch /root/nopermission
>  echo "\$? is $?"
> }
> f

> If you can't reproduce the problem in the simpler script, then you know
> the problem is being triggered by something in the more complex script.
> That will help you narrow down the cause.
>

Yes, I agree this is the right way to approach it.  However, I have
not been able to reproduce the problem with a simple function as you
have shown.  It is almost definitely interaction with the rest of what
is going on in the complicated script.  In fact, as I comment out
portions of it, the problem goes away.  But I can't put my finger on
any one thing that is the root cause.  It feels like something is
getting clobbered in the execution context.  This failure does not
happen every time this function is executed.  It is very hit and miss.

Currently I am running bash -x to see if I can get it to happen that way.



reply via email to

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