diff mbox series

ldconfig-native: Add usrmerge support

Message ID 20231201105359.409068-1-johannes.pointner@br-automation.com
State New
Headers show
Series ldconfig-native: Add usrmerge support | expand

Commit Message

Johannes Pointner Dec. 1, 2023, 10:53 a.m. UTC
If DISTRO_FEATURE usrmerge is enabled, SLIBDIR is just a symlink to LIBDIR,
therefore don't add SLIBDIR for parsing in this case.

Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
---
 .../ldconfig-add-usrmerge-support.patch       | 37 +++++++++++++++++++
 .../glibc/ldconfig-native_2.12.1.bb           |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch

Comments

Alexandre Belloni Dec. 2, 2023, 3:10 p.m. UTC | #1
Hello,

Please follow https://docs.yoctoproject.org/dev/contributor-guide/submit-changes.html#fixing-your-from-identity

On 01/12/2023 11:53:59+0100, Johannes Pointner via lists.openembedded.org wrote:
> If DISTRO_FEATURE usrmerge is enabled, SLIBDIR is just a symlink to LIBDIR,
> therefore don't add SLIBDIR for parsing in this case.
> 
> Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> ---
>  .../ldconfig-add-usrmerge-support.patch       | 37 +++++++++++++++++++
>  .../glibc/ldconfig-native_2.12.1.bb           |  1 +
>  2 files changed, 38 insertions(+)
>  create mode 100644 meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> 
> diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> new file mode 100644
> index 0000000000..3041d433fd
> --- /dev/null
> +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> @@ -0,0 +1,37 @@
> +From 6e543f39f6bec6eb2e02eea02029c7f4ec533b66 Mon Sep 17 00:00:00 2001
> +From: Johannes Pointner <johannes.pointner@br-automation.com>
> +Date: Fri, 1 Dec 2023 11:02:39 +0100
> +Subject: [PATCH] ldconfig: add usrmerge support
> +
> +Check whether SLIBDIR is a symlink, which is the case if usrmerge
> +is enabled, and if so, ignore it.
> +
> +Upstream-Status: Inappropriate [embedded specific]
> +
> +Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> +---
> + ldconfig.c | 8 +++++++-
> + 1 file changed, 7 insertions(+), 1 deletion(-)
> +
> +diff --git a/ldconfig.c b/ldconfig.c
> +index e826410..72ac67b 100644
> +--- a/ldconfig.c
> ++++ b/ldconfig.c
> +@@ -1371,10 +1371,16 @@ main (int argc, char **argv)
> + 
> +   if (!opt_only_cline)
> +     {
> ++      struct stat buf;
> ++      int ret;
> +       parse_conf (config_file, true);
> + 
> +       /* Always add the standard search paths.  */
> +-      add_system_dir (SLIBDIR);
> ++      /* Check whether SLIBDIR is a symlink, which is the case if usrmerge
> ++       is enabled, and if so, ignore it. */
> ++      ret = lstat(SLIBDIR ,&buf);
> ++      if(ret == -1 || !S_ISLNK(buf.st_mode))
> ++        add_system_dir (SLIBDIR);
> +       if (strcmp (SLIBDIR, LIBDIR))
> + 	add_system_dir (LIBDIR);
> +       add_system_dir (SLIBDIR32);
> diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> index 4db67c3ad4..85fc87257d 100644
> --- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> +++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> @@ -16,6 +16,7 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
>             file://add-64-bit-flag-for-ELF64-entries.patch \
>             file://no-aux-cache.patch \
>             file://add-riscv-support.patch \
> +           file://ldconfig-add-usrmerge-support.patch \
>  "
>  
>  
> -- 
> 2.43.0
> 
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#191566): https://lists.openembedded.org/g/openembedded-core/message/191566
> Mute This Topic: https://lists.openembedded.org/mt/102912756/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexandre Belloni Dec. 2, 2023, 3:13 p.m. UTC | #2
On 01/12/2023 11:53:59+0100, Johannes Pointner via lists.openembedded.org wrote:
> If DISTRO_FEATURE usrmerge is enabled, SLIBDIR is just a symlink to LIBDIR,
> therefore don't add SLIBDIR for parsing in this case.
> 
> Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> ---
>  .../ldconfig-add-usrmerge-support.patch       | 37 +++++++++++++++++++
>  .../glibc/ldconfig-native_2.12.1.bb           |  1 +
>  2 files changed, 38 insertions(+)
>  create mode 100644 meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> 
> diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> new file mode 100644
> index 0000000000..3041d433fd
> --- /dev/null
> +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> @@ -0,0 +1,37 @@
> +From 6e543f39f6bec6eb2e02eea02029c7f4ec533b66 Mon Sep 17 00:00:00 2001
> +From: Johannes Pointner <johannes.pointner@br-automation.com>
> +Date: Fri, 1 Dec 2023 11:02:39 +0100
> +Subject: [PATCH] ldconfig: add usrmerge support
> +
> +Check whether SLIBDIR is a symlink, which is the case if usrmerge
> +is enabled, and if so, ignore it.
> +
> +Upstream-Status: Inappropriate [embedded specific]

I'm not sure how this is embedded specific, why doesn't it affect desktop
distribution that have usrmerge (e.g. Fedora) ?

> +
> +Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> +---
> + ldconfig.c | 8 +++++++-
> + 1 file changed, 7 insertions(+), 1 deletion(-)
> +
> +diff --git a/ldconfig.c b/ldconfig.c
> +index e826410..72ac67b 100644
> +--- a/ldconfig.c
> ++++ b/ldconfig.c
> +@@ -1371,10 +1371,16 @@ main (int argc, char **argv)
> + 
> +   if (!opt_only_cline)
> +     {
> ++      struct stat buf;
> ++      int ret;
> +       parse_conf (config_file, true);
> + 
> +       /* Always add the standard search paths.  */
> +-      add_system_dir (SLIBDIR);
> ++      /* Check whether SLIBDIR is a symlink, which is the case if usrmerge
> ++       is enabled, and if so, ignore it. */
> ++      ret = lstat(SLIBDIR ,&buf);
> ++      if(ret == -1 || !S_ISLNK(buf.st_mode))
> ++        add_system_dir (SLIBDIR);
> +       if (strcmp (SLIBDIR, LIBDIR))
> + 	add_system_dir (LIBDIR);
> +       add_system_dir (SLIBDIR32);
> diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> index 4db67c3ad4..85fc87257d 100644
> --- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> +++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> @@ -16,6 +16,7 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
>             file://add-64-bit-flag-for-ELF64-entries.patch \
>             file://no-aux-cache.patch \
>             file://add-riscv-support.patch \
> +           file://ldconfig-add-usrmerge-support.patch \
>  "
>  
>  
> -- 
> 2.43.0
> 
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#191566): https://lists.openembedded.org/g/openembedded-core/message/191566
> Mute This Topic: https://lists.openembedded.org/mt/102912756/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Johannes Pointner Dec. 4, 2023, 6:53 a.m. UTC | #3
Hello,

On Sat, Dec 2, 2023 at 4:13 PM Alexandre Belloni via
lists.openembedded.org
<alexandre.belloni=bootlin.com@lists.openembedded.org> wrote:
>
> On 01/12/2023 11:53:59+0100, Johannes Pointner via lists.openembedded.org wrote:
> > If DISTRO_FEATURE usrmerge is enabled, SLIBDIR is just a symlink to LIBDIR,
> > therefore don't add SLIBDIR for parsing in this case.
> >
> > Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> > ---
> >  .../ldconfig-add-usrmerge-support.patch       | 37 +++++++++++++++++++
> >  .../glibc/ldconfig-native_2.12.1.bb           |  1 +
> >  2 files changed, 38 insertions(+)
> >  create mode 100644 meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> >
> > diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> > new file mode 100644
> > index 0000000000..3041d433fd
> > --- /dev/null
> > +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> > @@ -0,0 +1,37 @@
> > +From 6e543f39f6bec6eb2e02eea02029c7f4ec533b66 Mon Sep 17 00:00:00 2001
> > +From: Johannes Pointner <johannes.pointner@br-automation.com>
> > +Date: Fri, 1 Dec 2023 11:02:39 +0100
> > +Subject: [PATCH] ldconfig: add usrmerge support
> > +
> > +Check whether SLIBDIR is a symlink, which is the case if usrmerge
> > +is enabled, and if so, ignore it.
> > +
> > +Upstream-Status: Inappropriate [embedded specific]
>
> I'm not sure how this is embedded specific, why doesn't it affect desktop
> distribution that have usrmerge (e.g. Fedora) ?
Because this is just a workaround for the standalone ldconfig-native.
https://lists.openembedded.org/g/openembedded-core/message/191566
I also looked at the reason for the patches that are already used by
ldconfig-native.
But I am open to suggestions, what would you prefer?
>
> > +
> > +Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> > +---
> > + ldconfig.c | 8 +++++++-
> > + 1 file changed, 7 insertions(+), 1 deletion(-)
> > +
> > +diff --git a/ldconfig.c b/ldconfig.c
> > +index e826410..72ac67b 100644
> > +--- a/ldconfig.c
> > ++++ b/ldconfig.c
> > +@@ -1371,10 +1371,16 @@ main (int argc, char **argv)
> > +
> > +   if (!opt_only_cline)
> > +     {
> > ++      struct stat buf;
> > ++      int ret;
> > +       parse_conf (config_file, true);
> > +
> > +       /* Always add the standard search paths.  */
> > +-      add_system_dir (SLIBDIR);
> > ++      /* Check whether SLIBDIR is a symlink, which is the case if usrmerge
> > ++       is enabled, and if so, ignore it. */
> > ++      ret = lstat(SLIBDIR ,&buf);
> > ++      if(ret == -1 || !S_ISLNK(buf.st_mode))
> > ++        add_system_dir (SLIBDIR);
> > +       if (strcmp (SLIBDIR, LIBDIR))
> > +     add_system_dir (LIBDIR);
> > +       add_system_dir (SLIBDIR32);
> > diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> > index 4db67c3ad4..85fc87257d 100644
> > --- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> > +++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> > @@ -16,6 +16,7 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
> >             file://add-64-bit-flag-for-ELF64-entries.patch \
> >             file://no-aux-cache.patch \
> >             file://add-riscv-support.patch \
> > +           file://ldconfig-add-usrmerge-support.patch \
> >  "
> >
> >
> > --
> > 2.43.0
> >
> >
>
> >
> >
> >
>
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#191702): https://lists.openembedded.org/g/openembedded-core/message/191702
> Mute This Topic: https://lists.openembedded.org/mt/102912756/3617353
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [h4nn35.work@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexander Kanavin Dec. 4, 2023, 9:59 a.m. UTC | #4
Generally if you mark something as inappropriate, it's best to write
an extended description of why in the patch. The barrier to adding
patches that we can never upstream is high.

Alex

On Mon, 4 Dec 2023 at 07:53, Johannes Pointner <h4nn35.work@gmail.com> wrote:
>
> Hello,
>
> On Sat, Dec 2, 2023 at 4:13 PM Alexandre Belloni via
> lists.openembedded.org
> <alexandre.belloni=bootlin.com@lists.openembedded.org> wrote:
> >
> > On 01/12/2023 11:53:59+0100, Johannes Pointner via lists.openembedded.org wrote:
> > > If DISTRO_FEATURE usrmerge is enabled, SLIBDIR is just a symlink to LIBDIR,
> > > therefore don't add SLIBDIR for parsing in this case.
> > >
> > > Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> > > ---
> > >  .../ldconfig-add-usrmerge-support.patch       | 37 +++++++++++++++++++
> > >  .../glibc/ldconfig-native_2.12.1.bb           |  1 +
> > >  2 files changed, 38 insertions(+)
> > >  create mode 100644 meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> > >
> > > diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> > > new file mode 100644
> > > index 0000000000..3041d433fd
> > > --- /dev/null
> > > +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> > > @@ -0,0 +1,37 @@
> > > +From 6e543f39f6bec6eb2e02eea02029c7f4ec533b66 Mon Sep 17 00:00:00 2001
> > > +From: Johannes Pointner <johannes.pointner@br-automation.com>
> > > +Date: Fri, 1 Dec 2023 11:02:39 +0100
> > > +Subject: [PATCH] ldconfig: add usrmerge support
> > > +
> > > +Check whether SLIBDIR is a symlink, which is the case if usrmerge
> > > +is enabled, and if so, ignore it.
> > > +
> > > +Upstream-Status: Inappropriate [embedded specific]
> >
> > I'm not sure how this is embedded specific, why doesn't it affect desktop
> > distribution that have usrmerge (e.g. Fedora) ?
> Because this is just a workaround for the standalone ldconfig-native.
> https://lists.openembedded.org/g/openembedded-core/message/191566
> I also looked at the reason for the patches that are already used by
> ldconfig-native.
> But I am open to suggestions, what would you prefer?
> >
> > > +
> > > +Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> > > +---
> > > + ldconfig.c | 8 +++++++-
> > > + 1 file changed, 7 insertions(+), 1 deletion(-)
> > > +
> > > +diff --git a/ldconfig.c b/ldconfig.c
> > > +index e826410..72ac67b 100644
> > > +--- a/ldconfig.c
> > > ++++ b/ldconfig.c
> > > +@@ -1371,10 +1371,16 @@ main (int argc, char **argv)
> > > +
> > > +   if (!opt_only_cline)
> > > +     {
> > > ++      struct stat buf;
> > > ++      int ret;
> > > +       parse_conf (config_file, true);
> > > +
> > > +       /* Always add the standard search paths.  */
> > > +-      add_system_dir (SLIBDIR);
> > > ++      /* Check whether SLIBDIR is a symlink, which is the case if usrmerge
> > > ++       is enabled, and if so, ignore it. */
> > > ++      ret = lstat(SLIBDIR ,&buf);
> > > ++      if(ret == -1 || !S_ISLNK(buf.st_mode))
> > > ++        add_system_dir (SLIBDIR);
> > > +       if (strcmp (SLIBDIR, LIBDIR))
> > > +     add_system_dir (LIBDIR);
> > > +       add_system_dir (SLIBDIR32);
> > > diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> > > index 4db67c3ad4..85fc87257d 100644
> > > --- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> > > +++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> > > @@ -16,6 +16,7 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
> > >             file://add-64-bit-flag-for-ELF64-entries.patch \
> > >             file://no-aux-cache.patch \
> > >             file://add-riscv-support.patch \
> > > +           file://ldconfig-add-usrmerge-support.patch \
> > >  "
> > >
> > >
> > > --
> > > 2.43.0
> > >
> > >
> >
> > >
> > >
> > >
> >
> >
> > --
> > Alexandre Belloni, co-owner and COO, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com
> >
> >
> >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#191722): https://lists.openembedded.org/g/openembedded-core/message/191722
> Mute This Topic: https://lists.openembedded.org/mt/102912756/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Johannes Pointner Dec. 5, 2023, 9:44 a.m. UTC | #5
On Mon, Dec 4, 2023 at 11:00 AM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> Generally if you mark something as inappropriate, it's best to write
> an extended description of why in the patch. The barrier to adding
> patches that we can never upstream is high.
>
Thanks, I understand that, but ldconfig-native seemed very special to me, so
I tried to take an example from the existing patches.

So the next step would be a v2 with a better explanation and obviously a
fixed sendemail.from?
Or are there any other things I should change?

Hannes
> Alex
>
> On Mon, 4 Dec 2023 at 07:53, Johannes Pointner <h4nn35.work@gmail.com> wrote:
> >
> > Hello,
> >
> > On Sat, Dec 2, 2023 at 4:13 PM Alexandre Belloni via
> > lists.openembedded.org
> > <alexandre.belloni=bootlin.com@lists.openembedded.org> wrote:
> > >
> > > On 01/12/2023 11:53:59+0100, Johannes Pointner via lists.openembedded.org wrote:
> > > > If DISTRO_FEATURE usrmerge is enabled, SLIBDIR is just a symlink to LIBDIR,
> > > > therefore don't add SLIBDIR for parsing in this case.
> > > >
> > > > Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> > > > ---
> > > >  .../ldconfig-add-usrmerge-support.patch       | 37 +++++++++++++++++++
> > > >  .../glibc/ldconfig-native_2.12.1.bb           |  1 +
> > > >  2 files changed, 38 insertions(+)
> > > >  create mode 100644 meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> > > >
> > > > diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> > > > new file mode 100644
> > > > index 0000000000..3041d433fd
> > > > --- /dev/null
> > > > +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> > > > @@ -0,0 +1,37 @@
> > > > +From 6e543f39f6bec6eb2e02eea02029c7f4ec533b66 Mon Sep 17 00:00:00 2001
> > > > +From: Johannes Pointner <johannes.pointner@br-automation.com>
> > > > +Date: Fri, 1 Dec 2023 11:02:39 +0100
> > > > +Subject: [PATCH] ldconfig: add usrmerge support
> > > > +
> > > > +Check whether SLIBDIR is a symlink, which is the case if usrmerge
> > > > +is enabled, and if so, ignore it.
> > > > +
> > > > +Upstream-Status: Inappropriate [embedded specific]
> > >
> > > I'm not sure how this is embedded specific, why doesn't it affect desktop
> > > distribution that have usrmerge (e.g. Fedora) ?
> > Because this is just a workaround for the standalone ldconfig-native.
> > https://lists.openembedded.org/g/openembedded-core/message/191566
> > I also looked at the reason for the patches that are already used by
> > ldconfig-native.
> > But I am open to suggestions, what would you prefer?
> > >
> > > > +
> > > > +Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> > > > +---
> > > > + ldconfig.c | 8 +++++++-
> > > > + 1 file changed, 7 insertions(+), 1 deletion(-)
> > > > +
> > > > +diff --git a/ldconfig.c b/ldconfig.c
> > > > +index e826410..72ac67b 100644
> > > > +--- a/ldconfig.c
> > > > ++++ b/ldconfig.c
> > > > +@@ -1371,10 +1371,16 @@ main (int argc, char **argv)
> > > > +
> > > > +   if (!opt_only_cline)
> > > > +     {
> > > > ++      struct stat buf;
> > > > ++      int ret;
> > > > +       parse_conf (config_file, true);
> > > > +
> > > > +       /* Always add the standard search paths.  */
> > > > +-      add_system_dir (SLIBDIR);
> > > > ++      /* Check whether SLIBDIR is a symlink, which is the case if usrmerge
> > > > ++       is enabled, and if so, ignore it. */
> > > > ++      ret = lstat(SLIBDIR ,&buf);
> > > > ++      if(ret == -1 || !S_ISLNK(buf.st_mode))
> > > > ++        add_system_dir (SLIBDIR);
> > > > +       if (strcmp (SLIBDIR, LIBDIR))
> > > > +     add_system_dir (LIBDIR);
> > > > +       add_system_dir (SLIBDIR32);
> > > > diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> > > > index 4db67c3ad4..85fc87257d 100644
> > > > --- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> > > > +++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> > > > @@ -16,6 +16,7 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
> > > >             file://add-64-bit-flag-for-ELF64-entries.patch \
> > > >             file://no-aux-cache.patch \
> > > >             file://add-riscv-support.patch \
> > > > +           file://ldconfig-add-usrmerge-support.patch \
> > > >  "
> > > >
> > > >
> > > > --
> > > > 2.43.0
> > > >
> > > >
> > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Alexandre Belloni, co-owner and COO, Bootlin
> > > Embedded Linux and Kernel engineering
> > > https://bootlin.com
> > >
> > >
> > >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#191722): https://lists.openembedded.org/g/openembedded-core/message/191722
> > Mute This Topic: https://lists.openembedded.org/mt/102912756/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
Alexander Kanavin Dec. 5, 2023, 10:02 a.m. UTC | #6
On Tue, 5 Dec 2023 at 10:44, Johannes Pointner <h4nn35.work@gmail.com> wrote:
> Thanks, I understand that, but ldconfig-native seemed very special to me, so
> I tried to take an example from the existing patches.
>
> So the next step would be a v2 with a better explanation and obviously a
> fixed sendemail.from?
> Or are there any other things I should change?

That should be ok. Note that any changes that fix issues which should
be exposed by the autobuilder testing, but aren't are seen with extra
suspicion: you need to explain why existing tests aren't exposing the
issue, and whether we need additional tests. All of it in the commit:
mailing list discussion would be lost in history.

Alex
Peter Kjellerstedt Dec. 6, 2023, 9:39 p.m. UTC | #7
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Johannes Pointner via lists.openembedded.org
> Sent: den 1 december 2023 11:54
> To: openembedded-core@lists.openembedded.org
> Cc: Johannes Pointner <johannes.pointner@br-automation.com>
> Subject: [OE-core] [PATCH] ldconfig-native: Add usrmerge support
> 
> If DISTRO_FEATURE usrmerge is enabled, SLIBDIR is just a symlink to LIBDIR,
> therefore don't add SLIBDIR for parsing in this case.
> 
> Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> ---
>  .../ldconfig-add-usrmerge-support.patch       | 37 +++++++++++++++++++
>  .../glibc/ldconfig-native_2.12.1.bb           |  1 +
>  2 files changed, 38 insertions(+)
>  create mode 100644 meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> 
> diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> new file mode 100644
> index 0000000000..3041d433fd
> --- /dev/null
> +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
> @@ -0,0 +1,37 @@
> +From 6e543f39f6bec6eb2e02eea02029c7f4ec533b66 Mon Sep 17 00:00:00 2001
> +From: Johannes Pointner <johannes.pointner@br-automation.com>
> +Date: Fri, 1 Dec 2023 11:02:39 +0100
> +Subject: [PATCH] ldconfig: add usrmerge support
> +
> +Check whether SLIBDIR is a symlink, which is the case if usrmerge
> +is enabled, and if so, ignore it.
> +
> +Upstream-Status: Inappropriate [embedded specific]
> +
> +Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
> +---
> + ldconfig.c | 8 +++++++-
> + 1 file changed, 7 insertions(+), 1 deletion(-)
> +
> +diff --git a/ldconfig.c b/ldconfig.c
> +index e826410..72ac67b 100644
> +--- a/ldconfig.c
> ++++ b/ldconfig.c
> +@@ -1371,10 +1371,16 @@ main (int argc, char **argv)
> +
> +   if (!opt_only_cline)
> +     {
> ++      struct stat buf;
> ++      int ret;
> +       parse_conf (config_file, true);
> +
> +       /* Always add the standard search paths.  */
> +-      add_system_dir (SLIBDIR);
> ++      /* Check whether SLIBDIR is a symlink, which is the case if usrmerge
> ++       is enabled, and if so, ignore it. */
> ++      ret = lstat(SLIBDIR ,&buf);
> ++      if(ret == -1 || !S_ISLNK(buf.st_mode))
> ++        add_system_dir (SLIBDIR);
> +       if (strcmp (SLIBDIR, LIBDIR))
> + 	add_system_dir (LIBDIR);

Rather than blindly assuming that SLIBDIR being a symbolic link 
means it is a link to LIBDIR, I would recommend to change the 
strcmp() above to compare the paths after running them through 
realpath(). E.g., something like:

      add_system_dir (LIBDIR);
      if (strcmp (LIBDIR, SLIBDIR)) {
        const char *libdir = realpath (LIBDIR, NULL);
        const char *slibdir = realpath (SLIBDIR, NULL);
        if (strcmp(libdir, slibdir))
          add_system_dir (SLIBDIR);
        free (slibdir);
        free (libdir);
      }

This of course assumes LIBDIR is not a symbolic link to SLIBDIR, 
but I doubt anyone does that...

> +       add_system_dir (SLIBDIR32);
> diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> index 4db67c3ad4..85fc87257d 100644
> --- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> +++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
> @@ -16,6 +16,7 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
>             file://add-64-bit-flag-for-ELF64-entries.patch \
>             file://no-aux-cache.patch \
>             file://add-riscv-support.patch \
> +           file://ldconfig-add-usrmerge-support.patch \
>  "
> 
> 
> --
> 2.43.0

//Peter
diff mbox series

Patch

diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
new file mode 100644
index 0000000000..3041d433fd
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-add-usrmerge-support.patch
@@ -0,0 +1,37 @@ 
+From 6e543f39f6bec6eb2e02eea02029c7f4ec533b66 Mon Sep 17 00:00:00 2001
+From: Johannes Pointner <johannes.pointner@br-automation.com>
+Date: Fri, 1 Dec 2023 11:02:39 +0100
+Subject: [PATCH] ldconfig: add usrmerge support
+
+Check whether SLIBDIR is a symlink, which is the case if usrmerge
+is enabled, and if so, ignore it.
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Johannes Pointner <johannes.pointner@br-automation.com>
+---
+ ldconfig.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/ldconfig.c b/ldconfig.c
+index e826410..72ac67b 100644
+--- a/ldconfig.c
++++ b/ldconfig.c
+@@ -1371,10 +1371,16 @@ main (int argc, char **argv)
+ 
+   if (!opt_only_cline)
+     {
++      struct stat buf;
++      int ret;
+       parse_conf (config_file, true);
+ 
+       /* Always add the standard search paths.  */
+-      add_system_dir (SLIBDIR);
++      /* Check whether SLIBDIR is a symlink, which is the case if usrmerge
++       is enabled, and if so, ignore it. */
++      ret = lstat(SLIBDIR ,&buf);
++      if(ret == -1 || !S_ISLNK(buf.st_mode))
++        add_system_dir (SLIBDIR);
+       if (strcmp (SLIBDIR, LIBDIR))
+ 	add_system_dir (LIBDIR);
+       add_system_dir (SLIBDIR32);
diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
index 4db67c3ad4..85fc87257d 100644
--- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
+++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
@@ -16,6 +16,7 @@  SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
            file://add-64-bit-flag-for-ELF64-entries.patch \
            file://no-aux-cache.patch \
            file://add-riscv-support.patch \
+           file://ldconfig-add-usrmerge-support.patch \
 "