From nobody Tue Jan 04 17:18:22 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 059E31935A02 for ; Tue, 4 Jan 2022 17:18:35 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x92c.google.com (mail-ua1-x92c.google.com [IPv6:2607:f8b0:4864:20::92c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JSzpx4CT8z4gkK for ; Tue, 4 Jan 2022 17:18:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x92c.google.com with SMTP id e19so18486502uaa.11 for ; Tue, 04 Jan 2022 09:18:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HRmqUfw55nkOksvrgkzXepQiNroG6hfwYWlngJowN4c=; b=3dJOtBVKINXdEz8I/g+63ROS8j4xcYtNTpzqgzpGFW8xxmmqvECvmybgmS69cus+s3 kDeCeVFS14TuBoe6UQb1bkytCJd1WpR4ukZ6OY6lRAe/6kiuWi2Q7PJyIHyJmUo0I7Kr OKNmMm/vp+2S0kws0MoBM6MWx3IZ+/ZkaZjLNj4q5LJFmz8sJUT2p9bJ6q+LORVly867 zKLBxQGV/0EEyt7JPW/nK/jeKWpKEtO8dmNsIFDZGCCJX6M0hsDelz4/TuF1xOLn849b hh+VtVFXIhFDh6Tl4rCwSb4Lad1d2knxqhuJNUMp2cO9pEDzKYUa0ldohpecVk1dxpBK OBWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HRmqUfw55nkOksvrgkzXepQiNroG6hfwYWlngJowN4c=; b=QYmxY6knhVNBtjbKNIpQ+HA4Z7VmjDhfItlleBRdPG4ezJDJwwHFEAZqv9hEVZB5T7 y6cltmcxEfrLv0/Dz75cbXvqRtA64u8WR5Gqad+fnqAxlLGwKn2etehw+EVEQKRCVs+q s55gJ+2fHLxcBZI2+sHdgiH0WhTTViBOl6c3UpJRoSzfqe8cFmBa0Ut973voDn6mTWtn oqQqBUC5/FJyIfcNZxAtYkzXXomEvHVIQeNA2X7sybgtWaHBU/2NfGnjPgtZj8C4RPwi yT38hOGY6eITISwv5esERkIDYjYOseiwl80FN3HgyOmqtJrcl8x1zCWZj/aj33L1DMqZ 6QkQ== X-Gm-Message-State: AOAM531zbQXvlwTvr64j9sJOOrAyCqvJQEZRr6ogBc60ixVdHfXrnDxR jU2nDOyBRgTnK0JOZI97zYDEHXgDkr3xkQbZ2l2j3A== X-Google-Smtp-Source: ABdhPJwhiBASMMkCgavv1RxmmP41au/rHskRtnT6fO4WgphvI2d8iAMaEPEV4lQwU2mM7ApG28nYpY7UGiRT94iI/DI= X-Received: by 2002:a05:6102:ed3:: with SMTP id m19mr16312071vst.68.1641316712705; Tue, 04 Jan 2022 09:18:32 -0800 (PST) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202201030209.20329qRc018384@gitrepo.freebsd.org> In-Reply-To: <202201030209.20329qRc018384@gitrepo.freebsd.org> From: Warner Losh Date: Tue, 4 Jan 2022 10:18:22 -0700 Message-ID: Subject: Re: git: 902665210189 - main - libmagic: Remove support for older FreeBSD where xlocale was not available. To: Xin LI , Jessica Clarke Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000a0034e05d4c4d3ff" X-Rspamd-Queue-Id: 4JSzpx4CT8z4gkK X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=3dJOtBVK; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::92c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [2.97 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.97)[0.972]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; NEURAL_SPAM_MEDIUM(1.00)[0.999]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; NEURAL_SPAM_LONG(1.00)[1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::92c:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com] X-ThisMailContainsUnwantedMimeParts: N --000000000000a0034e05d4c4d3ff Content-Type: text/plain; charset="UTF-8" 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 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? Warner On Sun, Jan 2, 2022 at 7:09 PM Xin LI wrote: > The branch main has been updated by delphij: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=90266521018938b7b9f0003ba9a383b6920859e9 > > commit 90266521018938b7b9f0003ba9a383b6920859e9 > Author: Xin LI > AuthorDate: 2022-01-03 02:05:08 +0000 > Commit: Xin LI > 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 > - > -/* 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 by configure. */ > /* config.h.in. Generated from 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 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 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 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 header file. */ > -#ifdef FREEBSD_XLOCALE_SUPPORT > #define HAVE_XLOCALE_H 1 > -#endif > > /* Define to 1 if you have the 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 > > --000000000000a0034e05d4c4d3ff Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This breaks the cross building on linux.=C2=A0 The FREEBSD= _XLOCALE_SUPPORT was covering both the case of old FreeBSD as well as the c= ase of building on Linux/macOS. when we cross build, we define __FreeBSD_ve= rsion to be 0.

All that really needs protecting is the x= locale.h include though. And that's only needed on Linux / glibc, so th= e following patch should do the trick:

=C2=A0/* De= fine to 1 if you have the <xlocale.h> header file. */
+#ifndef lin= ux /* Cross building tools build with glibc on linux */
=C2=A0#define HA= VE_XLOCALE_H 1
+#endif

Any objections to co= mmitting that? Or should I create a phab review to discuss?

<= /div>
Warner


<= div dir=3D"ltr" class=3D"gmail_attr">On Sun, Jan 2, 2022 at 7:09 PM Xin LI = <delphij@freebsd.org> wrot= e:
The branch ma= in has been updated by delphij:

URL: https://cgit.= FreeBSD.org/src/commit/?id=3D90266521018938b7b9f0003ba9a383b6920859e9
commit 90266521018938b7b9f0003ba9a383b6920859e9
Author:=C2=A0 =C2=A0 =C2=A0Xin LI <delphij@FreeBSD.org>
AuthorDate: 2022-01-03 02:05:08 +0000
Commit:=C2=A0 =C2=A0 =C2=A0Xin LI <delphij@FreeBSD.org>
CommitDate: 2022-01-03 02:05:08 +0000

=C2=A0 =C2=A0 libmagic: Remove support for older FreeBSD where xlocale was = not available.

=C2=A0 =C2=A0 The MINIMUM_SUPPORTED_OSREL is 1002501 (FreeBSD 10.3), and xl= ocale is
=C2=A0 =C2=A0 supported there.

=C2=A0 =C2=A0 While I'm there, explicitly use config.h generated with -= -disable-bzlib
=C2=A0 =C2=A0 --disable-xzlib instead of deleting them manually.

=C2=A0 =C2=A0 MFC after:=C2=A0 =C2=A0 =C2=A0 2 weeks
---
=C2=A0lib/libmagic/config.h | 36 ++++++++++++++++++------------------
=C2=A01 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 >=3D 1000002 || (__FreeBSD_version < 1000000 &= amp;& __FreeBSD_version >=3D 900506)
-#define FREEBSD_XLOCALE_SUPPORT 1
-#endif
-
=C2=A0/* config.h.=C2=A0 Generated from config.h.in by configure.=C2=A0 */ =C2=A0/* config.h.in.=C2=A0 Generated from configure.ac by autoheader.=C2=A0 */<= br>
@@ -17,6 +7,9 @@
=C2=A0/* Define in built-in ELF support is used */
=C2=A0#define BUILTIN_ELF 1

+/* Enable bzlib compression support */
+/* #undef BZLIBSUPPORT */
+
=C2=A0/* Define for ELF core file support */
=C2=A0#define ELFCORE 1

@@ -26,6 +19,9 @@
=C2=A0/* Define to 1 if you have the `asprintf' function. */
=C2=A0#define HAVE_ASPRINTF 1

+/* Define to 1 if you have the <bzlib.h> header file. */
+/* #undef HAVE_BZLIB_H */
+
=C2=A0/* Define to 1 if you have the `ctime_r' function. */
=C2=A0#define HAVE_CTIME_R 1

@@ -59,9 +55,7 @@
=C2=A0#define HAVE_FORK 1

=C2=A0/* Define to 1 if you have the `freelocale' function. */
-#ifdef FREEBSD_XLOCALE_SUPPORT
=C2=A0#define HAVE_FREELOCALE 1
-#endif

=C2=A0/* Define to 1 if fseeko (and presumably ftello) exists and is declar= ed. */
=C2=A0#define HAVE_FSEEKO 1
@@ -87,9 +81,15 @@
=C2=A0/* Define to 1 if you have the <inttypes.h> header file. */
=C2=A0#define HAVE_INTTYPES_H 1

+/* Define to 1 if you have the `bz2' library (-lbz2). */
+/* #undef HAVE_LIBBZ2 */
+
=C2=A0/* Define to 1 if you have the `gnurx' library (-lgnurx). */
=C2=A0/* #undef HAVE_LIBGNURX */

+/* Define to 1 if you have the `lzma' library (-llzma). */
+/* #undef HAVE_LIBLZMA */
+
=C2=A0/* Define to 1 if you have the `seccomp' library (-lseccomp). */<= br> =C2=A0/* #undef HAVE_LIBSECCOMP */

@@ -99,6 +99,9 @@
=C2=A0/* Define to 1 if you have the `localtime_r' function. */
=C2=A0#define HAVE_LOCALTIME_R 1

+/* Define to 1 if you have the <lzma.h> header file. */
+/* #undef HAVE_LZMA_H */
+
=C2=A0/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
=C2=A0#define HAVE_MBRTOWC 1

@@ -121,9 +124,7 @@
=C2=A0#define HAVE_MMAP 1

=C2=A0/* Define to 1 if you have the `newlocale' function. */
-#ifdef FREEBSD_XLOCALE_SUPPORT
=C2=A0#define HAVE_NEWLOCALE 1
-#endif

=C2=A0/* Define to 1 if you have the `pread' function. */
=C2=A0#define HAVE_PREAD 1
@@ -210,9 +211,7 @@
=C2=A0#define HAVE_UNISTD_H 1

=C2=A0/* Define to 1 if you have the `uselocale' function. */
-#ifdef FREEBSD_XLOCALE_SUPPORT
=C2=A0#define HAVE_USELOCALE 1
-#endif

=C2=A0/* Define to 1 if you have the `utime' function. */
=C2=A0#define HAVE_UTIME 1
@@ -252,9 +251,7 @@
=C2=A0#define HAVE_WORKING_VFORK 1

=C2=A0/* Define to 1 if you have the <xlocale.h> header file. */
-#ifdef FREEBSD_XLOCALE_SUPPORT
=C2=A0#define HAVE_XLOCALE_H 1
-#endif

=C2=A0/* Define to 1 if you have the <zlib.h> header file. */
=C2=A0#define HAVE_ZLIB_H 1
@@ -334,6 +331,9 @@
=C2=A0# endif
=C2=A0#endif

+/* Enable xzlib compression support */
+/* #undef XZLIBSUPPORT */
+
=C2=A0/* Enable zlib compression support */
=C2=A0#define ZLIBSUPPORT 1

--000000000000a0034e05d4c4d3ff--