Re: indent-2.2.13 does not set a locale

Petr Pisar <[email protected]> Wed, 12 Apr 2023 12:58:50 +0200
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <[email protected]>
--UlUhRG8VVZpBQHuK
Content-Type: multipart/mixed; boundary="QV2EoLXsOaSikaTj"
Content-Disposition: inline


--QV2EoLXsOaSikaTj
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

V=C2=A0Wed, Apr 12, 2023 at 12:35:30PM +0200,=C2=A0Andrej Shadura napsal(a):
> On Wed, 12 Apr 2023, at 12:21, Petr Pisar wrote:
> > I noticed that indent-2.2.13 stopped printing localized messages:
>=20
> > That's because setlocale() is not called in src/indent.c:
> >
> >     #if defined (HAVE_SETLOCALE)
> >         setlocale(LC_ALL, "");
> >     #endif
> >
> > because HAVE_SETLOCALE is not defined in config.h.
> >
> > It seems that configure.ac ported to autoconf-2.71
> > (AC_CHECK_INCLUDES_DEFAULT?) stopped checking for setlocale() and defin=
ing the
> > macro. Actually diffing config.h between 2.2.12 and 2.2.13, both genera=
ted
> > with the same autoconf, shows plenty of removed macros. So HAVE_SETLOCA=
LE
> > might be not the only missing feature.
>=20
> Thanks. That's concerning, I'll have a look.
>=20
I went through HAVE_* and USE_* macros, and it seems that the only macro us=
ed in
code but missing from config.h is HAVE_SETLOCALE. A patch is attached.

-- Petr

--QV2EoLXsOaSikaTj
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="indent-2.2.13-Check-for-setlocale-function.patch"
Content-Transfer-Encoding: quoted-printable

=46rom 3734443b661799b8fa893d4379be62cd1ce96ae0 Mon Sep 17 00:00:00 2001
=46rom: =3D?UTF-8?q?Petr=3D20P=3DC3=3DADsa=3DC5=3D99?=3D <[email protected]>
Date: Wed, 12 Apr 2023 12:43:23 +0200
Subject: [PATCH] Check for setlocale() function
MIME-Version: 1.0
Content-Type: text/plain; charset=3DUTF-8
Content-Transfer-Encoding: 8bit

After modernizing configure.ac, setlocale() stopped to be checked,
HAVE_SETLOCALE defined, and setlocale() called from main(). As
a result indent-2.2.13 stopped printing localized messages.

This patch fixes it.

I checked all HAVE_ macros for their configure-time checks.
HAVE_SETLOCALE was the only missing.

<https://lists.gnu.org/archive/html/bug-indent/2023-04/msg00001.html>

Signed-off-by: Petr P=C3=ADsa=C5=99 <[email protected]>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 92b612d..85f4383 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,7 +48,7 @@ AC_SUBST(localedir)
 AC_CHECK_INCLUDES_DEFAULT
 AC_PROG_EGREP
=20
-AC_CHECK_FUNCS(strchr memcpy memmove utime)
+AC_CHECK_FUNCS(setlocale strchr memcpy memmove utime)
 AC_CHECK_HEADERS(unistd.h string.h malloc.h utime.h sys/utime.h)
=20
 if test "$ac_cv_func_utime" =3D yes
--=20
2.40.0


--QV2EoLXsOaSikaTj--

--UlUhRG8VVZpBQHuK
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEE4/QvzhVoMKgDWObpT9GuwzZa978FAmQ2jt4ACgkQT9GuwzZa
97+oRhAAprFI1/lEgeuwH8qs4I1hwexFAt9G82tOAJWBeFlmlvqx17Oj16jWoqDg
1HrdqYEWObeGpC6Ncib+FHXQ+u2pDQs8vZYmeCVK+KUNBCv4tKRSVLjH02wSmHup
LSHZzXYum2WJpKJ2xYzygnlc0UjW6puum2AFO5qZ05wbgmsHJyDV7oqEXS0Zm0UE
/TiPC3K4v7rZjQeqyBQYL0mJ5PC2DEVLkh8GsS7ZxNkXBNgB569Ig10pu8Loek39
UlpTjzoLwuTDNRjAAKTWIB0iKA5cOwymnMvmo70JgAerFPOarsFfWoDcAEjuxdMH
0mxrVrNB+h6sJXS12jpdsE4dba8ZImaj6ejNSFyagG01OJqynHi4UMnBqpCd8u2Q
PnNUPgaKyReOsn2KTuEOMbNYs0WT5uJ2Ehng+HMCfNbQp1wbO6CdPgE/3DYWz4kn
ETzIKw02Nsvs6Ue/a+kGaFJ/gdS7B5ZzJ4Pawls2BccXOr1w/e8e9lIl6KAQ3Em0
c2cjCsqWhHJUuZ1+bqEJqg2oNAGTS0QGqItq58BWDjgqdONlKCqriMxMiO3TtHIq
thqT46cvej2KZ3cMo/j/r4ku60JdIFw+r2iZOESTdpj9kvazexU/n/XBgciWI3dk
qI2hWz9EozfciDYL8KktRdRu547wqrIItSs4bZ7wDGnv1QvGTY4=
=R7ny
-----END PGP SIGNATURE-----

--UlUhRG8VVZpBQHuK--