On Wed, Dec 13, 2023 at 7:10 AM Mark Wielaard <m...@klomp.org> wrote: > > 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 <m...@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)?
basename was declared like this till lately https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 > > 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? This is not yet tried widely in distros as the musl patch above is till new and not part of a release yet. > > Thanks, > > Mark