opkg-build: Exit when fail to list files.
PATCH 1/1 opkg-build: Exit when fail to list files.
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
--- opkg-build | 8 ++++++++ 1 file changed, 8 insertions(+)
opkg-build +8 -0
@@ -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 + 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
Signature · 1 line
2.1.4
Quoted 18 lines · Aníbal Limón
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 <[email protected]>--- opkg-build | 8 ++++++++ 1 file changed, 8 insertions(+)opkg-build +0
-0
opkg-build pkg_appears_sane() { · line 56
Quoted 4 lines
opkg-build +1
-0@@ -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.:
if ! ls -ld $tilde_files; then
Quoted 8 lines
opkg-build +3
-0+ echo "*** Error: Fail to list files have names ending in '~'." + exit 1 + fi echo >&2 else echo "*** Removing the following files: $tilde_files"
opkg-build You probably want to remove them: " >&2 · line 79
Quoted 10 lines
opkg-build +4
-0@@ -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: [email protected]
Website: www.topicproducts.com
Please consider the environment before printing this e-mail
Hi,
Comments below,
alimon
Quoted 14 lines · Mike Looijmans
Quoted 13 lines · Aníbal Limón
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 <[email protected]>--- opkg-build | 8 ++++++++ 1 file changed, 8 insertions(+)
Quoted 12 lines
Quoted 10 lines
opkg-build +0
-0@@ -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 ]; thenInstead 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.
Quoted 46 lines
if ! ls -ld $tilde_files; then
Quoted 17 lines
+ echo "*** Error: Fail to list files have names ending in
'~'."opkg-build +2
-0+ 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 greaterthan 99.
You probably want to chown these to a system user: " >&2
ls -ld $large_uid_filesopkg-build +2
-0+ if [ $? -ne 0 ]; then + echo "*** Error: Fail to list files have a UID greaterthan 99."
opkg-build You probably want to remove them: " >&2 · line 78
Quoted 4 lines
opkg-build +2
-0+ exit 1 + fi echo >&2 fiKind regards,
Mike Looijmans
System ExpertTOPIC Embedded Products
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: [email protected]
Website: www.topicproducts.comPlease consider the environment before printing this e-mail
Quoted 35 lines · Aníbal Limón
Hi,
Comments below,
alimon
Quoted 14 lines · Mike Looijmans
Quoted 13 lines · Aníbal Limón
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 <[email protected]>--- opkg-build | 8 ++++++++ 1 file changed, 8 insertions(+)Quoted 12 lines
Quoted 10 lines
opkg-build +0
-0@@ -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 ]; thenInstead of using $? you could just use the result of "ls" directly, i.e.:
Quoted 2 lines
Do you have any specific reason for not use $? variable?, for me is more simple to test the exit status in this way.
Using $? works, but I agree with Mike: I think it's cleaner to directly test the result of ls (and avoids and extra line).
Quoted 23 lines
Quoted 23 lines
if ! ls -ld $tilde_files; then
Quoted 20 lines
+ echo "*** Error: Fail to list files have names ending in
'~'."opkg-build +2
-0+ 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 greaterthan 99.
You probably want to chown these to a system user: " >&2
ls -ld $large_uid_filesopkg-build +2
-0+ if [ $? -ne 0 ]; then + echo "*** Error: Fail to list files have a UID greaterthan 99."
opkg-build +2
-0+ exit 1 + fi echo >&2 fi
Signature · 3 lines
Cheers, Alejandro