From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luca Boccassi Subject: Re: [PATCH iproute2] Use libbsd for strlcpy if available Date: Wed, 31 Oct 2018 17:54:51 +0000 Message-ID: <1541008491.29722.36.camel@debian.org> References: <20181029104650.24924-1-bluca@debian.org> <20181031080922.2ff123eb@xeon-e3> Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-ewys0i0/EU5ZAjNbR7ke" Cc: netdev@vger.kernel.org, dsahern@gmail.com To: Stephen Hemminger Return-path: Received: from mail-wm1-f66.google.com ([209.85.128.66]:53748 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729437AbeKACx6 (ORCPT ); Wed, 31 Oct 2018 22:53:58 -0400 Received: by mail-wm1-f66.google.com with SMTP id v24-v6so6179060wmh.3 for ; Wed, 31 Oct 2018 10:54:55 -0700 (PDT) In-Reply-To: <20181031080922.2ff123eb@xeon-e3> Sender: netdev-owner@vger.kernel.org List-ID: --=-ewys0i0/EU5ZAjNbR7ke Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2018-10-31 at 08:09 -0700, Stephen Hemminger wrote: > On Mon, 29 Oct 2018 10:46:50 +0000 > Luca Boccassi wrote: >=20 > > If libc does not provide strlcpy check for libbsd with pkg-config > > to > > avoid relying on inline version. > >=20 > > Signed-off-by: Luca Boccassi > > --- > > This allows distro maintainers to be able to choose to reduce > > duplication and let this code be maintained in one place, in the > > external library. > >=20 >=20 > I like the idea, but it causes warnings on Debian testing, and maybe > other distros. >=20 > ipnetns.c:2: warning: "_ATFILE_SOURCE" redefined > =C2=A0#define _ATFILE_SOURCE > =C2=A0 > In file included from /usr/include/x86_64-linux-gnu/bits/libc-header- > start.h:33, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0from /usr/include/string.h:26, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0from /usr/include/bsd/string.h:30, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0from : > /usr/include/features.h:326: note: this is the location of the > previous definition > =C2=A0# define _ATFILE_SOURCE 1 >=20 >=20 > Please figure out how to handle this and resubmit.=C2=A0=C2=A0SUSE open b= uild > service might > also work to test multiple distro's Ah missed that. That happens because features.h defines _ATFILE_SOURCE to 1, but ip/ipnetns.c defines it without a value. According to the spec either way doesn't change the result. This happens because of the quick hack of using -include /usr/include/bsd/string.h which was, well, a quick hack and didn't require to add the include manually everywhere strlcpy was used, even in the future. But it has side effects like this. So I'll send v2 with a less hacky fix, which means defining HAVE_LIBBSD in configure and doing #ifdef HAVE_LIBBSD #include in every file. It also means that this needs to be done for every future use of strlcpy, or the build with libbsd will break. If you or David prefer the hacky way, I can instead send a v3 that does the quick hack, and also changes _ATFILE_SOURCE to 1 so that there is no complaint from the compiler, as the values will be the same. --=20 Kind regards, Luca Boccassi --=-ewys0i0/EU5ZAjNbR7ke Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE6g0RLAGYhL9yp9G8SylmgFB4UWIFAlvZ7GsACgkQSylmgFB4 UWL2vQf/erK970l80osu0NQsFaV0F0wb0abSjNjDGLVQnLL/O693Keln34bahnFK IGdH10Cd00ycHSBSRZIh+b3ZekZvAQaV7faN+KmAJhGoDABt+fc+VUGBoBpcHcyT mvYeprgZ+4B695qDOrKpbHAZvj4GkDQtL6+7xp5dTHzt7MndjUfwCUWjTZ91iu4j TVDt5KRBEzwhkTB7MJt9WdHpl1dX29ST4gQJmHRbgtPp9uuIqWvxbxvfXV8xYHUa jjDvfFn+Q6hRM45hNcBSQj4GQKJ3Ltub+tzp0egY8c8SDbSS1Of7THJrKkLoV+2y FNYiU2eVwtZVpsnrdUzGZO6nKT3ODw== =SfnF -----END PGP SIGNATURE----- --=-ewys0i0/EU5ZAjNbR7ke--