On Wed, 11.02.15 18:21, Zbigniew Jędrzejewski-Szmek (zbys...@in.waw.pl) wrote:

> On Wed, Feb 11, 2015 at 06:18:54PM +0100, Lennart Poettering wrote:
> > On Wed, 11.02.15 18:10, Zbigniew Jędrzejewski-Szmek (zbys...@in.waw.pl) 
> > wrote:
> > 
> > > On Wed, Feb 11, 2015 at 06:05:13PM +0100, Lennart Poettering wrote:
> > > > On Mon, 09.02.15 21:41, Cristian Rodríguez (crrodrig...@opensuse.org) 
> > > > wrote:
> > > > 
> > > > > execute.c only uses basename (the GNU version in <string.h>)
> > > > 
> > > > Is this right even?
> > > > 
> > > > This was added by Zbigniew in 2b6bf07dd23bb467099d213c97b3875c5e453491:
> > > > 
> > > >     "Get rid of our reimplementation of basename
> > > >     
> > > >     The only problem is that libgen.h #defines basename to point to
> > > >     it's own broken implementation instead of the GNU one. This can be
> > > >     fixed by #undefining basename."
> > > > 
> > > > 
> > > > So, what's this about?
> > > > 
> > > > Somehow, given how stupid basename is defined, I am tempted to
> > > > introduce a call for this again, that is not stupid, and works for all
> > > > cases without ambiguities.
> > > > 
> > > > Anyway, Zbigniew, could you comment on this, please?
> > > I think the patch is fine. As long as every libgen.h include is followed
> > > by #undef basename, things are OK.
> > 
> > Can you elaborate on the background of this? Why the #undef precisely?
> > The man page says nothing about this?
> libgen.h contains
> 
> extern char *__xpg_basename (char *__path) __THROW;
> #define basename          __xpg_basename
> 
> And __xpg_basename is the borked implementation. #undef basename means that
> we use the GNU version instead.

So, hmm, so if I got this right:

a) The good basame() is in strings.h
b) The bad basename() is in libgen.h
c) The only other call in libgen.h is dirname()

Which means, that we only ever need to include libgen.h when we need
dirname(), and that avery single including of libgen.sh should be
matched with an "#undef basename"?

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to