linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* xfsprogs and libintl
@ 2020-12-03 19:15 Dan Melnic
  2020-12-03 19:35 ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Melnic @ 2020-12-03 19:15 UTC (permalink / raw)
  To: linux-xfs; +Cc: Omar Sandoval

Hi,

If we compile some code both with libintl.h and libxfs/xfsprogs, we can end up, based on the include order, with the 
# define textdomain(d) do { } while (0) 
before: 
extern char *textdomain (const char *__domainname) __THROW;

This will cause a compile error.
I think the ENABLE_GETTEXT check should not leak into any public headers.
/* Define if you want gettext (I18N) support */
#undef ENABLE_GETTEXT
#ifdef ENABLE_GETTEXT
# include <libintl.h>
# define _(x)                   gettext(x)
# define N_(x)  x
#else
# define _(x)                   (x)
# define N_(x)  x
# define textdomain(d)          do { } while (0)
# define bindtextdomain(d,dir)  do { } while (0)
#endif

https://github.com/osandov/xfsprogs/blob/master/include/platform_defs.h.in#L48

Thanks,

Dan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xfsprogs and libintl
  2020-12-03 19:15 xfsprogs and libintl Dan Melnic
@ 2020-12-03 19:35 ` Darrick J. Wong
  2020-12-03 20:05   ` Dan Melnic
  0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2020-12-03 19:35 UTC (permalink / raw)
  To: Dan Melnic; +Cc: linux-xfs, Omar Sandoval

On Thu, Dec 03, 2020 at 07:15:39PM +0000, Dan Melnic wrote:
> Hi,
> 
> If we compile some code both with libintl.h and libxfs/xfsprogs, we can end up, based on the include order, with the 
> # define textdomain(d) do { } while (0) 
> before: 
> extern char *textdomain (const char *__domainname) __THROW;
> 
> This will cause a compile error.
> I think the ENABLE_GETTEXT check should not leak into any public headers.

What public header file?

$ grep textdomain /usr/include/xfs/
$ grep ENABLE_GETTEXT /usr/include/xfs/
$

> /* Define if you want gettext (I18N) support */
> #undef ENABLE_GETTEXT
> #ifdef ENABLE_GETTEXT
> # include <libintl.h>
> # define _(x)                   gettext(x)
> # define N_(x)  x
> #else
> # define _(x)                   (x)
> # define N_(x)  x
> # define textdomain(d)          do { } while (0)
> # define bindtextdomain(d,dir)  do { } while (0)
> #endif
> 
> https://github.com/osandov/xfsprogs/blob/master/include/platform_defs.h.in#L48

platform_defs.h is private to the xfsprogs code base; what are you
doing?

Confused,

--D

> 
> Thanks,
> 
> Dan
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xfsprogs and libintl
  2020-12-03 19:35 ` Darrick J. Wong
@ 2020-12-03 20:05   ` Dan Melnic
  2020-12-03 20:19     ` Eric Sandeen
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Melnic @ 2020-12-03 20:05 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, Omar Sandoval

I guess this is an older version - 3.1.4:

xfs.h includes platform_defs.h:
#ifndef __XFS_H__
#define __XFS_H__

#include <xfs/platform_defs.h>
#include <xfs/xfs_fs.h>

#endif  /* __XFS_H__ */

Which:

/* Define if you want gettext (I18N) support */
/* #undef ENABLE_GETTEXT */
#ifdef ENABLE_GETTEXT
# include <libintl.h>
# define _(x)                   gettext(x)
# define N_(x)                   x
#else
# define _(x)                   (x)
# define N_(x)                   x
# define textdomain(d)          do { } while (0)
# define bindtextdomain(d,dir)  do { } while (0)
#endif
#include <locale.h>

I'll try to upgrade to a newer version then.

Dan

On 12/3/20, 11:35 AM, "Darrick J. Wong" <darrick.wong@oracle.com> wrote:

    On Thu, Dec 03, 2020 at 07:15:39PM +0000, Dan Melnic wrote:
    > Hi,
    > 
    > If we compile some code both with libintl.h and libxfs/xfsprogs, we can end up, based on the include order, with the 
    > # define textdomain(d) do { } while (0) 
    > before: 
    > extern char *textdomain (const char *__domainname) __THROW;
    > 
    > This will cause a compile error.
    > I think the ENABLE_GETTEXT check should not leak into any public headers.

    What public header file?

    $ grep textdomain /usr/include/xfs/
    $ grep ENABLE_GETTEXT /usr/include/xfs/
    $

    > /* Define if you want gettext (I18N) support */
    > #undef ENABLE_GETTEXT
    > #ifdef ENABLE_GETTEXT
    > # include <libintl.h>
    > # define _(x)                   gettext(x)
    > # define N_(x)  x
    > #else
    > # define _(x)                   (x)
    > # define N_(x)  x
    > # define textdomain(d)          do { } while (0)
    > # define bindtextdomain(d,dir)  do { } while (0)
    > #endif
    > 
    > https://github.com/osandov/xfsprogs/blob/master/include/platform_defs.h.in#L48

    platform_defs.h is private to the xfsprogs code base; what are you
    doing?

    Confused,

    --D

    > 
    > Thanks,
    > 
    > Dan
    > 
    > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xfsprogs and libintl
  2020-12-03 20:05   ` Dan Melnic
@ 2020-12-03 20:19     ` Eric Sandeen
  2020-12-03 20:38       ` Dan Melnic
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2020-12-03 20:19 UTC (permalink / raw)
  To: Dan Melnic, Darrick J. Wong; +Cc: linux-xfs, Omar Sandoval

On 12/3/20 2:05 PM, Dan Melnic wrote:
> I guess this is an older version - 3.1.4:

That's ... 10 years old!

platform_defs.h has not been installed on the system since
2015 or so:

,commit dcabd4e7e955231a6bb92ce1038e62e5a9b90c5d
Author: Christoph Hellwig <hch@lst.de>
Date:   Mon Aug 3 09:58:33 2015 +1000

    xfsprogs: don't install platform_defs.h

> xfs.h includes platform_defs.h:
> #ifndef __XFS_H__
> #define __XFS_H__
> 
> #include <xfs/platform_defs.h>
> #include <xfs/xfs_fs.h>
> 
> #endif  /* __XFS_H__ */
> 
> Which:
> 
> /* Define if you want gettext (I18N) support */
> /* #undef ENABLE_GETTEXT */
> #ifdef ENABLE_GETTEXT
> # include <libintl.h>
> # define _(x)                   gettext(x)
> # define N_(x)                   x
> #else
> # define _(x)                   (x)
> # define N_(x)                   x
> # define textdomain(d)          do { } while (0)
> # define bindtextdomain(d,dir)  do { } while (0)
> #endif
> #include <locale.h>
> 
> I'll try to upgrade to a newer version then.

I think that is wise :)

-Eric

> Dan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xfsprogs and libintl
  2020-12-03 20:19     ` Eric Sandeen
@ 2020-12-03 20:38       ` Dan Melnic
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Melnic @ 2020-12-03 20:38 UTC (permalink / raw)
  To: Eric Sandeen, Darrick J. Wong; +Cc: linux-xfs, Omar Sandoval

Thanks,

Dan

On 12/3/20, 12:20 PM, "Eric Sandeen" <sandeen@sandeen.net> wrote:

    On 12/3/20 2:05 PM, Dan Melnic wrote:
    > I guess this is an older version - 3.1.4:

    That's ... 10 years old!

    platform_defs.h has not been installed on the system since
    2015 or so:

    ,commit dcabd4e7e955231a6bb92ce1038e62e5a9b90c5d
    Author: Christoph Hellwig <hch@lst.de>
    Date:   Mon Aug 3 09:58:33 2015 +1000

        xfsprogs: don't install platform_defs.h

    > xfs.h includes platform_defs.h:
    > #ifndef __XFS_H__
    > #define __XFS_H__
    > 
    > #include <xfs/platform_defs.h>
    > #include <xfs/xfs_fs.h>
    > 
    > #endif  /* __XFS_H__ */
    > 
    > Which:
    > 
    > /* Define if you want gettext (I18N) support */
    > /* #undef ENABLE_GETTEXT */
    > #ifdef ENABLE_GETTEXT
    > # include <libintl.h>
    > # define _(x)                   gettext(x)
    > # define N_(x)                   x
    > #else
    > # define _(x)                   (x)
    > # define N_(x)                   x
    > # define textdomain(d)          do { } while (0)
    > # define bindtextdomain(d,dir)  do { } while (0)
    > #endif
    > #include <locale.h>
    > 
    > I'll try to upgrade to a newer version then.

    I think that is wise :)

    -Eric

    > Dan




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-03 20:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 19:15 xfsprogs and libintl Dan Melnic
2020-12-03 19:35 ` Darrick J. Wong
2020-12-03 20:05   ` Dan Melnic
2020-12-03 20:19     ` Eric Sandeen
2020-12-03 20:38       ` Dan Melnic

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 NNTP newsgroup(s).