Re[2]: [patches] [PATCH] Fix FreeBSD build

Konstantin Belyavskiy k.belyavskiy at tarantool.org
Wed Mar 7 18:11:41 MSK 2018




>Среда,  7 марта 2018, 15:58 +03:00 от Konstantin Osipov <kostja at tarantool.org>:
>
>* Konstantin Belyavskiy < k.belyavskiy at tarantool.org > [18/03/07 13:58]:
>> As I checked _POSIX_C_SOURCE yesterday, it doesn't work on OSX.
>> Also we are already using _GNU_SOURCE flag in 
>> src/box/lua/info.c and i n various third-party modules.
>
>BTW, this is a good proof why this approach is broken.
>
>If you look at the original patch, git show d00ebc91, you'll see
>that gnu source was added to compile a piece of code which is no
>longer there. The code is now gone, and the gnuism is stuck in the
>source forever. 
>
>If you look at the patch itself, it was a yet another quick fix
>made in a rush and most likely pushed without thorough
>consideration.
>
>Please don't follow that path.
>
>We should either make a decision to use getline() and make a
>compatibility wrapper in third_party/compat, or get rid of it.
>
>> I can use cmake, but again I think there are two options:
>> 1. Using getline with _GNU_SOURCE flag as in man example.
>> 2. Get rid of getline
>
>Yes, please get rid of getline(). You can make a compatibility
>wrapper if you like, in third_party/compat, which is the same as
>getting rid of it. You can use fscanf(). You can dig up how to
>properly make POSIX standard api available on Mac OS X and add
>this define to trivia/config.h, so that we never again have an
>issue with POSIX functions on MAC OS X. There are so many sound
>alternatives, please just do one of them. 
I personally think that  fscanf is a bad alternative to  getline since last
allocates memory itself so getline is quite safe and we don't need to
reinvent the wheel. Maybe wrapper will be a better option.

Regarding to make POSIX api available on OSX I will try it during
long weekend.
As for now I can use _POSIX_C_SOURCE for BSD only or for OS
except OSX.
>-- 
>Konstantin Osipov, Moscow, Russia,  +7 903 626 22 32
>http://tarantool.org -  www.twitter.com/kostja_osipov


Best regards,
Konstantin Belyavskiy
k.belyavskiy at tarantool.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20180307/d4585e43/attachment.html>


More information about the Tarantool-patches mailing list