[yocto] [PATCH][opkg-utils] opkg-build: Exit when fail to list files.

Aníbal Limón anibal.limon at linux.intel.com
Fri Apr 1 07:50:49 PDT 2016


Hi,

Comments below,

	alimon


On 03/31/2016 11:26 PM, Mike Looijmans wrote:
> On 31-03-16 23:27, Aníbal Limón wrote:
>> We have an issue when ls segfaults in some cases [1] so it's
>> better to detect the failure at this level instead of continue
>> the build process.
>>
>> [YOCTO #8926]
>>
>> [1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=8926#c0
>>
>> Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
>> ---
>>   opkg-build | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/opkg-build b/opkg-build
>> index 98008b6..a9ccad2 100755
>> --- a/opkg-build
>> +++ b/opkg-build
>> @@ -53,6 +53,10 @@ pkg_appears_sane() {
>>           echo "*** Warning: The following files have names ending in
>> '~'.
>>   You probably want to remove them: " >&2
>>           ls -ld $tilde_files
>> +        if [ $? -ne 0 ]; then
> 
> Instead of using $? you could just use the result of "ls" directly, i.e.:

Do you have any specific reason for not use $? variable?, for me is more
simple to test the exit status in this way.

> 
> if ! ls -ld $tilde_files; then
> 
> 
>> +            echo "*** Error: Fail to list files have names ending in
>> '~'."
>> +            exit 1
>> +        fi
>>           echo >&2
>>           else
>>           echo "*** Removing the following files: $tilde_files"
>> @@ -66,6 +70,10 @@ You probably want to remove them: " >&2
>>           echo "*** Warning: The following files have a UID greater
>> than 99.
>>   You probably want to chown these to a system user: " >&2
>>           ls -ld $large_uid_files
>> +        if [ $? -ne 0 ]; then
>> +            echo "*** Error: Fail to list files have a UID greater
>> than 99."
>> +            exit 1
>> +        fi
>>           echo >&2
>>       fi
>>      
>>
> 
> 
> 
> Kind regards,
> 
> Mike Looijmans
> System Expert
> 
> TOPIC Embedded Products
> Eindhovenseweg 32-C, NL-5683 KH Best
> Postbus 440, NL-5680 AK Best
> Telefoon: +31 (0) 499 33 69 79
> E-mail: mike.looijmans at topicproducts.com
> Website: www.topicproducts.com
> 
> Please consider the environment before printing this e-mail
> 
> 
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160401/6861da49/attachment.pgp>


More information about the yocto mailing list