Patch Detail
Show a patch.
GET /api/1.1/patches/18099/?format=api
{ "id": 18099, "url": "https://patchwork.libcamera.org/api/1.1/patches/18099/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18099/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20230108214357.12641-3-laurent.pinchart@ideasonboard.com>", "date": "2023-01-08T21:43:57", "name": "[libcamera-devel,v1,2/2] libcamera: base: utils: Support C libraries lacking locale support", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "0e2a62a8471b485da88c7c4b0aeee0ee3efbcfd9", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18099/mbox/", "series": [ { "id": 3702, "url": "https://patchwork.libcamera.org/api/1.1/series/3702/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3702", "date": "2023-01-08T21:43:55", "name": "libcamera Fix compilation with uClibc", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3702/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18099/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18099/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D1718C3292\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 8 Jan 2023 21:44:05 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 41234625CF;\n\tSun, 8 Jan 2023 22:44:05 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 60DDF625CF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 8 Jan 2023 22:44:04 +0100 (CET)", "from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DAECC6DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 8 Jan 2023 22:44:03 +0100 (CET)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1673214245;\n\tbh=ma5lAArjP3pxlwDCj4C5a6tW6F1ZaaPcb5DIgycmRMc=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=V2HNjZ0ZdJJyj7Xi2N0JUI1G0NFmh/XSNmZM6E5ASsvzkRJmz63w2nDetgQMBHDXw\n\tsFk5AS7llvzgO4lfRy98fRJBSJ8EDEZV801/Y6dxeTA3iSNK1DFunh455Wi1la0VCx\n\teybeSPB3+2eIkTZ/r0+EH89kNgXS8EXQd44gxS0ZzFb9XRJPRRM64xS9ztpcVenHl1\n\tTkaTl62cSl5Zz/4kOQqoqUXZtKsuIm03REHvJhIuKzqdLUN/r1uywuyqupFwgqh9Oy\n\tpG5B3df1uHYfoccrwxPs7LkTTwM8whV5GRqLjqx0IjW8p/wlpOrlIaQV1djy2MhciZ\n\tYCSgf6H9SGySQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1673214244;\n\tbh=ma5lAArjP3pxlwDCj4C5a6tW6F1ZaaPcb5DIgycmRMc=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Y0N6alncshtHXtb7qyjBf06Kom2LI9aZOxfaI6r9wo2msHhl32LYjKq1iBdTCyzsx\n\tfsxfFt9G7LweULJPgWGwkP/uG9xPP2+TsXSkToiZTiUPi5FwQ6vNbsE/eY4RxyWqsW\n\t8gjg8STqeKxRKzAEKzqNkZNoc52P7nmV41P5Y6fU=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Y0N6alnc\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 8 Jan 2023 23:43:57 +0200", "Message-Id": "<20230108214357.12641-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.38.2", "In-Reply-To": "<20230108214357.12641-1-laurent.pinchart@ideasonboard.com>", "References": "<20230108214357.12641-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v1 2/2] libcamera: base: utils: Support C\n\tlibraries lacking locale support", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "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>", "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Not all C libraries include support for locale objects (locale_t) and\nthe strto*_l() family of functions. A notable example is uClibc that can\nbe compiled with a hardcoded \"C\" locale. Compilation then fails as the\nnewlocale(), freelocale() and strtod_l() functions are not defined.\n\nFix the compilation breakage by checking for the availability of\nnewlocale(), and fall back to strtod() when the function isn't\navailable. This may not lead to the correct result if support for locale\nobjects isn't available and the locale isn't hardcoded to \"C\", but that\nis such a corner case that we will likely never encounter it.\n\nFixes: e8ae254970cf (\"libcamera: yaml_parser: Use C locale\")\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n meson.build | 4 ++++\n src/libcamera/base/utils.cpp | 12 ++++++++++++\n 2 files changed, 16 insertions(+)", "diff": "diff --git a/meson.build b/meson.build\nindex e86673dd5c0c..7dcd34d3e6b3 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -72,6 +72,10 @@ if cc.has_header_symbol('unistd.h', 'issetugid')\n config_h.set('HAVE_ISSETUGID', 1)\n endif\n \n+if cc.has_header_symbol('locale.h', 'newlocale', prefix : '#define _GNU_SOURCE')\n+ config_h.set('HAVE_NEWLOCALE', 1)\n+endif\n+\n if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOURCE')\n config_h.set('HAVE_SECURE_GETENV', 1)\n endif\ndiff --git a/src/libcamera/base/utils.cpp b/src/libcamera/base/utils.cpp\nindex 4a239427a4d9..ac3e1311995e 100644\n--- a/src/libcamera/base/utils.cpp\n+++ b/src/libcamera/base/utils.cpp\n@@ -464,6 +464,8 @@ std::string toAscii(const std::string &str)\n * \\a b\n */\n \n+#if HAVE_NEWLOCALE\n+\n namespace {\n \n /*\n@@ -493,6 +495,8 @@ Locale cLocale(\"C\");\n \n } /* namespace */\n \n+#endif /* HAVE_NEWLOCALE */\n+\n /**\n * \\brief Convert a string to a double independently of the current locale\n * \\param[in] nptr The string to convert\n@@ -506,7 +510,15 @@ Locale cLocale(\"C\");\n */\n double strtod(const char *__restrict nptr, char **__restrict endptr)\n {\n+#if HAVE_NEWLOCALE\n \treturn strtod_l(nptr, endptr, cLocale.locale());\n+#else\n+\t/*\n+\t * If the libc implementation doesn't provide locale object support,\n+\t * assume that strtod() is locale-independent.\n+\t */\n+\treturn strtod(nptr, endptr);\n+#endif\n }\n \n } /* namespace utils */\n", "prefixes": [ "libcamera-devel", "v1", "2/2" ] }