* [PATCH] sstate: Fix incorrect return value handling
@ 2014-09-12 15:39 Richard Purdie
2014-09-16 9:00 ` Ming Liu
0 siblings, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2014-09-12 15:39 UTC (permalink / raw)
To: openembedded-core
The use of [ and && here means $? is reset and the exit 1 error
interception wasn't working, leading to "file changed as we read it"
errors from sstate_create_package when heavily using hardlinks.
Fix this by placing $? into a variable.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 0cb5235..1145a63c 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -599,7 +599,8 @@ sstate_create_package () {
if [ "$(ls -A)" ]; then
set +e
tar -czf $TFILE *
- if [ $? -ne 0 ] && [ $? -ne 1 ]; then
+ ret=$?
+ if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then
exit 1
fi
set -e
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] sstate: Fix incorrect return value handling
2014-09-12 15:39 [PATCH] sstate: Fix incorrect return value handling Richard Purdie
@ 2014-09-16 9:00 ` Ming Liu
2014-09-16 9:10 ` Robert Yang
0 siblings, 1 reply; 4+ messages in thread
From: Ming Liu @ 2014-09-16 9:00 UTC (permalink / raw)
To: openembedded-core, Richard Purdie
On 09/12/2014 11:39 PM, Richard Purdie wrote:
> The use of [ and && here means $? is reset and the exit 1 error
> interception wasn't working, leading to "file changed as we read it"
> errors from sstate_create_package when heavily using hardlinks.
>
> Fix this by placing $? into a variable.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 0cb5235..1145a63c 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -599,7 +599,8 @@ sstate_create_package () {
> if [ "$(ls -A)" ]; then
> set +e
> tar -czf $TFILE *
> - if [ $? -ne 0 ] && [ $? -ne 1 ]; then
> + ret=$?
> + if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then
Would changing the line to "if [[ $? -ne 0 && $? -ne 1 ]] " be a
better fix?
the best,
thank you
> exit 1
> fi
> set -e
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] sstate: Fix incorrect return value handling
2014-09-16 9:00 ` Ming Liu
@ 2014-09-16 9:10 ` Robert Yang
2014-09-16 9:15 ` Ming Liu
0 siblings, 1 reply; 4+ messages in thread
From: Robert Yang @ 2014-09-16 9:10 UTC (permalink / raw)
To: Ming Liu, openembedded-core, Richard Purdie
On 09/16/2014 05:00 PM, Ming Liu wrote:
> On 09/12/2014 11:39 PM, Richard Purdie wrote:
>> The use of [ and && here means $? is reset and the exit 1 error
>> interception wasn't working, leading to "file changed as we read it"
>> errors from sstate_create_package when heavily using hardlinks.
>>
>> Fix this by placing $? into a variable.
>>
>> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>>
>> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
>> index 0cb5235..1145a63c 100644
>> --- a/meta/classes/sstate.bbclass
>> +++ b/meta/classes/sstate.bbclass
>> @@ -599,7 +599,8 @@ sstate_create_package () {
>> if [ "$(ls -A)" ]; then
>> set +e
>> tar -czf $TFILE *
>> - if [ $? -ne 0 ] && [ $? -ne 1 ]; then
>> + ret=$?
>> + if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then
> Would changing the line to "if [[ $? -ne 0 && $? -ne 1 ]] " be a better fix?
I'm afraid not, "[[" and "&&" in test are bashism.
// Robert
>
> the best,
> thank you
>> exit 1
>> fi
>> set -e
>>
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] sstate: Fix incorrect return value handling
2014-09-16 9:10 ` Robert Yang
@ 2014-09-16 9:15 ` Ming Liu
0 siblings, 0 replies; 4+ messages in thread
From: Ming Liu @ 2014-09-16 9:15 UTC (permalink / raw)
To: Robert Yang; +Cc: openembedded-core
On 09/16/2014 05:10 PM, Robert Yang wrote:
>
>
> On 09/16/2014 05:00 PM, Ming Liu wrote:
>> On 09/12/2014 11:39 PM, Richard Purdie wrote:
>>> The use of [ and && here means $? is reset and the exit 1 error
>>> interception wasn't working, leading to "file changed as we read it"
>>> errors from sstate_create_package when heavily using hardlinks.
>>>
>>> Fix this by placing $? into a variable.
>>>
>>> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>>>
>>> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
>>> index 0cb5235..1145a63c 100644
>>> --- a/meta/classes/sstate.bbclass
>>> +++ b/meta/classes/sstate.bbclass
>>> @@ -599,7 +599,8 @@ sstate_create_package () {
>>> if [ "$(ls -A)" ]; then
>>> set +e
>>> tar -czf $TFILE *
>>> - if [ $? -ne 0 ] && [ $? -ne 1 ]; then
>>> + ret=$?
>>> + if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then
>> Would changing the line to "if [[ $? -ne 0 && $? -ne 1 ]] " be a
>> better fix?
>
> I'm afraid not, "[[" and "&&" in test are bashism.
Thanks for pointing it out, please ignore my suggestion then, sorry for
the noise.
//Ming Liu
>
> // Robert
>
>>
>> the best,
>> thank you
>>> exit 1
>>> fi
>>> set -e
>>>
>>>
>>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-16 9:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-12 15:39 [PATCH] sstate: Fix incorrect return value handling Richard Purdie
2014-09-16 9:00 ` Ming Liu
2014-09-16 9:10 ` Robert Yang
2014-09-16 9:15 ` Ming Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox