All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nettle: fix ptest failure
@ 2019-04-12  3:27 mingli.yu
  2019-04-12 21:57 ` Richard Purdie
  0 siblings, 1 reply; 18+ messages in thread
From: mingli.yu @ 2019-04-12  3:27 UTC (permalink / raw)
  To: openembedded-core

From: Mingli Yu <Mingli.Yu@windriver.com>

Remove dlopen-test.patch which originally used
to fix the test dlopen-test, but autually the
patch didn't resolve the issue as dlopen-test.patch
supposes the file /usr/lib/libnettle.so exists.
Instead deploy ${D}${PTEST_PATH}/libnettle.so to
fix the dlopen-test failure.

Update the initialization for the salt to fix
below Segmentation fault and also nettle-pbkdf2-test
failure.
 # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
 [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip 00007f3332256998 sp 00007fff60d44410 error 4 in libnettle.so.6.5[7f3332244000+1d00]
 [65534.887525] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9 68 ff f
 Segmentation fault

Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
 ...kdf2.c-change-the-initialization-for-salt.patch | 39 ++++++++++++++++++++++
 .../nettle/nettle-3.4.1/dlopen-test.patch          | 20 -----------
 meta/recipes-support/nettle/nettle_3.4.1.bb        |  9 ++---
 3 files changed, 44 insertions(+), 24 deletions(-)
 create mode 100644 meta/recipes-support/nettle/nettle-3.4.1/0001-nettle-pbkdf2.c-change-the-initialization-for-salt.patch
 delete mode 100644 meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch

diff --git a/meta/recipes-support/nettle/nettle-3.4.1/0001-nettle-pbkdf2.c-change-the-initialization-for-salt.patch b/meta/recipes-support/nettle/nettle-3.4.1/0001-nettle-pbkdf2.c-change-the-initialization-for-salt.patch
new file mode 100644
index 0000000..713823e
--- /dev/null
+++ b/meta/recipes-support/nettle/nettle-3.4.1/0001-nettle-pbkdf2.c-change-the-initialization-for-salt.patch
@@ -0,0 +1,39 @@
+From 7510ee2877368464ecce7de515ce056e08c75245 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <Mingli.Yu@windriver.com>
+Date: Fri, 12 Apr 2019 10:30:14 +0800
+Subject: [PATCH] nettle-pbkdf2.c: change the initialization for salt
+
+use malloc and strncpy altogether to replace
+strdup for salt initialization to fix below
+Segmentation fault:
+ # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
+ [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip 00007f3332256998 sp 00007fff60d44410 error 4 in libnettle.so.6.5[7f3332244000+1d00]
+ [65534.887525] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9 68 ff f
+ Segmentation fault
+
+Upstream-Status: Submitted[http://lists.lysator.liu.se/pipermail/nettle-bugs/2019/007467.html]
+
+Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
+---
+ tools/nettle-pbkdf2.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/tools/nettle-pbkdf2.c b/tools/nettle-pbkdf2.c
+index 1f0a301..000acd3 100644
+--- a/tools/nettle-pbkdf2.c
++++ b/tools/nettle-pbkdf2.c
+@@ -141,7 +141,10 @@ main (int argc, char **argv)
+       return EXIT_FAILURE;
+     }
+ 
+-  salt = strdup (argv[0]);
++  salt = malloc (strlen(argv[0]) + 1);
++  if (! salt)
++     die ("Failed to allocate memory for salt\n");
++  strncpy(salt, argv[0], sizeof(salt) - 1);
+   salt_length = strlen(argv[0]);
+   
+   if (hex_salt)
+-- 
+2.7.4
+
diff --git a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch b/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
deleted file mode 100644
index c4f0b7e..0000000
--- a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Replace relative path of libnettle.so with absolute path so the test
-program can find it.
-Relative paths are not suitable, as the folder strucure for ptest
-is different from the one expected by the nettle testsuite.
-
-Upstream-Status: Inappropriate [embedded specific]
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
---- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000 -0700
-+++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860 -0700
-@@ -9,7 +9,7 @@
- main (int argc UNUSED, char **argv UNUSED)
- {
- #if HAVE_LIBDL
--  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
-+  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
-   int (*get_version)(void);
-   if (!handle)
-     {
diff --git a/meta/recipes-support/nettle/nettle_3.4.1.bb b/meta/recipes-support/nettle/nettle_3.4.1.bb
index dd49c30..612e058 100644
--- a/meta/recipes-support/nettle/nettle_3.4.1.bb
+++ b/meta/recipes-support/nettle/nettle_3.4.1.bb
@@ -14,12 +14,9 @@ SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
            file://Add-target-to-only-build-tests-not-run-them.patch \
            file://run-ptest \
            file://check-header-files-of-openssl-only-if-enable_.patch \
+           file://0001-nettle-pbkdf2.c-change-the-initialization-for-salt.patch \
            "
 
-SRC_URI_append_class-target = "\
-            file://dlopen-test.patch \
-            "
-
 SRC_URI[md5sum] = "9bdebb0e2f638d3b9d91f7fc264b70c1"
 SRC_URI[sha256sum] = "f941cf1535cd5d1819be5ccae5babef01f6db611f9b5a777bae9c7604b8a92ad"
 
@@ -47,6 +44,10 @@ do_install_ptest() {
         # tools can be found in PATH, not in ../tools/
         sed -i -e 's|../tools/||' ${D}${PTEST_PATH}/testsuite/*-test
         install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
+        # libnettle.so is needed for dlopen-test
+        if [ -f ${D}${libdir}/libnettle.so.6.* ]; then
+            cp ${D}${libdir}/libnettle.so.6.* ${D}${PTEST_PATH}/libnettle.so
+        fi
 }
 
 BBCLASSEXTEND = "native nativesdk"
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] nettle: fix ptest failure
  2019-04-12  3:27 [PATCH] nettle: fix ptest failure mingli.yu
@ 2019-04-12 21:57 ` Richard Purdie
  2019-04-15  2:10   ` Yu, Mingli
  2019-04-15  7:40   ` [PATCH v2] " mingli.yu
  0 siblings, 2 replies; 18+ messages in thread
From: Richard Purdie @ 2019-04-12 21:57 UTC (permalink / raw)
  To: mingli.yu, openembedded-core

On Fri, 2019-04-12 at 11:27 +0800, mingli.yu@windriver.com wrote:
> From: Mingli Yu <Mingli.Yu@windriver.com>
> 
> Remove dlopen-test.patch which originally used
> to fix the test dlopen-test, but autually the
> patch didn't resolve the issue as dlopen-test.patch
> supposes the file /usr/lib/libnettle.so exists.
> Instead deploy ${D}${PTEST_PATH}/libnettle.so to
> fix the dlopen-test failure.
> 
> Update the initialization for the salt to fix
> below Segmentation fault and also nettle-pbkdf2-test
> failure.
>  # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
>  [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip
> 00007f3332256998 sp 00007fff60d44410 error 4 in
> libnettle.so.6.5[7f3332244000+1d00]
>  [65534.887525] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d 41
> 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9 68
> ff f
>  Segmentation fault
> 
> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
> ---
>  ...kdf2.c-change-the-initialization-for-salt.patch | 39
> ++++++++++++++++++++++
>  .../nettle/nettle-3.4.1/dlopen-test.patch          | 20 -----------
>  meta/recipes-support/nettle/nettle_3.4.1.bb        |  9 ++---
>  3 files changed, 44 insertions(+), 24 deletions(-)
>  create mode 100644 meta/recipes-support/nettle/nettle-3.4.1/0001-
> nettle-pbkdf2.c-change-the-initialization-for-salt.patch
>  delete mode 100644 meta/recipes-support/nettle/nettle-3.4.1/dlopen-
> test.patch
> 
> diff --git a/meta/recipes-support/nettle/nettle-3.4.1/0001-nettle-
> pbkdf2.c-change-the-initialization-for-salt.patch b/meta/recipes-
> support/nettle/nettle-3.4.1/0001-nettle-pbkdf2.c-change-the-
> initialization-for-salt.patch
> new file mode 100644
> index 0000000..713823e
> --- /dev/null
> +++ b/meta/recipes-support/nettle/nettle-3.4.1/0001-nettle-pbkdf2.c-
> change-the-initialization-for-salt.patch
> @@ -0,0 +1,39 @@
> +From 7510ee2877368464ecce7de515ce056e08c75245 Mon Sep 17 00:00:00
> 2001
> +From: Mingli Yu <Mingli.Yu@windriver.com>
> +Date: Fri, 12 Apr 2019 10:30:14 +0800
> +Subject: [PATCH] nettle-pbkdf2.c: change the initialization for salt
> +
> +use malloc and strncpy altogether to replace
> +strdup for salt initialization to fix below
> +Segmentation fault:
> + # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
> + [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip
> 00007f3332256998 sp 00007fff60d44410 error 4 in
> libnettle.so.6.5[7f3332244000+1d00]
> + [65534.887525] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d
> 41 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9
> 68 ff f
> + Segmentation fault
> +
> +Upstream-Status: Submitted[
> http://lists.lysator.liu.se/pipermail/nettle-bugs/2019/007467.html]
> +
> +Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
> +---
> + tools/nettle-pbkdf2.c | 5 ++++-
> + 1 file changed, 4 insertions(+), 1 deletion(-)
> +
> +diff --git a/tools/nettle-pbkdf2.c b/tools/nettle-pbkdf2.c
> +index 1f0a301..000acd3 100644
> +--- a/tools/nettle-pbkdf2.c
> ++++ b/tools/nettle-pbkdf2.c
> +@@ -141,7 +141,10 @@ main (int argc, char **argv)
> +       return EXIT_FAILURE;
> +     }
> + 
> +-  salt = strdup (argv[0]);
> ++  salt = malloc (strlen(argv[0]) + 1);
> ++  if (! salt)
> ++     die ("Failed to allocate memory for salt\n");
> ++  strncpy(salt, argv[0], sizeof(salt) - 1);
> +   salt_length = strlen(argv[0]);
> +   
> +   if (hex_salt)
> +-- 
> +2.7.4
> +
> diff --git a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-
> test.patch b/meta/recipes-support/nettle/nettle-3.4.1/dlopen-
> test.patch
> deleted file mode 100644
> index c4f0b7e..0000000
> --- a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -Replace relative path of libnettle.so with absolute path so the test
> -program can find it.
> -Relative paths are not suitable, as the folder strucure for ptest
> -is different from the one expected by the nettle testsuite.
> -
> -Upstream-Status: Inappropriate [embedded specific]
> -
> -Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
> -
> ---- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000
> -0700
> -+++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860
> -0700
> -@@ -9,7 +9,7 @@
> - main (int argc UNUSED, char **argv UNUSED)
> - {
> - #if HAVE_LIBDL
> --  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
> -+  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
> -   int (*get_version)(void);
> -   if (!handle)
> -     {
> diff --git a/meta/recipes-support/nettle/nettle_3.4.1.bb
> b/meta/recipes-support/nettle/nettle_3.4.1.bb
> index dd49c30..612e058 100644
> --- a/meta/recipes-support/nettle/nettle_3.4.1.bb
> +++ b/meta/recipes-support/nettle/nettle_3.4.1.bb
> @@ -14,12 +14,9 @@ SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
>             file://Add-target-to-only-build-tests-not-run-them.patch
> \
>             file://run-ptest \
>             file://check-header-files-of-openssl-only-if-
> enable_.patch \
> +           file://0001-nettle-pbkdf2.c-change-the-initialization-
> for-salt.patch \
>             "
>  
> -SRC_URI_append_class-target = "\
> -            file://dlopen-test.patch \
> -            "
> -
>  SRC_URI[md5sum] = "9bdebb0e2f638d3b9d91f7fc264b70c1"
>  SRC_URI[sha256sum] =
> "f941cf1535cd5d1819be5ccae5babef01f6db611f9b5a777bae9c7604b8a92ad"
>  
> @@ -47,6 +44,10 @@ do_install_ptest() {
>          # tools can be found in PATH, not in ../tools/
>          sed -i -e 's|../tools/||' ${D}${PTEST_PATH}/testsuite/*-test
>          install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
> +        # libnettle.so is needed for dlopen-test
> +        if [ -f ${D}${libdir}/libnettle.so.6.* ]; then
> +            cp ${D}${libdir}/libnettle.so.6.*
> ${D}${PTEST_PATH}/libnettle.so
> +        fi
>  }
>  
>  BBCLASSEXTEND = "native nativesdk"

This commit has multiple issues. Firstly upstream rejected the patch.
Secondly adding in this library like this has caused nettle-ptest to
provide the SONAME which then led to nettle-ptest being included in
various images, e.g.:

http://git.yoctoproject.org/cgit.cgi/poky-buildhistory/tree/images/qemux86/glibc/core-image-sato/installed-package-names.txt?h=poky/warrior/qemux86#n604

which then led to nettle being spread all over the 2.7 rc1 QA report:

https://autobuilder.yocto.io/pub/releases/yocto-2.7.rc1/testresults/testresult-report.txt

I'm going to revert this.

Cheers,

Richard



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] nettle: fix ptest failure
  2019-04-12 21:57 ` Richard Purdie
@ 2019-04-15  2:10   ` Yu, Mingli
  2019-04-15  7:40   ` [PATCH v2] " mingli.yu
  1 sibling, 0 replies; 18+ messages in thread
From: Yu, Mingli @ 2019-04-15  2:10 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core



On 2019年04月13日 05:57, Richard Purdie wrote:
> On Fri, 2019-04-12 at 11:27 +0800, mingli.yu@windriver.com wrote:
>> From: Mingli Yu <Mingli.Yu@windriver.com>
>>
>> Remove dlopen-test.patch which originally used
>> to fix the test dlopen-test, but autually the
>> patch didn't resolve the issue as dlopen-test.patch
>> supposes the file /usr/lib/libnettle.so exists.
>> Instead deploy ${D}${PTEST_PATH}/libnettle.so to
>> fix the dlopen-test failure.
>>
>> Update the initialization for the salt to fix
>> below Segmentation fault and also nettle-pbkdf2-test
>> failure.
>>   # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
>>   [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip
>> 00007f3332256998 sp 00007fff60d44410 error 4 in
>> libnettle.so.6.5[7f3332244000+1d00]
>>   [65534.887525] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d 41
>> 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9 68
>> ff f
>>   Segmentation fault
>>
>> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
>> ---
>>   ...kdf2.c-change-the-initialization-for-salt.patch | 39
>> ++++++++++++++++++++++
>>   .../nettle/nettle-3.4.1/dlopen-test.patch          | 20 -----------
>>   meta/recipes-support/nettle/nettle_3.4.1.bb        |  9 ++---
>>   3 files changed, 44 insertions(+), 24 deletions(-)
>>   create mode 100644 meta/recipes-support/nettle/nettle-3.4.1/0001-
>> nettle-pbkdf2.c-change-the-initialization-for-salt.patch
>>   delete mode 100644 meta/recipes-support/nettle/nettle-3.4.1/dlopen-
>> test.patch
>>
>> diff --git a/meta/recipes-support/nettle/nettle-3.4.1/0001-nettle-
>> pbkdf2.c-change-the-initialization-for-salt.patch b/meta/recipes-
>> support/nettle/nettle-3.4.1/0001-nettle-pbkdf2.c-change-the-
>> initialization-for-salt.patch
>> new file mode 100644
>> index 0000000..713823e
>> --- /dev/null
>> +++ b/meta/recipes-support/nettle/nettle-3.4.1/0001-nettle-pbkdf2.c-
>> change-the-initialization-for-salt.patch
>> @@ -0,0 +1,39 @@
>> +From 7510ee2877368464ecce7de515ce056e08c75245 Mon Sep 17 00:00:00
>> 2001
>> +From: Mingli Yu <Mingli.Yu@windriver.com>
>> +Date: Fri, 12 Apr 2019 10:30:14 +0800
>> +Subject: [PATCH] nettle-pbkdf2.c: change the initialization for salt
>> +
>> +use malloc and strncpy altogether to replace
>> +strdup for salt initialization to fix below
>> +Segmentation fault:
>> + # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
>> + [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip
>> 00007f3332256998 sp 00007fff60d44410 error 4 in
>> libnettle.so.6.5[7f3332244000+1d00]
>> + [65534.887525] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d
>> 41 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9
>> 68 ff f
>> + Segmentation fault
>> +
>> +Upstream-Status: Submitted[
>> http://lists.lysator.liu.se/pipermail/nettle-bugs/2019/007467.html]
>> +
>> +Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
>> +---
>> + tools/nettle-pbkdf2.c | 5 ++++-
>> + 1 file changed, 4 insertions(+), 1 deletion(-)
>> +
>> +diff --git a/tools/nettle-pbkdf2.c b/tools/nettle-pbkdf2.c
>> +index 1f0a301..000acd3 100644
>> +--- a/tools/nettle-pbkdf2.c
>> ++++ b/tools/nettle-pbkdf2.c
>> +@@ -141,7 +141,10 @@ main (int argc, char **argv)
>> +       return EXIT_FAILURE;
>> +     }
>> +
>> +-  salt = strdup (argv[0]);
>> ++  salt = malloc (strlen(argv[0]) + 1);
>> ++  if (! salt)
>> ++     die ("Failed to allocate memory for salt\n");
>> ++  strncpy(salt, argv[0], sizeof(salt) - 1);
>> +   salt_length = strlen(argv[0]);
>> +
>> +   if (hex_salt)
>> +--
>> +2.7.4
>> +
>> diff --git a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-
>> test.patch b/meta/recipes-support/nettle/nettle-3.4.1/dlopen-
>> test.patch
>> deleted file mode 100644
>> index c4f0b7e..0000000
>> --- a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
>> +++ /dev/null
>> @@ -1,20 +0,0 @@
>> -Replace relative path of libnettle.so with absolute path so the test
>> -program can find it.
>> -Relative paths are not suitable, as the folder strucure for ptest
>> -is different from the one expected by the nettle testsuite.
>> -
>> -Upstream-Status: Inappropriate [embedded specific]
>> -
>> -Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
>> -
>> ---- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000
>> -0700
>> -+++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860
>> -0700
>> -@@ -9,7 +9,7 @@
>> - main (int argc UNUSED, char **argv UNUSED)
>> - {
>> - #if HAVE_LIBDL
>> --  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
>> -+  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
>> -   int (*get_version)(void);
>> -   if (!handle)
>> -     {
>> diff --git a/meta/recipes-support/nettle/nettle_3.4.1.bb
>> b/meta/recipes-support/nettle/nettle_3.4.1.bb
>> index dd49c30..612e058 100644
>> --- a/meta/recipes-support/nettle/nettle_3.4.1.bb
>> +++ b/meta/recipes-support/nettle/nettle_3.4.1.bb
>> @@ -14,12 +14,9 @@ SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
>>              file://Add-target-to-only-build-tests-not-run-them.patch
>> \
>>              file://run-ptest \
>>              file://check-header-files-of-openssl-only-if-
>> enable_.patch \
>> +           file://0001-nettle-pbkdf2.c-change-the-initialization-
>> for-salt.patch \
>>              "
>>
>> -SRC_URI_append_class-target = "\
>> -            file://dlopen-test.patch \
>> -            "
>> -
>>   SRC_URI[md5sum] = "9bdebb0e2f638d3b9d91f7fc264b70c1"
>>   SRC_URI[sha256sum] =
>> "f941cf1535cd5d1819be5ccae5babef01f6db611f9b5a777bae9c7604b8a92ad"
>>
>> @@ -47,6 +44,10 @@ do_install_ptest() {
>>           # tools can be found in PATH, not in ../tools/
>>           sed -i -e 's|../tools/||' ${D}${PTEST_PATH}/testsuite/*-test
>>           install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
>> +        # libnettle.so is needed for dlopen-test
>> +        if [ -f ${D}${libdir}/libnettle.so.6.* ]; then
>> +            cp ${D}${libdir}/libnettle.so.6.*
>> ${D}${PTEST_PATH}/libnettle.so
>> +        fi
>>   }
>>
>>   BBCLASSEXTEND = "native nativesdk"
>
> This commit has multiple issues. Firstly upstream rejected the patch.

Hi RP,

This patch actually contains two parts to fix two ptest issues 
respectively, the one which is rejected by upstream is used to fix 
Segmentation fault. Anyway, I will check the upstream comments to find 
better solution.

> Secondly adding in this library like this has caused nettle-ptest to
> provide the SONAME which then led to nettle-ptest being included in

And another has added ${D}${PTEST_PATH}/libnettle.so for nettle-ptest to 
fix the below ptest issue. Anyway, I will look into it.
| dlopen failed: ../libnettle.so: cannot open shared object file: No 
such file or directory
| ./run-ptest: line 8:  7607 Aborted                 "./$f"
| FAIL: dlopen-test

> various images, e.g.:
>
> http://git.yoctoproject.org/cgit.cgi/poky-buildhistory/tree/images/qemux86/glibc/core-image-sato/installed-package-names.txt?h=poky/warrior/qemux86#n604
>
> which then led to nettle being spread all over the 2.7 rc1 QA report:
>
> https://autobuilder.yocto.io/pub/releases/yocto-2.7.rc1/testresults/testresult-report.txt
>
> I'm going to revert this.
>
> Cheers,
>
> Richard
>
>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2] nettle: fix ptest failure
  2019-04-12 21:57 ` Richard Purdie
  2019-04-15  2:10   ` Yu, Mingli
@ 2019-04-15  7:40   ` mingli.yu
  2019-04-15  7:59     ` richard.purdie
  1 sibling, 1 reply; 18+ messages in thread
From: mingli.yu @ 2019-04-15  7:40 UTC (permalink / raw)
  To: openembedded-core, richard.purdie

From: Mingli Yu <Mingli.Yu@windriver.com>

Rework dlopen-test.patch to fix below
dlopen-test failure:
 # cd /usr/lib64/nettle/ptest
 # ./run-ptest
 dlopen failed: /usr/lib/libnettle.so: cannot open shared object file: No such file or directory
 ./run-ptest: line 8:  7607 Aborted                 "./$f"
 FAIL: dlopen-test

As the test dlopen-test depends on libnettle.so
which belongs to nettle-dev package, so add it
to rdepends of nettle-ptest.

Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
 .../nettle/nettle-3.4.1/dlopen-test.patch          | 23 +++++++++++++++++++---
 meta/recipes-support/nettle/nettle_3.4.1.bb        |  3 +++
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch b/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
index c4f0b7e..9b075d8 100644
--- a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
+++ b/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
@@ -1,20 +1,37 @@
+From d8140904f51ec8025833e5e7eee732a4a50ed0cf Mon Sep 17 00:00:00 2001
+From: Mingli Yu <Mingli.Yu@windriver.com>
+Date: Mon, 15 Apr 2019 11:16:54 +0800
+Subject: [PATCH] dlopen-test.c: use absolute path
+
 Replace relative path of libnettle.so with absolute path so the test
 program can find it.
+
 Relative paths are not suitable, as the folder strucure for ptest
 is different from the one expected by the nettle testsuite.
 
 Upstream-Status: Inappropriate [embedded specific]
 
 Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
+Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
+---
+ testsuite/dlopen-test.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
 
---- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000 -0700
-+++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860 -0700
-@@ -9,7 +9,7 @@
+diff --git a/testsuite/dlopen-test.c b/testsuite/dlopen-test.c
+index 99d3535..92de9f8 100644
+--- a/testsuite/dlopen-test.c
++++ b/testsuite/dlopen-test.c
+@@ -9,7 +9,9 @@ int
  main (int argc UNUSED, char **argv UNUSED)
  {
  #if HAVE_LIBDL
 -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
 +  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
++  if (!handle)
++     handle = dlopen ("/usr/lib64/libnettle.so", RTLD_NOW);
    int (*get_version)(void);
    if (!handle)
      {
+-- 
+2.7.4
+
diff --git a/meta/recipes-support/nettle/nettle_3.4.1.bb b/meta/recipes-support/nettle/nettle_3.4.1.bb
index dd49c30..131676d 100644
--- a/meta/recipes-support/nettle/nettle_3.4.1.bb
+++ b/meta/recipes-support/nettle/nettle_3.4.1.bb
@@ -49,4 +49,7 @@ do_install_ptest() {
         install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
 }
 
+RDEPENDS_${PN}-ptest += "${PN}-dev"
+INSANE_SKIP_${PN}-ptest += "dev-deps"
+
 BBCLASSEXTEND = "native nativesdk"
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] nettle: fix ptest failure
  2019-04-15  7:40   ` [PATCH v2] " mingli.yu
@ 2019-04-15  7:59     ` richard.purdie
  2019-04-15  8:09       ` Yu, Mingli
  0 siblings, 1 reply; 18+ messages in thread
From: richard.purdie @ 2019-04-15  7:59 UTC (permalink / raw)
  To: mingli.yu, openembedded-core

On Mon, 2019-04-15 at 15:40 +0800, mingli.yu@windriver.com wrote:
> ---- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000
> -0700
> -+++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860
> -0700
> -@@ -9,7 +9,7 @@
> +diff --git a/testsuite/dlopen-test.c b/testsuite/dlopen-test.c
> +index 99d3535..92de9f8 100644
> +--- a/testsuite/dlopen-test.c
> ++++ b/testsuite/dlopen-test.c
> +@@ -9,7 +9,9 @@ int
>   main (int argc UNUSED, char **argv UNUSED)
>   {
>   #if HAVE_LIBDL
>  -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
>  +  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
> ++  if (!handle)
> ++     handle = dlopen ("/usr/lib64/libnettle.so", RTLD_NOW);
>     int (*get_version)(void);
>     if (!handle)
>       {

What happens on a 32 bit system?

You can't hardcode a specific libdir like that!

Cheers,

Richard



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] nettle: fix ptest failure
  2019-04-15  8:09       ` Yu, Mingli
@ 2019-04-15  8:06         ` richard.purdie
  2019-04-15  8:39           ` Adrian Bunk
                             ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: richard.purdie @ 2019-04-15  8:06 UTC (permalink / raw)
  To: Yu, Mingli, openembedded-core

On Mon, 2019-04-15 at 16:09 +0800, Yu, Mingli wrote:
> 
> On 2019年04月15日 15:59, richard.purdie@linuxfoundation.org wrote:
> > On Mon, 2019-04-15 at 15:40 +0800, mingli.yu@windriver.com wrote:
> > > ---- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000
> > > -0700
> > > -+++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860
> > > -0700
> > > -@@ -9,7 +9,7 @@
> > > +diff --git a/testsuite/dlopen-test.c b/testsuite/dlopen-test.c
> > > +index 99d3535..92de9f8 100644
> > > +--- a/testsuite/dlopen-test.c
> > > ++++ b/testsuite/dlopen-test.c
> > > +@@ -9,7 +9,9 @@ int
> > >    main (int argc UNUSED, char **argv UNUSED)
> > >    {
> > >    #if HAVE_LIBDL
> > >   -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
> > >   +  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
> > > ++  if (!handle)
> > > ++     handle = dlopen ("/usr/lib64/libnettle.so", RTLD_NOW);
> > >      int (*get_version)(void);
> > >      if (!handle)
> > >        {
> > 
> > What happens on a 32 bit system?
> > 
> > You can't hardcode a specific libdir like that!
> 
> I just rework the patch dlopen-test.patch which Juro Bystricky
> generated 
> before, the previous patch only check /usr/lib/libnettle.so and I 
> updated it also to check /usr/lib64/libnettle.so if no 
> /usr/lib/libnettle.so exist.
>   -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
>   +  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
> ++  if (!handle)
> ++     handle = dlopen ("/usr/lib64/libnettle.so", RTLD_NOW);

What happens on x32? n32? or if I set libdir to lib32?

Cheers,

Richard





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] nettle: fix ptest failure
  2019-04-15  7:59     ` richard.purdie
@ 2019-04-15  8:09       ` Yu, Mingli
  2019-04-15  8:06         ` richard.purdie
  0 siblings, 1 reply; 18+ messages in thread
From: Yu, Mingli @ 2019-04-15  8:09 UTC (permalink / raw)
  To: richard.purdie, openembedded-core



On 2019年04月15日 15:59, richard.purdie@linuxfoundation.org wrote:
> On Mon, 2019-04-15 at 15:40 +0800, mingli.yu@windriver.com wrote:
>> ---- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000
>> -0700
>> -+++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860
>> -0700
>> -@@ -9,7 +9,7 @@
>> +diff --git a/testsuite/dlopen-test.c b/testsuite/dlopen-test.c
>> +index 99d3535..92de9f8 100644
>> +--- a/testsuite/dlopen-test.c
>> ++++ b/testsuite/dlopen-test.c
>> +@@ -9,7 +9,9 @@ int
>>    main (int argc UNUSED, char **argv UNUSED)
>>    {
>>    #if HAVE_LIBDL
>>   -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
>>   +  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
>> ++  if (!handle)
>> ++     handle = dlopen ("/usr/lib64/libnettle.so", RTLD_NOW);
>>      int (*get_version)(void);
>>      if (!handle)
>>        {
>
> What happens on a 32 bit system?
>
> You can't hardcode a specific libdir like that!

I just rework the patch dlopen-test.patch which Juro Bystricky generated 
before, the previous patch only check /usr/lib/libnettle.so and I 
updated it also to check /usr/lib64/libnettle.so if no 
/usr/lib/libnettle.so exist.
  -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
  +  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
++  if (!handle)
++     handle = dlopen ("/usr/lib64/libnettle.so", RTLD_NOW);


Thanks,

>
> Cheers,
>
> Richard
>
>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] nettle: fix ptest failure
  2019-04-15  8:06         ` richard.purdie
@ 2019-04-15  8:39           ` Adrian Bunk
  2019-04-15  8:43           ` Yu, Mingli
  2019-04-15  9:05           ` [PATCH v3] " mingli.yu
  2 siblings, 0 replies; 18+ messages in thread
From: Adrian Bunk @ 2019-04-15  8:39 UTC (permalink / raw)
  To: richard.purdie; +Cc: openembedded-core

On Mon, Apr 15, 2019 at 09:06:12AM +0100, richard.purdie@linuxfoundation.org wrote:
> On Mon, 2019-04-15 at 16:09 +0800, Yu, Mingli wrote:
> > 
> > On 2019年04月15日 15:59, richard.purdie@linuxfoundation.org wrote:
> > > On Mon, 2019-04-15 at 15:40 +0800, mingli.yu@windriver.com wrote:
> > > > ---- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000
> > > > -0700
> > > > -+++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860
> > > > -0700
> > > > -@@ -9,7 +9,7 @@
> > > > +diff --git a/testsuite/dlopen-test.c b/testsuite/dlopen-test.c
> > > > +index 99d3535..92de9f8 100644
> > > > +--- a/testsuite/dlopen-test.c
> > > > ++++ b/testsuite/dlopen-test.c
> > > > +@@ -9,7 +9,9 @@ int
> > > >    main (int argc UNUSED, char **argv UNUSED)
> > > >    {
> > > >    #if HAVE_LIBDL
> > > >   -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
> > > >   +  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
> > > > ++  if (!handle)
> > > > ++     handle = dlopen ("/usr/lib64/libnettle.so", RTLD_NOW);
> > > >      int (*get_version)(void);
> > > >      if (!handle)
> > > >        {
> > > 
> > > What happens on a 32 bit system?
> > > 
> > > You can't hardcode a specific libdir like that!
> > 
> > I just rework the patch dlopen-test.patch which Juro Bystricky
> > generated 
> > before, the previous patch only check /usr/lib/libnettle.so and I 
> > updated it also to check /usr/lib64/libnettle.so if no 
> > /usr/lib/libnettle.so exist.
> >   -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
> >   +  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
> > ++  if (!handle)
> > ++     handle = dlopen ("/usr/lib64/libnettle.so", RTLD_NOW);
> 
> What happens on x32? n32? or if I set libdir to lib32?

dlopen("libnettle.so", RTLD_NOW) should work,
this uses the normal library search path.

But is it actually worth permanently carrying a patch here?
run-ptest already skips one test for unrelated reasons,
and skipping another one would also be an option.

> Cheers,
> 
> Richard

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] nettle: fix ptest failure
  2019-04-15  8:06         ` richard.purdie
  2019-04-15  8:39           ` Adrian Bunk
@ 2019-04-15  8:43           ` Yu, Mingli
  2019-04-15  9:05           ` [PATCH v3] " mingli.yu
  2 siblings, 0 replies; 18+ messages in thread
From: Yu, Mingli @ 2019-04-15  8:43 UTC (permalink / raw)
  To: richard.purdie, openembedded-core



On 2019年04月15日 16:06, richard.purdie@linuxfoundation.org wrote:
> On Mon, 2019-04-15 at 16:09 +0800, Yu, Mingli wrote:
>>
>> On 2019年04月15日 15:59, richard.purdie@linuxfoundation.org wrote:
>>> On Mon, 2019-04-15 at 15:40 +0800, mingli.yu@windriver.com wrote:
>>>> ---- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000
>>>> -0700
>>>> -+++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860
>>>> -0700
>>>> -@@ -9,7 +9,7 @@
>>>> +diff --git a/testsuite/dlopen-test.c b/testsuite/dlopen-test.c
>>>> +index 99d3535..92de9f8 100644
>>>> +--- a/testsuite/dlopen-test.c
>>>> ++++ b/testsuite/dlopen-test.c
>>>> +@@ -9,7 +9,9 @@ int
>>>>     main (int argc UNUSED, char **argv UNUSED)
>>>>     {
>>>>     #if HAVE_LIBDL
>>>>    -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
>>>>    +  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
>>>> ++  if (!handle)
>>>> ++     handle = dlopen ("/usr/lib64/libnettle.so", RTLD_NOW);
>>>>       int (*get_version)(void);
>>>>       if (!handle)
>>>>         {
>>>
>>> What happens on a 32 bit system?
>>>
>>> You can't hardcode a specific libdir like that!
>>
>> I just rework the patch dlopen-test.patch which Juro Bystricky
>> generated
>> before, the previous patch only check /usr/lib/libnettle.so and I
>> updated it also to check /usr/lib64/libnettle.so if no
>> /usr/lib/libnettle.so exist.
>>    -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
>>    +  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
>> ++  if (!handle)
>> ++     handle = dlopen ("/usr/lib64/libnettle.so", RTLD_NOW);
>
> What happens on x32? n32? or if I set libdir to lib32?

Got it! V3 is coming.

>
> Cheers,
>
> Richard
>
>
>
>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3] nettle: fix ptest failure
  2019-04-15  8:06         ` richard.purdie
  2019-04-15  8:39           ` Adrian Bunk
  2019-04-15  8:43           ` Yu, Mingli
@ 2019-04-15  9:05           ` mingli.yu
  2019-04-15 11:08             ` richard.purdie
  2 siblings, 1 reply; 18+ messages in thread
From: mingli.yu @ 2019-04-15  9:05 UTC (permalink / raw)
  To: openembedded-core, richard.purdie

From: Mingli Yu <Mingli.Yu@windriver.com>

Remove dlopen-test.patch which originally used
to fix the test dlopen-test, but actually it
didn't resolve the issue as expected as it hardcodes
the file /usr/lib/libnettle.so.

Update dynamically with the real ${libdir}/libnettle.so
to fix the below dlopen-test failure:
 # cd /usr/lib64/nettle/ptest
 # ./run-ptest
 dlopen failed: ../libnettle.so: cannot open shared object file: No such file or directory
 ./run-ptest: line 8:  7607 Aborted                 "./$f"
 FAIL: dlopen-test

As the test dlopen-test depends on libnettle.so
which belongs to nettle-dev package, so add it
to rdepends of nettle-ptest.

Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
 .../nettle/nettle-3.4.1/dlopen-test.patch            | 20 --------------------
 meta/recipes-support/nettle/nettle_3.4.1.bb          |  9 +++++----
 2 files changed, 5 insertions(+), 24 deletions(-)
 delete mode 100644 meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch

diff --git a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch b/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
deleted file mode 100644
index c4f0b7e..0000000
--- a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Replace relative path of libnettle.so with absolute path so the test
-program can find it.
-Relative paths are not suitable, as the folder strucure for ptest
-is different from the one expected by the nettle testsuite.
-
-Upstream-Status: Inappropriate [embedded specific]
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-
---- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000 -0700
-+++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860 -0700
-@@ -9,7 +9,7 @@
- main (int argc UNUSED, char **argv UNUSED)
- {
- #if HAVE_LIBDL
--  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
-+  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
-   int (*get_version)(void);
-   if (!handle)
-     {
diff --git a/meta/recipes-support/nettle/nettle_3.4.1.bb b/meta/recipes-support/nettle/nettle_3.4.1.bb
index dd49c30..d6bdd2a 100644
--- a/meta/recipes-support/nettle/nettle_3.4.1.bb
+++ b/meta/recipes-support/nettle/nettle_3.4.1.bb
@@ -16,10 +16,6 @@ SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
            file://check-header-files-of-openssl-only-if-enable_.patch \
            "
 
-SRC_URI_append_class-target = "\
-            file://dlopen-test.patch \
-            "
-
 SRC_URI[md5sum] = "9bdebb0e2f638d3b9d91f7fc264b70c1"
 SRC_URI[sha256sum] = "f941cf1535cd5d1819be5ccae5babef01f6db611f9b5a777bae9c7604b8a92ad"
 
@@ -33,6 +29,8 @@ EXTRA_OECONF = "--disable-openssl"
 CFLAGS_append = " -std=c99"
 
 do_compile_ptest() {
+        # fix dlopen-test failure as cannot locate libnettle.so
+        sed -i 's;dlopen ("../libnettle.so", RTLD_NOW);dlopen ("${libdir}/libnettle.so", RTLD_NOW);g' ${S}/testsuite/dlopen-test.c
         oe_runmake buildtest
 }
 
@@ -49,4 +47,7 @@ do_install_ptest() {
         install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
 }
 
+RDEPENDS_${PN}-ptest += "${PN}-dev"
+INSANE_SKIP_${PN}-ptest += "dev-deps"
+
 BBCLASSEXTEND = "native nativesdk"
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v3] nettle: fix ptest failure
  2019-04-15  9:05           ` [PATCH v3] " mingli.yu
@ 2019-04-15 11:08             ` richard.purdie
  2019-04-16  3:14               ` Yu, Mingli
  0 siblings, 1 reply; 18+ messages in thread
From: richard.purdie @ 2019-04-15 11:08 UTC (permalink / raw)
  To: mingli.yu, openembedded-core

On Mon, 2019-04-15 at 17:05 +0800, mingli.yu@windriver.com wrote:
> @@ -33,6 +29,8 @@ EXTRA_OECONF = "--disable-openssl"
>  CFLAGS_append = " -std=c99"
>  
>  do_compile_ptest() {
> +        # fix dlopen-test failure as cannot locate libnettle.so
> +        sed -i 's;dlopen ("../libnettle.so", RTLD_NOW);dlopen
> ("${libdir}/libnettle.so", RTLD_NOW);g' ${S}/testsuite/dlopen-test.c
>          oe_runmake buildtest
>  }
>  
> @@ -49,4 +47,7 @@ do_install_ptest() {
>          install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
>  }
>  
> +RDEPENDS_${PN}-ptest += "${PN}-dev"
> +INSANE_SKIP_${PN}-ptest += "dev-deps"
> +
>  BBCLASSEXTEND = "native nativesdk"

Does Adrian's suggestion of removing the "../" work? Also, can we
install a symlink in do_install_ptest which this code would find? That
would be less invasive and we could potentially remove the -dev package
dependency which would be good from an image perspective.

Cheers,

Richard



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3] nettle: fix ptest failure
  2019-04-15 11:08             ` richard.purdie
@ 2019-04-16  3:14               ` Yu, Mingli
  2019-04-18  5:30                 ` Yu, Mingli
  0 siblings, 1 reply; 18+ messages in thread
From: Yu, Mingli @ 2019-04-16  3:14 UTC (permalink / raw)
  To: richard.purdie, openembedded-core



On 2019年04月15日 19:08, richard.purdie@linuxfoundation.org wrote:
> On Mon, 2019-04-15 at 17:05 +0800, mingli.yu@windriver.com wrote:
>> @@ -33,6 +29,8 @@ EXTRA_OECONF = "--disable-openssl"
>>   CFLAGS_append = " -std=c99"
>>
>>   do_compile_ptest() {
>> +        # fix dlopen-test failure as cannot locate libnettle.so
>> +        sed -i 's;dlopen ("../libnettle.so", RTLD_NOW);dlopen
>> ("${libdir}/libnettle.so", RTLD_NOW);g' ${S}/testsuite/dlopen-test.c
>>           oe_runmake buildtest
>>   }
>>
>> @@ -49,4 +47,7 @@ do_install_ptest() {
>>           install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
>>   }
>>
>> +RDEPENDS_${PN}-ptest += "${PN}-dev"
>> +INSANE_SKIP_${PN}-ptest += "dev-deps"
>> +
>>   BBCLASSEXTEND = "native nativesdk"
>
> Does Adrian's suggestion of removing the "../" work? Also, can we

Yes, the Adrian's suggestion works. But I think it's also okay to update 
the actual libnettle.so path in do_compile_ptest phase as we still need 
an extra patch if use Adrian's suggestion.

> install a symlink in do_install_ptest which this code would find? That

Install a symlink? Does it means nettle-ptest will provide libnettle.so?
@@ -45,6 +49,7 @@ do_install_ptest() {
          # tools can be found in PATH, not in ../tools/
          sed -i -e 's|../tools/||' ${D}${PTEST_PATH}/testsuite/*-test
          install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
+        ln -s ${libdir}/libnettle.so.6.5 ${D}${PTEST_PATH}/libnettle.so
  }


> would be less invasive and we could potentially remove the -dev package
> dependency which would be good from an image perspective.

Just nettle-ptest rdepends on nettle-dev.

>
> Cheers,
>
> Richard
>
>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3] nettle: fix ptest failure
  2019-04-16  3:14               ` Yu, Mingli
@ 2019-04-18  5:30                 ` Yu, Mingli
  2019-04-24  8:41                   ` [PATCH v4 1/2] nettle: fix the Segmentation fault mingli.yu
  0 siblings, 1 reply; 18+ messages in thread
From: Yu, Mingli @ 2019-04-18  5:30 UTC (permalink / raw)
  To: richard.purdie, openembedded-core

Hi RP,

Any comments here?

Thanks,

On 2019年04月16日 11:14, Yu, Mingli wrote:
>
>
> On 2019年04月15日 19:08, richard.purdie@linuxfoundation.org wrote:
>> On Mon, 2019-04-15 at 17:05 +0800, mingli.yu@windriver.com wrote:
>>> @@ -33,6 +29,8 @@ EXTRA_OECONF = "--disable-openssl"
>>>   CFLAGS_append = " -std=c99"
>>>
>>>   do_compile_ptest() {
>>> +        # fix dlopen-test failure as cannot locate libnettle.so
>>> +        sed -i 's;dlopen ("../libnettle.so", RTLD_NOW);dlopen
>>> ("${libdir}/libnettle.so", RTLD_NOW);g' ${S}/testsuite/dlopen-test.c
>>>           oe_runmake buildtest
>>>   }
>>>
>>> @@ -49,4 +47,7 @@ do_install_ptest() {
>>>           install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
>>>   }
>>>
>>> +RDEPENDS_${PN}-ptest += "${PN}-dev"
>>> +INSANE_SKIP_${PN}-ptest += "dev-deps"
>>> +
>>>   BBCLASSEXTEND = "native nativesdk"
>>
>> Does Adrian's suggestion of removing the "../" work? Also, can we
>
> Yes, the Adrian's suggestion works. But I think it's also okay to update
> the actual libnettle.so path in do_compile_ptest phase as we still need
> an extra patch if use Adrian's suggestion.
>
>> install a symlink in do_install_ptest which this code would find? That
>
> Install a symlink? Does it means nettle-ptest will provide libnettle.so?
> @@ -45,6 +49,7 @@ do_install_ptest() {
>           # tools can be found in PATH, not in ../tools/
>           sed -i -e 's|../tools/||' ${D}${PTEST_PATH}/testsuite/*-test
>           install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
> +        ln -s ${libdir}/libnettle.so.6.5 ${D}${PTEST_PATH}/libnettle.so
>   }
>
>
>> would be less invasive and we could potentially remove the -dev package
>> dependency which would be good from an image perspective.
>
> Just nettle-ptest rdepends on nettle-dev.
>
>>
>> Cheers,
>>
>> Richard
>>
>>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v4 1/2] nettle: fix the Segmentation fault
  2019-04-18  5:30                 ` Yu, Mingli
@ 2019-04-24  8:41                   ` mingli.yu
  2019-04-24  8:41                     ` [PATCH v4 2/2] nettle: fix ptest failure mingli.yu
                                       ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: mingli.yu @ 2019-04-24  8:41 UTC (permalink / raw)
  To: richard.purdie, openembedded-core

From: Mingli Yu <Mingli.Yu@windriver.com>

The commit[8ac8fa8ee1 nettle: update to 3.4.1]
add CFLAGS_append = " -std=c99" to silence the
below error for native build:
| ../nettle-3.4.1/rsa-sign-tr.c: In function 'sec_equal':
| ../nettle-3.4.1/rsa-sign-tr.c:243:3: error: 'for' loop initial declarations are only allowed in C99 mode
   for (size_t i = 0; i < limbs; i++)
   ^
| ../nettle-3.4.1/rsa-sign-tr.c:243:3: note: use option -std=c99 or -std=gnu99 to compile your code
| Makefile:263: recipe for target 'rsa-sign-tr.o' failed

But the above change will trigger below Segmentation
fault:
 # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
 [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip 00007f3332256998 sp 00007fff60d44410 error 4 in libnettle.so.6.5[7f3332244000+1d00]
 [65534.887525] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9 68 ff f
 Segmentation fault

So update the logic to CFLAGS_append = " -std=gnu99"
to fix the issue.

Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
 meta/recipes-support/nettle/nettle_3.4.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-support/nettle/nettle_3.4.1.bb b/meta/recipes-support/nettle/nettle_3.4.1.bb
index dd49c30..8375fcf 100644
--- a/meta/recipes-support/nettle/nettle_3.4.1.bb
+++ b/meta/recipes-support/nettle/nettle_3.4.1.bb
@@ -30,7 +30,7 @@ inherit autotools ptest multilib_header
 EXTRA_AUTORECONF += "--exclude=aclocal"
 
 EXTRA_OECONF = "--disable-openssl"
-CFLAGS_append = " -std=c99"
+CFLAGS_append = " -std=gnu99"
 
 do_compile_ptest() {
         oe_runmake buildtest
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 2/2] nettle: fix ptest failure
  2019-04-24  8:41                   ` [PATCH v4 1/2] nettle: fix the Segmentation fault mingli.yu
@ 2019-04-24  8:41                     ` mingli.yu
  2019-04-24  9:21                     ` [PATCH v4 1/2] nettle: fix the Segmentation fault Adrian Bunk
                                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 18+ messages in thread
From: mingli.yu @ 2019-04-24  8:41 UTC (permalink / raw)
  To: richard.purdie, openembedded-core

From: Mingli Yu <Mingli.Yu@windriver.com>

Rework dlopen-test.patch to fix below
dlopen-test failure:
 # cd /usr/lib64/nettle/ptest
 # ./run-ptest
 dlopen failed: /usr/lib/libnettle.so: cannot open shared object file: No such file or directory
 ./run-ptest: line 8:  7607 Aborted                 "./$f"
 FAIL: dlopen-test

As the test dlopen-test depends on libnettle.so
which belongs to nettle-dev package, so add it
to rdepends of nettle-ptest.

Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
 meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch | 5 +++--
 meta/recipes-support/nettle/nettle_3.4.1.bb                | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch b/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
index c4f0b7e..fea5774 100644
--- a/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
+++ b/meta/recipes-support/nettle/nettle-3.4.1/dlopen-test.patch
@@ -1,4 +1,4 @@
-Replace relative path of libnettle.so with absolute path so the test
+Remove the relative path for libnettle.so so the test
 program can find it.
 Relative paths are not suitable, as the folder strucure for ptest
 is different from the one expected by the nettle testsuite.
@@ -6,6 +6,7 @@ is different from the one expected by the nettle testsuite.
 Upstream-Status: Inappropriate [embedded specific]
 
 Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
+Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
 
 --- a/testsuite/dlopen-test.c	2016-10-01 00:28:38.000000000 -0700
 +++ b/testsuite/dlopen-test.c	2017-10-13 11:08:57.227572860 -0700
@@ -14,7 +15,7 @@ Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
  {
  #if HAVE_LIBDL
 -  void *handle = dlopen ("../libnettle.so", RTLD_NOW);
-+  void *handle = dlopen ("/usr/lib/libnettle.so", RTLD_NOW);
++  void *handle = dlopen ("libnettle.so", RTLD_NOW);
    int (*get_version)(void);
    if (!handle)
      {
diff --git a/meta/recipes-support/nettle/nettle_3.4.1.bb b/meta/recipes-support/nettle/nettle_3.4.1.bb
index 8375fcf..cd8024f 100644
--- a/meta/recipes-support/nettle/nettle_3.4.1.bb
+++ b/meta/recipes-support/nettle/nettle_3.4.1.bb
@@ -49,4 +49,7 @@ do_install_ptest() {
         install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
 }
 
+RDEPENDS_${PN}-ptest += "${PN}-dev"
+INSANE_SKIP_${PN}-ptest += "dev-deps"
+
 BBCLASSEXTEND = "native nativesdk"
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 1/2] nettle: fix the Segmentation fault
  2019-04-24  8:41                   ` [PATCH v4 1/2] nettle: fix the Segmentation fault mingli.yu
  2019-04-24  8:41                     ` [PATCH v4 2/2] nettle: fix ptest failure mingli.yu
@ 2019-04-24  9:21                     ` Adrian Bunk
  2019-04-29  6:48                     ` Yu, Mingli
  2019-05-11  1:27                     ` Khem Raj
  3 siblings, 0 replies; 18+ messages in thread
From: Adrian Bunk @ 2019-04-24  9:21 UTC (permalink / raw)
  To: mingli.yu; +Cc: openembedded-core

On Wed, Apr 24, 2019 at 04:41:00PM +0800, mingli.yu@windriver.com wrote:
> From: Mingli Yu <Mingli.Yu@windriver.com>
> 
> The commit[8ac8fa8ee1 nettle: update to 3.4.1]
> add CFLAGS_append = " -std=c99" to silence the
> below error for native build:
> | ../nettle-3.4.1/rsa-sign-tr.c: In function 'sec_equal':
> | ../nettle-3.4.1/rsa-sign-tr.c:243:3: error: 'for' loop initial declarations are only allowed in C99 mode
>    for (size_t i = 0; i < limbs; i++)
>    ^
> | ../nettle-3.4.1/rsa-sign-tr.c:243:3: note: use option -std=c99 or -std=gnu99 to compile your code
> | Makefile:263: recipe for target 'rsa-sign-tr.o' failed
> 
> But the above change will trigger below Segmentation
> fault:
>  # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
>  [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip 00007f3332256998 sp 00007fff60d44410 error 4 in libnettle.so.6.5[7f3332244000+1d00]
>  [65534.887525] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9 68 ff f
>  Segmentation fault
> 
> So update the logic to CFLAGS_append = " -std=gnu99"
> to fix the issue.
> 
> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
> ---
>  meta/recipes-support/nettle/nettle_3.4.1.bb | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-support/nettle/nettle_3.4.1.bb b/meta/recipes-support/nettle/nettle_3.4.1.bb
> index dd49c30..8375fcf 100644
> --- a/meta/recipes-support/nettle/nettle_3.4.1.bb
> +++ b/meta/recipes-support/nettle/nettle_3.4.1.bb
> @@ -30,7 +30,7 @@ inherit autotools ptest multilib_header
>  EXTRA_AUTORECONF += "--exclude=aclocal"
>  
>  EXTRA_OECONF = "--disable-openssl"
> -CFLAGS_append = " -std=c99"
> +CFLAGS_append = " -std=gnu99"
>...

Nice catch.

Looking at the build log, setting a C mode without GNU extensions 
resulted in

../../nettle-3.4.1/tools/nettle-pbkdf2.c: In function 'main':
../../nettle-3.4.1/tools/nettle-pbkdf2.c:144:10: warning: implicit declaration of function 'strdup'; did you mean 'strcmp'? [-Wimplicit-function-declaration]
   salt = strdup (argv[0]);
          ^~~~~~
          strcmp
../../nettle-3.4.1/tools/nettle-pbkdf2.c:144:10: warning: nested extern declaration of 'strdup' [-Wnested-externs]
../../nettle-3.4.1/tools/nettle-pbkdf2.c:144:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   salt = strdup (argv[0]);
        ^

It is obvious why the resulting code crashed.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 1/2] nettle: fix the Segmentation fault
  2019-04-24  8:41                   ` [PATCH v4 1/2] nettle: fix the Segmentation fault mingli.yu
  2019-04-24  8:41                     ` [PATCH v4 2/2] nettle: fix ptest failure mingli.yu
  2019-04-24  9:21                     ` [PATCH v4 1/2] nettle: fix the Segmentation fault Adrian Bunk
@ 2019-04-29  6:48                     ` Yu, Mingli
  2019-05-11  1:27                     ` Khem Raj
  3 siblings, 0 replies; 18+ messages in thread
From: Yu, Mingli @ 2019-04-29  6:48 UTC (permalink / raw)
  To: richard.purdie, openembedded-core

Ping.

Thanks,

On 2019年04月24日 16:41, mingli.yu@windriver.com wrote:
> From: Mingli Yu <Mingli.Yu@windriver.com>
>
> The commit[8ac8fa8ee1 nettle: update to 3.4.1]
> add CFLAGS_append = " -std=c99" to silence the
> below error for native build:
> | ../nettle-3.4.1/rsa-sign-tr.c: In function 'sec_equal':
> | ../nettle-3.4.1/rsa-sign-tr.c:243:3: error: 'for' loop initial declarations are only allowed in C99 mode
>     for (size_t i = 0; i < limbs; i++)
>     ^
> | ../nettle-3.4.1/rsa-sign-tr.c:243:3: note: use option -std=c99 or -std=gnu99 to compile your code
> | Makefile:263: recipe for target 'rsa-sign-tr.o' failed
>
> But the above change will trigger below Segmentation
> fault:
>   # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
>   [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip 00007f3332256998 sp 00007fff60d44410 error 4 in libnettle.so.6.5[7f3332244000+1d00]
>   [65534.887525] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9 68 ff f
>   Segmentation fault
>
> So update the logic to CFLAGS_append = " -std=gnu99"
> to fix the issue.
>
> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
> ---
>   meta/recipes-support/nettle/nettle_3.4.1.bb | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-support/nettle/nettle_3.4.1.bb b/meta/recipes-support/nettle/nettle_3.4.1.bb
> index dd49c30..8375fcf 100644
> --- a/meta/recipes-support/nettle/nettle_3.4.1.bb
> +++ b/meta/recipes-support/nettle/nettle_3.4.1.bb
> @@ -30,7 +30,7 @@ inherit autotools ptest multilib_header
>   EXTRA_AUTORECONF += "--exclude=aclocal"
>
>   EXTRA_OECONF = "--disable-openssl"
> -CFLAGS_append = " -std=c99"
> +CFLAGS_append = " -std=gnu99"
>
>   do_compile_ptest() {
>           oe_runmake buildtest
>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 1/2] nettle: fix the Segmentation fault
  2019-04-24  8:41                   ` [PATCH v4 1/2] nettle: fix the Segmentation fault mingli.yu
                                       ` (2 preceding siblings ...)
  2019-04-29  6:48                     ` Yu, Mingli
@ 2019-05-11  1:27                     ` Khem Raj
  3 siblings, 0 replies; 18+ messages in thread
From: Khem Raj @ 2019-05-11  1:27 UTC (permalink / raw)
  To: mingli.yu, richard.purdie, openembedded-core



On 4/24/19 1:41 AM, mingli.yu@windriver.com wrote:
> From: Mingli Yu <Mingli.Yu@windriver.com>
> 
> The commit[8ac8fa8ee1 nettle: update to 3.4.1]
> add CFLAGS_append = " -std=c99" to silence the
> below error for native build:
> | ../nettle-3.4.1/rsa-sign-tr.c: In function 'sec_equal':
> | ../nettle-3.4.1/rsa-sign-tr.c:243:3: error: 'for' loop initial declarations are only allowed in C99 mode
>     for (size_t i = 0; i < limbs; i++)
>     ^
> | ../nettle-3.4.1/rsa-sign-tr.c:243:3: note: use option -std=c99 or -std=gnu99 to compile your code
> | Makefile:263: recipe for target 'rsa-sign-tr.o' failed
> 
> But the above change will trigger below Segmentation
> fault:
>   # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
>   [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip 00007f3332256998 sp 00007fff60d44410 error 4 in libnettle.so.6.5[7f3332244000+1d00]
>   [65534.887525] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9 68 ff f
>   Segmentation fault
> 
> So update the logic to CFLAGS_append = " -std=gnu99"
> to fix the issue.
> 
> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
> ---
>   meta/recipes-support/nettle/nettle_3.4.1.bb | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-support/nettle/nettle_3.4.1.bb b/meta/recipes-support/nettle/nettle_3.4.1.bb
> index dd49c30..8375fcf 100644
> --- a/meta/recipes-support/nettle/nettle_3.4.1.bb
> +++ b/meta/recipes-support/nettle/nettle_3.4.1.bb
> @@ -30,7 +30,7 @@ inherit autotools ptest multilib_header
>   EXTRA_AUTORECONF += "--exclude=aclocal"
>   
>   EXTRA_OECONF = "--disable-openssl"
> -CFLAGS_append = " -std=c99"
> +CFLAGS_append = " -std=gnu99"

Is this flag needed for native build on distros using really old gcc ?

then I think we should add it to BUILD_CFLAGS and let default standard 
prevail that gcc/clang selects in target case.

>   
>   do_compile_ptest() {
>           oe_runmake buildtest
> 


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-05-11  1:27 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12  3:27 [PATCH] nettle: fix ptest failure mingli.yu
2019-04-12 21:57 ` Richard Purdie
2019-04-15  2:10   ` Yu, Mingli
2019-04-15  7:40   ` [PATCH v2] " mingli.yu
2019-04-15  7:59     ` richard.purdie
2019-04-15  8:09       ` Yu, Mingli
2019-04-15  8:06         ` richard.purdie
2019-04-15  8:39           ` Adrian Bunk
2019-04-15  8:43           ` Yu, Mingli
2019-04-15  9:05           ` [PATCH v3] " mingli.yu
2019-04-15 11:08             ` richard.purdie
2019-04-16  3:14               ` Yu, Mingli
2019-04-18  5:30                 ` Yu, Mingli
2019-04-24  8:41                   ` [PATCH v4 1/2] nettle: fix the Segmentation fault mingli.yu
2019-04-24  8:41                     ` [PATCH v4 2/2] nettle: fix ptest failure mingli.yu
2019-04-24  9:21                     ` [PATCH v4 1/2] nettle: fix the Segmentation fault Adrian Bunk
2019-04-29  6:48                     ` Yu, Mingli
2019-05-11  1:27                     ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.