[{"id":1505,"web_url":"https://patchwork.libcamera.org/comment/1505/","msgid":"<20190426103058.GB5054@pendragon.ideasonboard.com>","date":"2019-04-26T10:30:58","subject":"Re: [libcamera-devel] [PATCH v2 1/2] meson: check if\n\tsecure_getenv() is present","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Giulio,\n\nThank you for the patch.\n\nOn Fri, Apr 26, 2019 at 10:42:19AM +0200, Giulio Benetti wrote:\n> Not all libc make secure_getenv() available, this could lead to build\n> failure on certain build systems.\n> \n> Check if secure_getenv() and emit #define HAVE_SECURE_GETENV to config.h\n\n\"if secure_getenv() is available\" ?\n\n> Include config.h to every c/c++ file during building by adding `-include\n> config.h` to project arguments for both c and c++.\n> \n> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>\n> ---\n> Changes:\n> V1->V2: use common_arguments to -include config.h and move secure_getenv()\n>         check before common_arguments list.\n> \n>  meson.build | 11 +++++++++++\n>  1 file changed, 11 insertions(+)\n> \n> diff --git a/meson.build b/meson.build\n> index 6e68c3e..9099909 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -13,8 +13,19 @@ project('libcamera', 'c', 'cpp',\n>  #       generated from this too.\n>  api_version = '0.1'\n>  \n> +cc = meson.get_compiler('c')\n> +config_h = configuration_data()\n> +\n> +if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix: '#define _GNU_SOURCE')\n\nThis doesn't need to be fixed as part of this patch series, but\nshouldn't we also define GNU_SOURCE in our common arguments ?\n\n> +    config_h.set('HAVE_SECURE_GETENV', 1)\n> +else\n> +    message('C library does not support secure_getenv, using getenv instead')\n\nThis isn't completely accurate, we condition that with issetugid(), it's\nnot as bad as using getenv() unconditionally. I wonder if we shouldn't\njust drop this message.\n\nApart from that,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +endif\n> +configure_file(output: 'config.h', configuration: config_h)\n> +\n>  common_arguments = [\n>      '-Wno-unused-parameter',\n> +    '-include', 'config.h',\n>  ]\n>  \n>  c_arguments = common_arguments","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 99102600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Apr 2019 12:31:09 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(net-37-182-44-227.cust.vodafonedsl.it [37.182.44.227])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2094B5F;\n\tFri, 26 Apr 2019 12:31:09 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1556274669;\n\tbh=86MT5720+ImlleTIfW5fxcN6VZJMu7cRhKI/RFr7+Fk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=QoHutIcvusfhVqVPSxjW06scihLuZOXV0w6+OlEjH0MvUj9U9+UYDhQBUNiVJSdxk\n\tMASBPE8+//zYKcS8upRAI6/pqXnrRGEDs1g0ugnbjJYPV5OFqMyslTJntMLIcMgTgx\n\t5aWmO4Pnzlo0b1MkFwkPxma9qU/AlD9X1Q6JZoWo=","Date":"Fri, 26 Apr 2019 13:30:58 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Giulio Benetti <giulio.benetti@micronovasrl.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190426103058.GB5054@pendragon.ideasonboard.com>","References":"<20190424110044.12608-1-giulio.benetti@micronovasrl.com>\n\t<20190426084220.71500-1-giulio.benetti@micronovasrl.com>\n\t<20190426084220.71500-2-giulio.benetti@micronovasrl.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190426084220.71500-2-giulio.benetti@micronovasrl.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 1/2] meson: check if\n\tsecure_getenv() is present","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 26 Apr 2019 10:31:09 -0000"}}]