libc: remove gets

Authored by emaste on Sep 9 2017, 8:33 PM.



During Paul Vixie's vBSDcon 2017 talk.

Diff Detail

Lint Skipped
Unit Tests Skipped
emaste created this revision.Sep 9 2017, 8:33 PM
emaste mentioned this in D12295: Kill gets().
gnn accepted this revision.Sep 9 2017, 8:44 PM
This revision is now accepted and ready to land.Sep 9 2017, 8:44 PM
emaste updated this revision to Diff 33726.Oct 5 2017, 6:23 PM

leave gets in old symver

gets is unsafe and shouldn't be used (for many years). Leave it in the
existing symbol version so anything that previously linked aginst it
still runs, but do not allow new software to link against it.

This revision now requires review to proceed.Oct 5 2017, 6:23 PM
ngie accepted this revision.Oct 6 2017, 3:47 AM
This revision is now accepted and ready to land.Oct 6 2017, 3:47 AM
allanjude accepted this revision.Oct 6 2017, 3:57 AM
kib added a subscriber: kib.Oct 6 2017, 12:52 PM

Can you put the readelf -a output from the patched libc somewhere ?


Why this chunk is needed ? Esp. the compat definition.

dim added a comment.Oct 6 2017, 1:46 PM

I take it an exp-run will be done, or has already been done? There's surely some old software in ports that uses this function. :)


I'm not sure if this should be unconditional. If somebody insists on using C++11 or earlier, gets should be available, even if it is unwise to use. (The same could be said for e.g. strcpy and the like.)

If it is conditional on the C++ version, this change could also be upstreamed.

emaste added a comment.Oct 6 2017, 3:12 PM

exp-run is PR222796.


Well, in this review we've explicitly made gets unavailable, regardless of what ISO C or POSIX say, and the same argument applies to C++.


This gets() test case won't link unless I can access the actual symbol. Is there another way to explicitly call gets@FBSD1.0? I thought about just dropping the test case altogether, but it seems reasonable to keep it.

kib added inline comments.Oct 6 2017, 3:24 PM

Ah, so you want to test the semi-hidden libc function still ? I think you need to explain the intent in the comment somewhere.

kib accepted this revision.Oct 6 2017, 7:18 PM

I am fine with the libc bits of the patch.

eadler accepted this revision.Jan 7 2018, 5:46 PM