Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Nov 2013 22:13:45 -0500
From:      Eitan Adler <lists@eitanadler.com>
To:        Colin Percival <cperciva@freebsd.org>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>, Jilles Tjoelker <jilles@stack.nl>
Subject:   Re: Automated submission of kernel panic reports
Message-ID:  <CAF6rxgm9Ua1CRsN%2B1n6B1nfMAo2sd=A8BH9firkQwLXypSaohw@mail.gmail.com>
In-Reply-To: <52770D8E.2030906@freebsd.org>
References:  <526F8EB3.1040205@freebsd.org> <20131103212950.GA22571@stack.nl> <52770D8E.2030906@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 3, 2013 at 9:59 PM, Colin Percival <cperciva@freebsd.org> wrote:
> On 11/03/13 13:29, Jilles Tjoelker wrote:
>> Some remarks about panicmail:
>>
>>> local tmpfile=`mktemp` || exit 1
>>
>> This kind of thing does not do what you expect. The 'local' utility
>> returns 0 because it successfully created the local variable, ignoring
>> the status from the command substitution. Use
>>   local tmpfile
>>   tmpfile=`mktemp` || exit 1
>> in both occurrences.
>
> Wow, I had no idea.  I guess it never occurred to me that 'local' would
> even *have* an exit status...

It can even exit non-zero:
$ foo() { readonly bar; local bar="f"; echo $?; }; foo;
local: bar: is read only
2



-- 
Eitan Adler



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF6rxgm9Ua1CRsN%2B1n6B1nfMAo2sd=A8BH9firkQwLXypSaohw>