public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] Add helper function for basename
Date: Thu, 14 Dec 2023 10:15:00 -0800	[thread overview]
Message-ID: <CAMKF1srsbanq6T-Djnhz4UGKOhqGMsyL2eNSwgEBkDs0_B63wQ@mail.gmail.com> (raw)
In-Reply-To: <dcf67d617aa423b5c68b2314d9cf95a4597cd713.camel@klomp.org>

On Thu, Dec 14, 2023 at 10:07 AM Mark Wielaard <mark@klomp.org> wrote:
>
> Hi Khem,
>
> 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.
> >
> > Upstream-Status: Pending
> > [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
>
> Our discussion showed we really need this if we want to support musl
> (or any other alternative libc without the string.h basename variant).
> I would have liked a configure check, but old musl makes that kind of
> impossible. So I agree we should use our own implementation.
>
> I did structure it slightly differently though. Instead of adding it to
> libeu I added it to system.h as static inline function. And I poisoned
> the basename symbol. That found two other places where basename was
> used (and now replaced by xbasename). Sadly it means we have to rename
> a variable in debuginfod.cxx from basename to filename, but I think
> that is acceptable.
>
> I don't like the const cast away in ar.c, but that seems necessary
> because we are using search.h and that interface just takes non-cast
> char pointers (even though they really are const).
>
> What do you think of the attached variant of your patch?

Overall, this looks a good improvement on top of my patch so good to go.
I will also try it in my local distro builds and see how it goes.

>
> Thanks,
>
> Mark

  reply	other threads:[~2023-12-14 18:15 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
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 [this message]
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=CAMKF1srsbanq6T-Djnhz4UGKOhqGMsyL2eNSwgEBkDs0_B63wQ@mail.gmail.com \
    --to=raj.khem@gmail.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.org \
    /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).