From owner-svn-src-head@freebsd.org Wed Aug 24 20:51:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0118BC5A45; Wed, 24 Aug 2016 20:51:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 746CF1F96; Wed, 24 Aug 2016 20:51:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 67EFF1407; Wed, 24 Aug 2016 20:51:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 297C81AC1B; Wed, 24 Aug 2016 20:51:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 5JYWbrLOL5mH; Wed, 24 Aug 2016 20:50:50 +0000 (UTC) Subject: Re: svn commit: r303988 - head/lib/libc/gen DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 649051AC14 To: Eric van Gyzen , Ed Schouten References: <201608120703.u7C73whf007189@repo.freebsd.org> <9ae1c2eb-02ad-b8fe-6aff-7e17e955607a@FreeBSD.org> <2632f5f8-d765-3df7-74d7-da878eb4b7a8@FreeBSD.org> <62adcb77-490e-0691-0942-9218c1d55b68@FreeBSD.org> <8ef5b79d-5e7e-d5be-db8e-ae5284abdc31@FreeBSD.org> <7d2b7798-d444-427e-4790-3133977d339c@FreeBSD.org> Cc: svn-src-head@freebsd.org, jilles@freebsd.org, svn-src-all@freebsd.org, src-committers , Ed Schouten From: Bryan Drewery Organization: FreeBSD Message-ID: <069cbdf0-ed53-f939-49f6-645e0c557d70@FreeBSD.org> Date: Wed, 24 Aug 2016 13:50:49 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <7d2b7798-d444-427e-4790-3133977d339c@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BRBKPh2WUqT2q60as3HkMkAnnIHROCJh4" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 20:51:00 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BRBKPh2WUqT2q60as3HkMkAnnIHROCJh4 Content-Type: multipart/mixed; boundary="ghMIj2RWlQmjbe9FJkD2bacGBFlH5ivWR" From: Bryan Drewery To: Eric van Gyzen , Ed Schouten Cc: svn-src-head@freebsd.org, jilles@freebsd.org, svn-src-all@freebsd.org, src-committers , Ed Schouten Message-ID: <069cbdf0-ed53-f939-49f6-645e0c557d70@FreeBSD.org> Subject: Re: svn commit: r303988 - head/lib/libc/gen References: <201608120703.u7C73whf007189@repo.freebsd.org> <9ae1c2eb-02ad-b8fe-6aff-7e17e955607a@FreeBSD.org> <2632f5f8-d765-3df7-74d7-da878eb4b7a8@FreeBSD.org> <62adcb77-490e-0691-0942-9218c1d55b68@FreeBSD.org> <8ef5b79d-5e7e-d5be-db8e-ae5284abdc31@FreeBSD.org> <7d2b7798-d444-427e-4790-3133977d339c@FreeBSD.org> In-Reply-To: <7d2b7798-d444-427e-4790-3133977d339c@FreeBSD.org> --ghMIj2RWlQmjbe9FJkD2bacGBFlH5ivWR Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 8/24/16 1:30 PM, Bryan Drewery wrote: > On 8/24/16 1:26 PM, Eric van Gyzen wrote: >> On 08/24/2016 15:16, Bryan Drewery wrote: >>> On 8/24/16 1:12 PM, Eric van Gyzen wrote: >>>> On 08/24/2016 15:01, Ed Schouten wrote: >>>>> 2016-08-24 21:53 GMT+02:00 Bryan Drewery : >>>>>> Is it possible to cause the use of these old prototypes to print a= >>>>>> warning and note that they are deprecated/unsafe? >>>>> >>>>> That's a good question. In theory, we could annotate these function= s >>>>> with __attribute__((__deprecated__)): >>>>> >>>>> https://gcc.gnu.org/onlinedocs/gcc-3.3.4/gcc/Type-Attributes.html >>>>> >>>>> But I'm actually too afraid to use it. In the worst case it may cau= se >>>>> the compiler to generate a warning even when basename()/dirname() i= s >>>>> used correctly, as __old_* will still be part of the compiled >>>>> expression. >>>> >>>> Could __warn_references() be used, as libc currently does for gets()= and >>>> others? >>>> >>>> Eric >>>> >>> >>> /usr/include/stdio.h:extern char *gets (char *__s) __wur >>> __attribute_deprecated__; >>> /usr/include/x86_64-linux-gnu/sys/cdefs.h:# define >>> __attribute_deprecated__ __attribute__ ((__deprecated__)) >>> >>> __wur being warning about unused result. >> >> /usr/src/lib/libc/stdio/gets.c:__warn_references(gets, "warning: this >> program uses gets(), which is unsafe."); >=20 > Ah! Ours! I misunderstood and thought about the FORTIFY_SOURCE glibc st= uff. >=20 > This is a linker warning. It would not be as obvious which line is the= > problem but would still tell the user they have potentially unsafe code= =2E > They also may not care if not using threads. Ah no it is specific, great: > xinstall.o: In function `makelink': > /root/svn/releng/11.0/usr.bin/xinstall/xinstall.c:688: warning: warning= : this program uses basename(const char *), which is deprecated and threa= d-unsafe. Not sure what I think about it though. >=20 > We would need to move old_dirname/basename into their own .c files to > use this I think. Playing around with that... >=20 >> >>> As for actually using it here, I tried adding it onto the >>> _old_dirname/basename prototypes. It produces an error, fine, in the= >>> bootstrap build for xinstall it would not error, great. However, for= >>> building xinstall on head where it will not use the __old_dirname and= >>> will use the new dirname@FBSD_1.5, it _still_ complains about using t= he >>> __old_dirname() prototype via __generic and errors in the wrong case.= >=20 >=20 --=20 Regards, Bryan Drewery --ghMIj2RWlQmjbe9FJkD2bacGBFlH5ivWR-- --BRBKPh2WUqT2q60as3HkMkAnnIHROCJh4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJXvgipAAoJEDXXcbtuRpfPsFIIAM8GOvsK5ugiOExZ/7DpS+FW 1IGwgjLESp1bfWgOkrC1jkPctaqrYf7cptmUPkpXW8tD6tsZDRa2Mhn0EzpZkgFu cpVOVynuvI0qv2N2Nmw+2eDb8wmUhGvgGcMckpVeg/FT0K2VcFvA5VhsHw+g6Y5B z+7tqtCL7gqA0WiR82S67fo9rhnCfrB/k/xwB7mQ5YhgNicfrwXK68TCbTFPCbWB jTSBZHhKI10ukfhPCcRSxebafTcGjwsVBG3hnk0N1PQ2YSVBWMrCj3GMgI6Mg0ns 9eHZJNCBYUzQq3rWpRqXsO/T/geDg6RMG9Wnth6nSKrebJX5W213C01WN6sU+q0= =jjLV -----END PGP SIGNATURE----- --BRBKPh2WUqT2q60as3HkMkAnnIHROCJh4--