Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jan 2022 15:26:41 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Xin Li <delphij@freebsd.org>
Cc:        Jessica Clarke <jrtc27@freebsd.org>, src-committers <src-committers@freebsd.org>,  "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, dev-commits-src-main@freebsd.org
Subject:   Re: git: 902665210189 - main - libmagic: Remove support for older FreeBSD where xlocale was not available.
Message-ID:  <CANCZdfqCMEqFSzi4AHoQk%2BJRb2_=2Qc1XTPj5=bZLMQ4CLAaPw@mail.gmail.com>
In-Reply-To: <77ae0cc3-ed4e-5233-f7ae-ea4fe3de1606@FreeBSD.org>
References:  <202201030209.20329qRc018384@gitrepo.freebsd.org> <CANCZdfpFrtehUpV6d0hvBFQkV3axSdur5QiKf8abuwOpFHP7eA@mail.gmail.com> <77ae0cc3-ed4e-5233-f7ae-ea4fe3de1606@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Tue, Jan 4, 2022 at 11:21 AM Xin Li <delphij@freebsd.org> wrote:

> On 1/4/22 09:18, Warner Losh wrote:
> > This breaks the cross building on linux.  The FREEBSD_XLOCALE_SUPPORT
> > was covering both the case of old FreeBSD as well as the case of
> > building on Linux/macOS. when we cross build, we define
> > __FreeBSD_version to be 0.
> >
> > All that really needs protecting is the xlocale.h include though. And
> > that's only needed on Linux / glibc, so the following patch should do
> > the trick:
> >
> >   /* Define to 1 if you have the <xlocale.h> header file. */
> > +#ifndef linux /* Cross building tools build with glibc on linux */
> >   #define HAVE_XLOCALE_H 1
> > +#endif
> >
> > Any objections to committing that? Or should I create a phab review to
> > discuss?
>
> Ah I didn't know that.  Yes that looks reasonable (I assume you would
> also restore the #ifdef's for HAVE_XLOCAL_H).
>

They are already there, so I didn't need to make any other changes.

Warner


> Cheers,
>
> > Warner
> >
> >
> > On Sun, Jan 2, 2022 at 7:09 PM Xin LI <delphij@freebsd.org
> > <mailto:delphij@freebsd.org>> wrote:
> >
> >     The branch main has been updated by delphij:
> >
> >     URL:
> >
> https://cgit.FreeBSD.org/src/commit/?id=90266521018938b7b9f0003ba9a383b6920859e9
> >     <
> https://cgit.FreeBSD.org/src/commit/?id=90266521018938b7b9f0003ba9a383b6920859e9
> >
> >
> >     commit 90266521018938b7b9f0003ba9a383b6920859e9
> >     Author:     Xin LI <delphij@FreeBSD.org>
> >     AuthorDate: 2022-01-03 02:05:08 +0000
> >     Commit:     Xin LI <delphij@FreeBSD.org>
> >     CommitDate: 2022-01-03 02:05:08 +0000
> >
> >          libmagic: Remove support for older FreeBSD where xlocale was
> >     not available.
> >
> >          The MINIMUM_SUPPORTED_OSREL is 1002501 (FreeBSD 10.3), and
> >     xlocale is
> >          supported there.
> >
> >          While I'm there, explicitly use config.h generated with
> >     --disable-bzlib
> >          --disable-xzlib instead of deleting them manually.
> >
> >          MFC after:      2 weeks
> >     ---
> >       lib/libmagic/config.h | 36 ++++++++++++++++++------------------
> >       1 file changed, 18 insertions(+), 18 deletions(-)
> >
> >     diff --git a/lib/libmagic/config.h b/lib/libmagic/config.h
> >     index 263fdfb571cd..90a9a115420c 100644
> >     --- a/lib/libmagic/config.h
> >     +++ b/lib/libmagic/config.h
> >     @@ -1,13 +1,3 @@
> >     -/* $FreeBSD$ */
> >     -
> >     -/* Get __FreeBSD_version. */
> >     -#include <osreldate.h>
> >     -
> >     -/* Only specific versions of FreeBSD support xlocale */
> >     -#if __FreeBSD_version >= 1000002 || (__FreeBSD_version < 1000000 &&
> >     __FreeBSD_version >= 900506)
> >     -#define FREEBSD_XLOCALE_SUPPORT 1
> >     -#endif
> >     -
> >       /* config.h.  Generated from config.h.in <http://config.h.in>; by
> >     configure.  */
> >       /* config.h.in <http://config.h.in>.  Generated from configure.ac
> >     <http://configure.ac>; by autoheader.  */
> >
> >     @@ -17,6 +7,9 @@
> >       /* Define in built-in ELF support is used */
> >       #define BUILTIN_ELF 1
> >
> >     +/* Enable bzlib compression support */
> >     +/* #undef BZLIBSUPPORT */
> >     +
> >       /* Define for ELF core file support */
> >       #define ELFCORE 1
> >
> >     @@ -26,6 +19,9 @@
> >       /* Define to 1 if you have the `asprintf' function. */
> >       #define HAVE_ASPRINTF 1
> >
> >     +/* Define to 1 if you have the <bzlib.h> header file. */
> >     +/* #undef HAVE_BZLIB_H */
> >     +
> >       /* Define to 1 if you have the `ctime_r' function. */
> >       #define HAVE_CTIME_R 1
> >
> >     @@ -59,9 +55,7 @@
> >       #define HAVE_FORK 1
> >
> >       /* Define to 1 if you have the `freelocale' function. */
> >     -#ifdef FREEBSD_XLOCALE_SUPPORT
> >       #define HAVE_FREELOCALE 1
> >     -#endif
> >
> >       /* Define to 1 if fseeko (and presumably ftello) exists and is
> >     declared. */
> >       #define HAVE_FSEEKO 1
> >     @@ -87,9 +81,15 @@
> >       /* Define to 1 if you have the <inttypes.h> header file. */
> >       #define HAVE_INTTYPES_H 1
> >
> >     +/* Define to 1 if you have the `bz2' library (-lbz2). */
> >     +/* #undef HAVE_LIBBZ2 */
> >     +
> >       /* Define to 1 if you have the `gnurx' library (-lgnurx). */
> >       /* #undef HAVE_LIBGNURX */
> >
> >     +/* Define to 1 if you have the `lzma' library (-llzma). */
> >     +/* #undef HAVE_LIBLZMA */
> >     +
> >       /* Define to 1 if you have the `seccomp' library (-lseccomp). */
> >       /* #undef HAVE_LIBSECCOMP */
> >
> >     @@ -99,6 +99,9 @@
> >       /* Define to 1 if you have the `localtime_r' function. */
> >       #define HAVE_LOCALTIME_R 1
> >
> >     +/* Define to 1 if you have the <lzma.h> header file. */
> >     +/* #undef HAVE_LZMA_H */
> >     +
> >       /* Define to 1 if mbrtowc and mbstate_t are properly declared. */
> >       #define HAVE_MBRTOWC 1
> >
> >     @@ -121,9 +124,7 @@
> >       #define HAVE_MMAP 1
> >
> >       /* Define to 1 if you have the `newlocale' function. */
> >     -#ifdef FREEBSD_XLOCALE_SUPPORT
> >       #define HAVE_NEWLOCALE 1
> >     -#endif
> >
> >       /* Define to 1 if you have the `pread' function. */
> >       #define HAVE_PREAD 1
> >     @@ -210,9 +211,7 @@
> >       #define HAVE_UNISTD_H 1
> >
> >       /* Define to 1 if you have the `uselocale' function. */
> >     -#ifdef FREEBSD_XLOCALE_SUPPORT
> >       #define HAVE_USELOCALE 1
> >     -#endif
> >
> >       /* Define to 1 if you have the `utime' function. */
> >       #define HAVE_UTIME 1
> >     @@ -252,9 +251,7 @@
> >       #define HAVE_WORKING_VFORK 1
> >
> >       /* Define to 1 if you have the <xlocale.h> header file. */
> >     -#ifdef FREEBSD_XLOCALE_SUPPORT
> >       #define HAVE_XLOCALE_H 1
> >     -#endif
> >
> >       /* Define to 1 if you have the <zlib.h> header file. */
> >       #define HAVE_ZLIB_H 1
> >     @@ -334,6 +331,9 @@
> >       # endif
> >       #endif
> >
> >     +/* Enable xzlib compression support */
> >     +/* #undef XZLIBSUPPORT */
> >     +
> >       /* Enable zlib compression support */
> >       #define ZLIBSUPPORT 1
> >
>
>

[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 4, 2022 at 11:21 AM Xin Li &lt;<a href="mailto:delphij@freebsd.org">delphij@freebsd.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 1/4/22 09:18, Warner Losh wrote:<br>
&gt; This breaks the cross building on linux.  The FREEBSD_XLOCALE_SUPPORT <br>
&gt; was covering both the case of old FreeBSD as well as the case of <br>
&gt; building on Linux/macOS. when we cross build, we define <br>
&gt; __FreeBSD_version to be 0.<br>
&gt; <br>
&gt; All that really needs protecting is the xlocale.h include though. And <br>
&gt; that&#39;s only needed on Linux / glibc, so the following patch should do <br>
&gt; the trick:<br>
&gt; <br>
&gt;   /* Define to 1 if you have the &lt;xlocale.h&gt; header file. */<br>
&gt; +#ifndef linux /* Cross building tools build with glibc on linux */<br>
&gt;   #define HAVE_XLOCALE_H 1<br>
&gt; +#endif<br>
&gt; <br>
&gt; Any objections to committing that? Or should I create a phab review to <br>
&gt; discuss?<br>
<br>
Ah I didn&#39;t know that.  Yes that looks reasonable (I assume you would <br>
also restore the #ifdef&#39;s for HAVE_XLOCAL_H).<br></blockquote><div><br></div><div>They are already there, so I didn&#39;t need to make any other changes.</div><div><br></div><div>Warner</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Cheers,<br>
<br>
&gt; Warner<br>
&gt; <br>
&gt; <br>
&gt; On Sun, Jan 2, 2022 at 7:09 PM Xin LI &lt;<a href="mailto:delphij@freebsd.org" target="_blank">delphij@freebsd.org</a> <br>
&gt; &lt;mailto:<a href="mailto:delphij@freebsd.org" target="_blank">delphij@freebsd.org</a>&gt;&gt; wrote:<br>
&gt; <br>
&gt;     The branch main has been updated by delphij:<br>
&gt; <br>
&gt;     URL:<br>
&gt;     <a href="https://cgit.FreeBSD.org/src/commit/?id=90266521018938b7b9f0003ba9a383b6920859e9" rel="noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=90266521018938b7b9f0003ba9a383b6920859e9</a><br>;
&gt;     &lt;<a href="https://cgit.FreeBSD.org/src/commit/?id=90266521018938b7b9f0003ba9a383b6920859e9" rel="noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=90266521018938b7b9f0003ba9a383b6920859e9</a>&gt;<br>;
&gt; <br>
&gt;     commit 90266521018938b7b9f0003ba9a383b6920859e9<br>
&gt;     Author:     Xin LI &lt;delphij@FreeBSD.org&gt;<br>
&gt;     AuthorDate: 2022-01-03 02:05:08 +0000<br>
&gt;     Commit:     Xin LI &lt;delphij@FreeBSD.org&gt;<br>
&gt;     CommitDate: 2022-01-03 02:05:08 +0000<br>
&gt; <br>
&gt;          libmagic: Remove support for older FreeBSD where xlocale was<br>
&gt;     not available.<br>
&gt; <br>
&gt;          The MINIMUM_SUPPORTED_OSREL is 1002501 (FreeBSD 10.3), and<br>
&gt;     xlocale is<br>
&gt;          supported there.<br>
&gt; <br>
&gt;          While I&#39;m there, explicitly use config.h generated with<br>
&gt;     --disable-bzlib<br>
&gt;          --disable-xzlib instead of deleting them manually.<br>
&gt; <br>
&gt;          MFC after:      2 weeks<br>
&gt;     ---<br>
&gt;       lib/libmagic/config.h | 36 ++++++++++++++++++------------------<br>
&gt;       1 file changed, 18 insertions(+), 18 deletions(-)<br>
&gt; <br>
&gt;     diff --git a/lib/libmagic/config.h b/lib/libmagic/config.h<br>
&gt;     index 263fdfb571cd..90a9a115420c 100644<br>
&gt;     --- a/lib/libmagic/config.h<br>
&gt;     +++ b/lib/libmagic/config.h<br>
&gt;     @@ -1,13 +1,3 @@<br>
&gt;     -/* $FreeBSD$ */<br>
&gt;     -<br>
&gt;     -/* Get __FreeBSD_version. */<br>
&gt;     -#include &lt;osreldate.h&gt;<br>
&gt;     -<br>
&gt;     -/* Only specific versions of FreeBSD support xlocale */<br>
&gt;     -#if __FreeBSD_version &gt;= 1000002 || (__FreeBSD_version &lt; 1000000 &amp;&amp;<br>
&gt;     __FreeBSD_version &gt;= 900506)<br>
&gt;     -#define FREEBSD_XLOCALE_SUPPORT 1<br>
&gt;     -#endif<br>
&gt;     -<br>
&gt;       /* config.h.  Generated from <a href="http://config.h.in" rel="noreferrer" target="_blank">config.h.in</a> &lt;<a href="http://config.h.in" rel="noreferrer" target="_blank">http://config.h.in</a>&gt; by<br>
&gt;     configure.  */<br>
&gt;       /* <a href="http://config.h.in" rel="noreferrer" target="_blank">config.h.in</a> &lt;<a href="http://config.h.in" rel="noreferrer" target="_blank">http://config.h.in</a>&gt;.  Generated from <a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
&gt;     &lt;<a href="http://configure.ac" rel="noreferrer" target="_blank">http://configure.ac</a>&gt; by autoheader.  */<br>
&gt; <br>
&gt;     @@ -17,6 +7,9 @@<br>
&gt;       /* Define in built-in ELF support is used */<br>
&gt;       #define BUILTIN_ELF 1<br>
&gt; <br>
&gt;     +/* Enable bzlib compression support */<br>
&gt;     +/* #undef BZLIBSUPPORT */<br>
&gt;     +<br>
&gt;       /* Define for ELF core file support */<br>
&gt;       #define ELFCORE 1<br>
&gt; <br>
&gt;     @@ -26,6 +19,9 @@<br>
&gt;       /* Define to 1 if you have the `asprintf&#39; function. */<br>
&gt;       #define HAVE_ASPRINTF 1<br>
&gt; <br>
&gt;     +/* Define to 1 if you have the &lt;bzlib.h&gt; header file. */<br>
&gt;     +/* #undef HAVE_BZLIB_H */<br>
&gt;     +<br>
&gt;       /* Define to 1 if you have the `ctime_r&#39; function. */<br>
&gt;       #define HAVE_CTIME_R 1<br>
&gt; <br>
&gt;     @@ -59,9 +55,7 @@<br>
&gt;       #define HAVE_FORK 1<br>
&gt; <br>
&gt;       /* Define to 1 if you have the `freelocale&#39; function. */<br>
&gt;     -#ifdef FREEBSD_XLOCALE_SUPPORT<br>
&gt;       #define HAVE_FREELOCALE 1<br>
&gt;     -#endif<br>
&gt; <br>
&gt;       /* Define to 1 if fseeko (and presumably ftello) exists and is<br>
&gt;     declared. */<br>
&gt;       #define HAVE_FSEEKO 1<br>
&gt;     @@ -87,9 +81,15 @@<br>
&gt;       /* Define to 1 if you have the &lt;inttypes.h&gt; header file. */<br>
&gt;       #define HAVE_INTTYPES_H 1<br>
&gt; <br>
&gt;     +/* Define to 1 if you have the `bz2&#39; library (-lbz2). */<br>
&gt;     +/* #undef HAVE_LIBBZ2 */<br>
&gt;     +<br>
&gt;       /* Define to 1 if you have the `gnurx&#39; library (-lgnurx). */<br>
&gt;       /* #undef HAVE_LIBGNURX */<br>
&gt; <br>
&gt;     +/* Define to 1 if you have the `lzma&#39; library (-llzma). */<br>
&gt;     +/* #undef HAVE_LIBLZMA */<br>
&gt;     +<br>
&gt;       /* Define to 1 if you have the `seccomp&#39; library (-lseccomp). */<br>
&gt;       /* #undef HAVE_LIBSECCOMP */<br>
&gt; <br>
&gt;     @@ -99,6 +99,9 @@<br>
&gt;       /* Define to 1 if you have the `localtime_r&#39; function. */<br>
&gt;       #define HAVE_LOCALTIME_R 1<br>
&gt; <br>
&gt;     +/* Define to 1 if you have the &lt;lzma.h&gt; header file. */<br>
&gt;     +/* #undef HAVE_LZMA_H */<br>
&gt;     +<br>
&gt;       /* Define to 1 if mbrtowc and mbstate_t are properly declared. */<br>
&gt;       #define HAVE_MBRTOWC 1<br>
&gt; <br>
&gt;     @@ -121,9 +124,7 @@<br>
&gt;       #define HAVE_MMAP 1<br>
&gt; <br>
&gt;       /* Define to 1 if you have the `newlocale&#39; function. */<br>
&gt;     -#ifdef FREEBSD_XLOCALE_SUPPORT<br>
&gt;       #define HAVE_NEWLOCALE 1<br>
&gt;     -#endif<br>
&gt; <br>
&gt;       /* Define to 1 if you have the `pread&#39; function. */<br>
&gt;       #define HAVE_PREAD 1<br>
&gt;     @@ -210,9 +211,7 @@<br>
&gt;       #define HAVE_UNISTD_H 1<br>
&gt; <br>
&gt;       /* Define to 1 if you have the `uselocale&#39; function. */<br>
&gt;     -#ifdef FREEBSD_XLOCALE_SUPPORT<br>
&gt;       #define HAVE_USELOCALE 1<br>
&gt;     -#endif<br>
&gt; <br>
&gt;       /* Define to 1 if you have the `utime&#39; function. */<br>
&gt;       #define HAVE_UTIME 1<br>
&gt;     @@ -252,9 +251,7 @@<br>
&gt;       #define HAVE_WORKING_VFORK 1<br>
&gt; <br>
&gt;       /* Define to 1 if you have the &lt;xlocale.h&gt; header file. */<br>
&gt;     -#ifdef FREEBSD_XLOCALE_SUPPORT<br>
&gt;       #define HAVE_XLOCALE_H 1<br>
&gt;     -#endif<br>
&gt; <br>
&gt;       /* Define to 1 if you have the &lt;zlib.h&gt; header file. */<br>
&gt;       #define HAVE_ZLIB_H 1<br>
&gt;     @@ -334,6 +331,9 @@<br>
&gt;       # endif<br>
&gt;       #endif<br>
&gt; <br>
&gt;     +/* Enable xzlib compression support */<br>
&gt;     +/* #undef XZLIBSUPPORT */<br>
&gt;     +<br>
&gt;       /* Enable zlib compression support */<br>
&gt;       #define ZLIBSUPPORT 1<br>
&gt; <br>
<br>
</blockquote></div></div>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqCMEqFSzi4AHoQk%2BJRb2_=2Qc1XTPj5=bZLMQ4CLAaPw>