public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Khem Raj <raj.khem@gmail.com>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] Add helper function for basename
Date: Wed, 13 Dec 2023 16:10:18 +0100	[thread overview]
Message-ID: <94bd77b96d261ebac6bfe62e8de64d3539742133.camel@klomp.org> (raw)
In-Reply-To: <CAMKF1so6wnVRrW=PseBXi_0ifZMmUkoRRzVy4CFyFjLmUsYnng@mail.gmail.com>

Hi Khem,

On Tue, 2023-12-12 at 09:16 -0800, Khem Raj wrote:
> On Tue, Dec 12, 2023 at 5:18 AM Mark Wielaard <mark@klomp.org> wrote:
> > On Sun, 2023-12-10 at 12:20 -0800, Khem Raj wrote:
> > > musl does not provide GNU version of basename and lately have removed
> > > the definiton from string.h [1] which exposes this problem. It can be
> > > made to work by providing a local implementation of basename which
> > > implements the GNU basename behavior, this makes it work across C
> > > libraries which have POSIX implementation only.
> > 
> > Thanks, this should work, but wouldn't it be easier to add a configure
> > test for having basename defined in string.h and then only define
> > basename in libeu.h (and build basename.c) if it isn't. So that all the
> > code can just keep using basename (we just have to make sure libeu.h is
> > included)?
> 
> we could do that but it will not work as expected with older musl releases
> where the prototype in string.h will exist.

But that is good isn't it? Or did musl define basename in string.h with
different semantics (where the given input string is modified)?

In the second case various elfutils libraries and tools probably just
segfaulted when build/run against musl. And your patch would indeed fix
both old and new musl versions. Do people using musl already use some
variant of your patch?

Thanks,

Mark

  reply	other threads:[~2023-12-13 15:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-10 20:20 Khem Raj
2023-12-12 13:18 ` Mark Wielaard
2023-12-12 17:16   ` Khem Raj
2023-12-13 15:10     ` Mark Wielaard [this message]
2023-12-13 16:29       ` Khem Raj
2023-12-13 22:33         ` Mark Wielaard
2023-12-14 18:07 ` Mark Wielaard
2023-12-14 18:15   ` Khem Raj
2023-12-14 19:22     ` Mark Wielaard
2023-12-14 19:28       ` Khem Raj
2023-12-20 16:43         ` Khem Raj
2023-12-21  1:02           ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=94bd77b96d261ebac6bfe62e8de64d3539742133.camel@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    --cc=raj.khem@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).