[{"id":25549,"web_url":"https://patchwork.libcamera.org/comment/25549/","msgid":"<166662255873.2560709.15565451945392850528@Monstersaurus>","date":"2022-10-24T14:42:38","subject":"Re: [libcamera-devel] [PATCH 05/11] Removes references to\n\tstd::filesystem, which Android 11's toolchain does not support.","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Nicholas Roth via libcamera-devel (2022-10-24 06:55:37)\n> From: Nicholas Roth <nicholas@rothemail.net>\n> \n> ---\n>  src/android/camera_hal_config.cpp | 9 +--------\n>  1 file changed, 1 insertion(+), 8 deletions(-)\n> \n> diff --git a/src/android/camera_hal_config.cpp b/src/android/camera_hal_config.cpp\n> index bacfe4b9..c06c993d 100644\n> --- a/src/android/camera_hal_config.cpp\n> +++ b/src/android/camera_hal_config.cpp\n> @@ -6,7 +6,6 @@\n>   */\n>  #include \"camera_hal_config.h\"\n>  \n> -#include <filesystem>\n>  #include <stdlib.h>\n>  #include <string>\n>  \n> @@ -160,13 +159,7 @@ CameraHalConfig::CameraHalConfig()\n>   */\n>  int CameraHalConfig::parseConfigurationFile()\n>  {\n> -       std::filesystem::path filePath = LIBCAMERA_SYSCONF_DIR;\n> -       filePath /= \"camera_hal.yaml\";\n> -       if (!std::filesystem::is_regular_file(filePath)) {\n> -               LOG(HALConfig, Debug)\n> -                       << \"Configuration file: \\\"\" << filePath << \"\\\" not found\";\n> -               return -ENOENT;\n> -       }\n> +       std::string filePath = LIBCAMERA_SYSCONF_DIR \"/camera_hal.yaml\";\n>  \n>         File file(filePath);\n\nGiven the above checks if the file is not found, could / should we\nreplace that with:\n\n\t  if (!file.exists()) {\n\t  \tLOG(HALConfig, Error)\n\t\t\t<< \"Configuration file: \\\"\" << filePath << \"\\\" not found\";\n\t\treturn -ENOENT;\n\t  }\nhere?\n\n>         if (!file.open(File::OpenModeFlag::ReadOnly)) {\n> -- \n> 2.34.1\n>","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 D74F7BDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Oct 2022 14:42:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 491E862F1B;\n\tMon, 24 Oct 2022 16:42:44 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1C1A462EC6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Oct 2022 16:42:42 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8F3028BF;\n\tMon, 24 Oct 2022 16:42:41 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666622564;\n\tbh=5E2wD0qNhBlVr0wqwoRXKTXENudNTG66l/SptlLD6wY=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=A2VQAjekwt+GViDKXCIU5eKy+g08m+I0GIiZWQgWLt/SUHg829AICLADeZAx6/Mc6\n\t2T1okW5R8xURknJ0WvwAux1R11+qPKw9/UxbAfkr/n0t1TJP9Xz8vRJgZTIK56WqhI\n\tEJnwsGF7WRyEr3SI5tqBXB5IpDFpUk1x9lEHmERWOmgQR12XwZNA+FNkN65nQb2n4N\n\tfmh/tzu5rYgHsjhj1awMaZX0fKEEmskbt2SLbIZnmWSzJnPOcKjwAGlhI+n0DLYjEn\n\teMbd5bWHu+51iDOiqC/+IQJ28+bL7X0ekc9laU2FY038dsSb/OYj+kFtorRtQGN6Ka\n\t5voop7DT9llgw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1666622561;\n\tbh=5E2wD0qNhBlVr0wqwoRXKTXENudNTG66l/SptlLD6wY=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=FuGz9qzNiJd4nmWqmcVbkrqpV/YCpXiNi9G3o4Wk4h+/0aJUps8zFECSpiKKEVzvi\n\tOYIMTUifgCVI/1e7LZe5qDtfGqYoCQDrCOdHI+WnGkfAWrzhQ9AxrKOqVxmlGj3f9n\n\tSuzwJqNrsTLdXN2AJol3oOqcnuttwmtL6iK49OAc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"FuGz9qzN\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20221024055543.116040-6-nicholas@rothemail.net>","References":"<20221024055543.116040-1-nicholas@rothemail.net>\n\t<20221024055543.116040-6-nicholas@rothemail.net>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 24 Oct 2022 15:42:38 +0100","Message-ID":"<166662255873.2560709.15565451945392850528@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH 05/11] Removes references to\n\tstd::filesystem, which Android 11's toolchain does not 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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"nicholas@rothemail.net","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25550,"web_url":"https://patchwork.libcamera.org/comment/25550/","msgid":"<36B1106D-152E-4170-A0CE-DA1E9DD3AE2B@rothemail.net>","date":"2022-10-24T14:48:28","subject":"Re: [libcamera-devel] [PATCH 05/11] Removes references to\n\tstd::filesystem, which Android 11's toolchain does not support.","submitter":{"id":137,"url":"https://patchwork.libcamera.org/api/people/137/","name":"Nicholas Roth","email":"nicholas@rothemail.net"},"content":"I was kind of surprised to see this actually because right after creating the File object, we then check if it was successfully created and print an error otherwise. If I understand correctly, the std::filesystem-based check was redundant.\n\nPlease correct me if I’m wrong though.","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 D96E5BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Oct 2022 14:49:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3366362F1E;\n\tMon, 24 Oct 2022 16:49:24 +0200 (CEST)","from mail-oa1-x34.google.com (mail-oa1-x34.google.com\n\t[IPv6:2001:4860:4864:20::34])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E5CB62EC6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Oct 2022 16:49:22 +0200 (CEST)","by mail-oa1-x34.google.com with SMTP id\n\t586e51a60fabf-13b6336a1acso6595376fac.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Oct 2022 07:49:22 -0700 (PDT)","from smtpclient.apple ([2600:100c:b011:5426:2d72:c504:5414:6058])\n\tby smtp.gmail.com with ESMTPSA id\n\tz22-20020a4a2256000000b004767df8f231sm28757ooe.39.2022.10.24.07.49.19\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tMon, 24 Oct 2022 07:49:19 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666622964;\n\tbh=USs8/2JVVnAHbpLsSpw9bLVbsp/0UX8vsbec+WC1Yuo=;\n\th=Date:References:In-Reply-To:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=0HQ1IfM9I36ilCexKCts8YSti+EJzvNgrFtV0SUHZxJYOyOQ5S1JZfgNVP+NucWLv\n\toc1VPXOoJENHe0BljivPyI1Yjrr9wp1AmD57qT9aXd3v1rlshXbpPd2QSV6+HZTTwf\n\t8HRIQ4boSiW2/LR5U01vhCMw672vCxBQxN4Y/KQdfjR6m+Ddd2UWjnjCFKhwt0x4D2\n\to6BVZydHUZ7AxbvHpqKROP1Gx6U8w5umZ8ZnPalJxqje+kf6KlSGmiILxFKlxklItr\n\tnBcnxvg16CvIuPF5yMIuHhl76OjsNsGJtViSTHHF+g9L2iFiY8cCjRlkhh/Q+Li6Bg\n\ttNFK3BTJm1S7A==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=rothemail-net.20210112.gappssmtp.com; s=20210112;\n\th=to:in-reply-to:cc:references:message-id:date:subject:mime-version\n\t:from:content-transfer-encoding:from:to:cc:subject:date:message-id\n\t:reply-to; bh=USs8/2JVVnAHbpLsSpw9bLVbsp/0UX8vsbec+WC1Yuo=;\n\tb=gFYSWuXAe4I1nVQJST+YUlXosj3jy3WMGlLFaEEaKUgmbIUjQ6BSn83j00u+lA2fCT\n\tIRfLqLcH2HjUSRexC5oAqS4dY8xwcEYBFuXIQRUiL98WN+OYtDcmDU49hhBFb4PDJAlL\n\tZICbUYkMaSQ7qqapihVs+yeY4edPd1eoSkuTxbt5BMyIuzvMO3Xnjb1xZES3fQ9z2PxZ\n\t32+XhCO5YP0ijryiDPgV1P971nokTsY5we9Z6MIISe8kOaDR10aJk/PSAwkAfJD/T/Qq\n\tZoKWjnnix5To6YXto/4E/BxYuw3PhYjeyDKE8ryQfODPfBk6+9FO4FqQpr2CjJ9zBSsu\n\t2w9Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=rothemail-net.20210112.gappssmtp.com\n\theader.i=@rothemail-net.20210112.gappssmtp.com header.b=\"gFYSWuXA\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=to:in-reply-to:cc:references:message-id:date:subject:mime-version\n\t:from:content-transfer-encoding:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=USs8/2JVVnAHbpLsSpw9bLVbsp/0UX8vsbec+WC1Yuo=;\n\tb=ENWueUETq7YlbtYhoYKAjbBroZ6x4vmOMmb+v0EnsZ6c5M7T7xjSWCjwq87754Ldqd\n\tLF/Vq3DkoR8Xy4s7//EqBQhqR4mJSQhuhZ5RHFosNACdTjQBu559bYkQ36oYmm2ljOnk\n\tzVSAhi7+8o4AkR8ImVvSuWr7WMI6Jd1neHM5gSoFhg6DHzjZPqYOM82wHCnf/H+5FtWa\n\ta85gSl691kI38bLUnbQLCFSfFqYOL1UhBCgbZVSbjTlZMTpLYHYncDh4CoB+YlYe3AYX\n\teOpQnMm/3baANJ+h9+zY4upUWrL+77AQih1afTzY3JmDhsMBi8WxOYaQqUIbUB9SwCHA\n\tM4Cw==","X-Gm-Message-State":"ACrzQf2M3WtMxIEzp4HnmYMvxi2uBA++q97vAyVUVzLr4Qabf9ROkNOL\n\tFj035jNljQ0tIe56ktvOg5KcTpGa0thnfg==","X-Google-Smtp-Source":"AMsMyM4MMM22XmHCwT82KvRFCV0afy/3wsE7KUWXpF0W32q4EbQCHKlLtRMgkl0QPbf3tUJLbEn5TQ==","X-Received":"by 2002:a05:6871:454:b0:13b:a5b6:c900 with SMTP id\n\te20-20020a056871045400b0013ba5b6c900mr3818810oag.291.1666622959828; \n\tMon, 24 Oct 2022 07:49:19 -0700 (PDT)","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","Mime-Version":"1.0 (1.0)","Date":"Mon, 24 Oct 2022 09:48:28 -0500","Message-Id":"<36B1106D-152E-4170-A0CE-DA1E9DD3AE2B@rothemail.net>","References":"<166662255873.2560709.15565451945392850528@Monstersaurus>","In-Reply-To":"<166662255873.2560709.15565451945392850528@Monstersaurus>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","X-Mailer":"iPhone Mail (20A362)","Subject":"Re: [libcamera-devel] [PATCH 05/11] Removes references to\n\tstd::filesystem, which Android 11's toolchain does not 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":"Nicholas Roth via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Nicholas Roth <nicholas@rothemail.net>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25551,"web_url":"https://patchwork.libcamera.org/comment/25551/","msgid":"<166662540573.2560709.1622194870807186144@Monstersaurus>","date":"2022-10-24T15:30:05","subject":"Re: [libcamera-devel] [PATCH 05/11] Removes references to\n\tstd::filesystem, which Android 11's toolchain does not support.","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Nicholas Roth (2022-10-24 15:48:28)\n> I was kind of surprised to see this actually because right after\n> creating the File object, we then check if it was successfully created\n> and print an error otherwise. If I understand correctly, the\n> std::filesystem-based check was redundant.\n> \n> Please correct me if I’m wrong though.\n\nIt could be seen as redundant yes. I suspect it was to clearly mark the\ndifference between the file failing to open, and not being there. But as\n\"man 2 open\" states:\n\n        ENOENT O_CREAT is not set and the named file does not exist.\n\nI expect that we should get a -ENOENT if the file isn't there when we\ntry to call File.open().\n\nFile.open() at [0] will only set O_CREAT if the mode is WriteOnly or\nReadWrite is used, and here we explicitly use ReadOnly at [1].\n\nSo I think removing the check entirely is fine and reasonable with a\nclearly updated commit message, also explaining the redundancy and that\nit's safe to remove without changing the underlying functionality.\n\nWell it might be a very small subtle difference between the\nimplementation that's removed and returning -ENOENT if it doesn't exist,\nas we're perhaps not checking that it's a \"regular file\" but I don't\nthink it's too crucial.\n\nPerhaps a note in the commit that we no longer validate it's a regular\nfile, but expect it to be readable, and otherwise parsed by the\nparseConfigFile() to validate the content.\n\n\n\n[0] https://git.libcamera.org/libcamera/libcamera.git/tree/src/libcamera/base/file.cpp#n157\n[1] https://git.libcamera.org/libcamera/libcamera.git/tree/src/android/camera_hal_config.cpp#n172\n\n--\nKieran","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 560B3BDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Oct 2022 15:30:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9B05F62F1E;\n\tMon, 24 Oct 2022 17:30:10 +0200 (CEST)","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 DB5F562EC6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Oct 2022 17:30:08 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6335F8BF;\n\tMon, 24 Oct 2022 17:30:08 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666625410;\n\tbh=eP6OLRwDzI76tx5S5eHAU10YhDT9SAJ1N4+gnQ4D/fA=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=NtVXOOcSmSfri3qGPqsEkRnQt93IF7ioAbcYZlXnQn7ibfQ4CR3aJ2iVxvg5LNndX\n\t1uAyrLZTU2jMuem0Zf2ykh2zIL1Q7HSr9PQbruCxFJdJndWFouxOyfPAUWvcdgLnG4\n\tHGhCu5GiFpKAg5hyjqViAinbWei8XsBrB800YBtGAyLgOISz2QxWPKp44GwiJ70r/C\n\tfsKezvhD8TAe0wQJqXz3zjrexwQCyAEkSvFeNvuyhtHJ6erFohoSiBWLbPXClEvltP\n\t354rUnJWoSXKPfHGdGWaoLrIVsoHOW94FF1Tmkog7P2nH3s/5t0b3Ex4g9YIfIVALd\n\tAjoVrVOHN+gQQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1666625408;\n\tbh=eP6OLRwDzI76tx5S5eHAU10YhDT9SAJ1N4+gnQ4D/fA=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=BqBbIRWeQcxzsRUgNMYGV5ig2rBJaNxS/YD7/zZSpxIDpytlolZY+y/1ZcMSfaOBD\n\tekRpeuv8V9FZ31x/cym0SpmoTSxMF+Jk+tsJ8y7LyV56u2/24obQHx/YtB0b2dDSiE\n\twvByhUQI1pXFt3CTtPmv8LAp6zGLTRpw2mcvez1o="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"BqBbIRWe\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<36B1106D-152E-4170-A0CE-DA1E9DD3AE2B@rothemail.net>","References":"<166662255873.2560709.15565451945392850528@Monstersaurus>\n\t<36B1106D-152E-4170-A0CE-DA1E9DD3AE2B@rothemail.net>","To":"Nicholas Roth <nicholas@rothemail.net>","Date":"Mon, 24 Oct 2022 16:30:05 +0100","Message-ID":"<166662540573.2560709.1622194870807186144@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH 05/11] Removes references to\n\tstd::filesystem, which Android 11's toolchain does not 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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25552,"web_url":"https://patchwork.libcamera.org/comment/25552/","msgid":"<Y1bMdCPWXCruLMpC@pendragon.ideasonboard.com>","date":"2022-10-24T17:33:40","subject":"Re: [libcamera-devel] [PATCH 05/11] Removes references to\n\tstd::filesystem, which Android 11's toolchain does not support.","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Nicholas,\n\nOn Mon, Oct 24, 2022 at 09:48:28AM -0500, Nicholas Roth via libcamera-devel wrote:\n> I was kind of surprised to see this actually because right after\n> creating the File object, we then check if it was successfully created\n> and print an error otherwise. If I understand correctly, the\n> std::filesystem-based check was redundant.\n> \n> Please correct me if I’m wrong though.\n\nChecking the file.open() return value will indeed catch this, but that\nwill result in a different behaviour. The current code reads as\n\n\tstd::filesystem::path filePath = LIBCAMERA_SYSCONF_DIR;\n\tfilePath /= \"camera_hal.yaml\";\n\tif (!std::filesystem::is_regular_file(filePath)) {\n\t\tLOG(HALConfig, Debug)\n\t\t\t<< \"Configuration file: \\\"\" << filePath << \"\\\" not found\";\n\t\treturn -ENOENT;\n\t}\n\n\tFile file(filePath);\n\tif (!file.open(File::OpenModeFlag::ReadOnly)) {\n\t\tint ret = file.error();\n\t\tLOG(HALConfig, Error) << \"Failed to open configuration file \"\n\t\t\t\t      << filePath << \": \" << strerror(-ret);\n\t\treturn ret;\n\t}\n\nIf the first check fails, the function prints a Debug message and\nreturns -ENOENT. The HAL configuration file is mandatory, so we don't\nwant to print an Error message in that case, it would confuse the user.\nThen, if the file is found, but we can't open it, an error message is\nprinted, as that's not a valid situation.\n\nThis behaviour could be replicated by using file.exist() as Kieran\nproposed, before opening the file object. There would still be a very\nsmall difference in behaviour, as File::exist() will return true for\nspecial files (pipes, character or block devices, ...) while\nstd::filesystem::is_regular_file() doesn't, but I think that's such a\ncorner case that it doesn't matter much.\n\nBy the way, if that's not too difficult in your e-mail client, could you\navoid removing all context when replying ? It makes reading your e-mails\nmore difficult otherwise.","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 50CF9BDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Oct 2022 17:34:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 79F4562F1E;\n\tMon, 24 Oct 2022 19:34:07 +0200 (CEST)","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 6073862EC6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Oct 2022 19:34:06 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AA0248BF;\n\tMon, 24 Oct 2022 19:34:05 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666632847;\n\tbh=EqAtzdMXv/DZBVipSHxc7lhf3CRhBHlPHBkT/3ZGrQ4=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=GSyQoMHwRvvJkoVdaDdH+BXqjz8312iyAOwASQ3/uZwSYogQKDVbmYjJ6NsZ82FPs\n\t57urzeX20PARo+Qlky7f0b1cRjhKNX34wmbzKjUKy4xXudVwwH1VY5q5UGWsI38wxS\n\tUOq25PkBwVzCNuEOcjnQi1GTSulHqt3w7bN7ImQpgVGlxCV3ZRcAvELG292VFfjQJE\n\tYOEy+p4hRdPFZU3z9MQKzBq+04mXN50ztcZOIs11FtXtBbgBRFBHmEc0xakIJ7b/VA\n\taZt+iGiL6AKnw7wivbvcolIwP16RhHcPcFt4VAw59MrOSjyBaOShQU0Em9nt9Unr4R\n\tRobMUmFyz2RoQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1666632845;\n\tbh=EqAtzdMXv/DZBVipSHxc7lhf3CRhBHlPHBkT/3ZGrQ4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hwotMXYTT3JoSV/HAWV4szwzRWIwC0y/BKqZA+fhaTGn8mh8BV4egYysBUWI08g9K\n\tqhI2+RtvlURWI9MKVi8edJlj58eg2Guf+QCgO3/fcXSwHu7Csk4eKrQQAtlEWkZtu4\n\tbdejv2eNhvfa5bGix0MfsQj+GbfqTc8P6A2X/Uis="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"hwotMXYT\"; dkim-atps=neutral","Date":"Mon, 24 Oct 2022 20:33:40 +0300","To":"Nicholas Roth <nicholas@rothemail.net>","Message-ID":"<Y1bMdCPWXCruLMpC@pendragon.ideasonboard.com>","References":"<166662255873.2560709.15565451945392850528@Monstersaurus>\n\t<36B1106D-152E-4170-A0CE-DA1E9DD3AE2B@rothemail.net>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<36B1106D-152E-4170-A0CE-DA1E9DD3AE2B@rothemail.net>","Subject":"Re: [libcamera-devel] [PATCH 05/11] Removes references to\n\tstd::filesystem, which Android 11's toolchain does not 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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25553,"web_url":"https://patchwork.libcamera.org/comment/25553/","msgid":"<Y1bMy/zmChqJM1v5@pendragon.ideasonboard.com>","date":"2022-10-24T17:35:07","subject":"Re: [libcamera-devel] [PATCH 05/11] Removes references to\n\tstd::filesystem, which Android 11's toolchain does not support.","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Mon, Oct 24, 2022 at 04:30:05PM +0100, Kieran Bingham via libcamera-devel wrote:\n> Quoting Nicholas Roth (2022-10-24 15:48:28)\n> > I was kind of surprised to see this actually because right after\n> > creating the File object, we then check if it was successfully created\n> > and print an error otherwise. If I understand correctly, the\n> > std::filesystem-based check was redundant.\n> > \n> > Please correct me if I’m wrong though.\n> \n> It could be seen as redundant yes. I suspect it was to clearly mark the\n> difference between the file failing to open, and not being there. But as\n> \"man 2 open\" states:\n> \n>         ENOENT O_CREAT is not set and the named file does not exist.\n> \n> I expect that we should get a -ENOENT if the file isn't there when we\n> try to call File.open().\n> \n> File.open() at [0] will only set O_CREAT if the mode is WriteOnly or\n> ReadWrite is used, and here we explicitly use ReadOnly at [1].\n> \n> So I think removing the check entirely is fine and reasonable with a\n> clearly updated commit message, also explaining the redundancy and that\n> it's safe to remove without changing the underlying functionality.\n> \n> Well it might be a very small subtle difference between the\n> implementation that's removed and returning -ENOENT if it doesn't exist,\n> as we're perhaps not checking that it's a \"regular file\" but I don't\n> think it's too crucial.\n\nThat's what I've just written in my separate reply to Nicholas' patch\n:-)\n\nThere's another difference though, a non-existing file will log a Debug\nmessage and a failure to open an Error message. As the HAL configuration\nfile is not mandatory, we should print an Error message if it's not\nfound.\n\n> Perhaps a note in the commit that we no longer validate it's a regular\n> file, but expect it to be readable, and otherwise parsed by the\n> parseConfigFile() to validate the content.\n> \n> \n> \n> [0] https://git.libcamera.org/libcamera/libcamera.git/tree/src/libcamera/base/file.cpp#n157\n> [1] https://git.libcamera.org/libcamera/libcamera.git/tree/src/android/camera_hal_config.cpp#n172","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 60855BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Oct 2022 17:35:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1D9FF62F20;\n\tMon, 24 Oct 2022 19:35:34 +0200 (CEST)","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 C86A762EC6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Oct 2022 19:35:32 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 57D448BF;\n\tMon, 24 Oct 2022 19:35:32 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666632934;\n\tbh=MxTLt9lH9rdtuo/qnSpQnnWJTHoe6Pdi8rZWwSbLpKw=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=B2lBKCG3pwN67ZvMIFtl9is72vEBRVHqdtUJSH0mzB/N8Aw1BDOO9IyrGOEKqawzR\n\t4fjaNpYV1a1RgaRrwlZBwTku3g5duSjgH0X74lPzzL/tia7JnZgvDGjB3UP8g7YOr7\n\t40qDiunbNSMZygfR14bPTFApcSrVTA6OMy5ff/N/fKRsiOu0pL8qxL0BdL2C3UmL0t\n\tQl4TrXiUd1IwyV7U89Aq59gYH7WsLVsNY3VykxIsxKExpd1FfrSSHixDxMwlN+aMsG\n\tz9KFtA/kIpKw0UmwZEzNLP4InJ9SANSBwylqK5qWkvvpyW2RYW0IkBQC67hTGfAZ9M\n\t+dCdgKYu8cFUw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1666632932;\n\tbh=MxTLt9lH9rdtuo/qnSpQnnWJTHoe6Pdi8rZWwSbLpKw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UgQZHdDvG2eTxTdm2zj8H4jUAVvY0bHoK6Uq4+mlyzkZUmQIsPQBKUP65mC7hutJS\n\tKSkmY5DBWOZIxHFtYdk9YaQHaoIobtj8/KYBTdcu9kScmAIrbxiZeW8AVpOHD+PKg0\n\tYxx7+rURU5EvW1K3i+gBGZEbsx0EB8WYiD8woVVE="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"UgQZHdDv\"; dkim-atps=neutral","Date":"Mon, 24 Oct 2022 20:35:07 +0300","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<Y1bMy/zmChqJM1v5@pendragon.ideasonboard.com>","References":"<166662255873.2560709.15565451945392850528@Monstersaurus>\n\t<36B1106D-152E-4170-A0CE-DA1E9DD3AE2B@rothemail.net>\n\t<166662540573.2560709.1622194870807186144@Monstersaurus>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<166662540573.2560709.1622194870807186144@Monstersaurus>","Subject":"Re: [libcamera-devel] [PATCH 05/11] Removes references to\n\tstd::filesystem, which Android 11's toolchain does not 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>","Cc":"Nicholas Roth <nicholas@rothemail.net>,\n\tlibcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]