[{"id":27067,"web_url":"https://patchwork.libcamera.org/comment/27067/","msgid":"<ead75uapu74wo7c3mvyyerddysbq6hulnkcvas5aec7zyjpqci@2f66zlvykauc>","date":"2023-05-08T14:16:13","subject":"Re: [libcamera-devel] [PATCH] meson: Fix usage of overwritten\n\tpipeline variable","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Laurent\n\nOn Mon, May 08, 2023 at 04:27:09PM +0300, Laurent Pinchart via libcamera-devel wrote:\n> When iterating over enabled pipelines and IPA modules, libcamera\n> descends into subdirectories in a recursive manner, which involves\n> nested loops. Both the outer and inner loops use the same loop variable\n> named 'pipeline'. As the outer loop uses the variable after descending\n> into the inner directory, it ends up using an incorrect value. Fix it by\n> moving all use of the variable before the subdir() call, and add a\n> comment that warns about the issue to avoid reintroducing it.\n>\n> Fixes: e8526c0c2bc6 (\"ipa: meson: Allow nested IPA directory structures\")\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nOh indeed\n\nAfter running subdir(pipeline), pipelines is now ['rpi', 'vc4']\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\n> ---\n>  src/ipa/meson.build                | 5 ++++-\n>  src/libcamera/pipeline/meson.build | 5 ++++-\n>  2 files changed, 8 insertions(+), 2 deletions(-)\n>\n> diff --git a/src/ipa/meson.build b/src/ipa/meson.build\n> index 289f861c082d..903eb52ba60f 100644\n> --- a/src/ipa/meson.build\n> +++ b/src/ipa/meson.build\n> @@ -52,8 +52,11 @@ foreach pipeline : pipelines\n>          continue\n>      endif\n>\n> -    subdir(pipeline)\n>      subdirs += pipeline\n> +    subdir(pipeline)\n> +\n> +    # Don't reuse the pipeline variable below, the subdirectory may have\n> +    # overwritten it.\n>  endforeach\n>\n>  # The ipa-sign-install.sh script which uses the enabled_ipa_modules variable\n> diff --git a/src/libcamera/pipeline/meson.build b/src/libcamera/pipeline/meson.build\n> index b6160d346cf7..8a61991c0fec 100644\n> --- a/src/libcamera/pipeline/meson.build\n> +++ b/src/libcamera/pipeline/meson.build\n> @@ -12,6 +12,9 @@ foreach pipeline : pipelines\n>          continue\n>      endif\n>\n> -    subdir(pipeline)\n>      subdirs += pipeline\n> +    subdir(pipeline)\n> +\n> +    # Don't reuse the pipeline variable below, the subdirectory may have\n> +    # overwritten it.\n>  endforeach\n>\n> base-commit: 1c512d406536d72a393c38c3f6a75fe0fdb9ecb2\n> --\n> Regards,\n>\n> Laurent Pinchart\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 1AF42BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 May 2023 14:16:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7215C633B4;\n\tMon,  8 May 2023 16:16:17 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 711D56053A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 May 2023 16:16:16 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2001:b07:5d2e:52c9:1cf0:b3bc:c785:4625])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 37BF0755;\n\tMon,  8 May 2023 16:16:10 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1683555377;\n\tbh=CJFV0tQo2TaS7RtgaG6V2VuXOqZe9GWI86YpVRUnf6M=;\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=PTJ09lzjb/udAJiAANz0TWgGLQ3sAYtFR854Z3MB48uJ1lHqwHD0pcdb+4hO34grL\n\trBSecsanrtTOXJ5SQTTGr6ygr8ug1YS8WrnAj0TObr9nnjvUQBVQtc+sgY+pcAqE4/\n\tPKh4yQHWzsejQXTJBLmGi5z0R1Ar4PghjgwkTffEzrI5FDVKtF2Vka763ShIZDdm+J\n\tgY2bO0hHhzlVrojQ6FeP28EpLi4HS/sARpBhDci+lGt+990wTEMRXYK7zVh34rfCwH\n\twQIwaxsALPr1TQM8UQkw94yKeowWwdP1mXmBawgZl4EMAUWur9KIBjYWfSG3RvlvCf\n\tOxA5uBkb+gZGA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1683555370;\n\tbh=CJFV0tQo2TaS7RtgaG6V2VuXOqZe9GWI86YpVRUnf6M=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Y3ASE6LTSWjTRNp6D8Z0zhVfLY444VqWMakZuwp4F534+4+alyAkYbOKFroxoO+YO\n\tXiN9fcCeeAqg5cVo/x4NCIZfRyeETXojMuYRu+JArLi0KU21om+VcDXXFMArabP/68\n\txgXDu+Pp3StjqhlqA+2CTdXu3OVo23ocEVgqoZTo="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Y3ASE6LT\"; dkim-atps=neutral","Date":"Mon, 8 May 2023 16:16:13 +0200","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<ead75uapu74wo7c3mvyyerddysbq6hulnkcvas5aec7zyjpqci@2f66zlvykauc>","References":"<20230508132709.20542-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230508132709.20542-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] meson: Fix usage of overwritten\n\tpipeline variable","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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":27069,"web_url":"https://patchwork.libcamera.org/comment/27069/","msgid":"<1514e755-e75a-4713-6d26-4a7fdb4d74ad@ideasonboard.com>","date":"2023-05-08T16:44:26","subject":"Re: [libcamera-devel] [PATCH] meson: Fix usage of overwritten\n\tpipeline variable","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi\n\nOn 5/8/23 7:46 PM, Jacopo Mondi via libcamera-devel wrote:\n> Hi Laurent\n>\n> On Mon, May 08, 2023 at 04:27:09PM +0300, Laurent Pinchart via libcamera-devel wrote:\n>> When iterating over enabled pipelines and IPA modules, libcamera\n>> descends into subdirectories in a recursive manner, which involves\n>> nested loops. Both the outer and inner loops use the same loop variable\n>> named 'pipeline'. As the outer loop uses the variable after descending\n>> into the inner directory, it ends up using an incorrect value. Fix it by\n>> moving all use of the variable before the subdir() call, and add a\n>> comment that warns about the issue to avoid reintroducing it.\n>>\n>> Fixes: e8526c0c2bc6 (\"ipa: meson: Allow nested IPA directory structures\")\n>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Oh indeed\n>\n> After running subdir(pipeline), pipelines is now ['rpi', 'vc4']\n>\n> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n>> ---\n>>   src/ipa/meson.build                | 5 ++++-\n>>   src/libcamera/pipeline/meson.build | 5 ++++-\n>>   2 files changed, 8 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/src/ipa/meson.build b/src/ipa/meson.build\n>> index 289f861c082d..903eb52ba60f 100644\n>> --- a/src/ipa/meson.build\n>> +++ b/src/ipa/meson.build\n>> @@ -52,8 +52,11 @@ foreach pipeline : pipelines\n>>           continue\n>>       endif\n>>\n>> -    subdir(pipeline)\n>>       subdirs += pipeline\n>> +    subdir(pipeline)\n>> +\n>> +    # Don't reuse the pipeline variable below, the subdirectory may have\n>> +    # overwritten it.\n>>   endforeach\n>>\n>>   # The ipa-sign-install.sh script which uses the enabled_ipa_modules variable\n>> diff --git a/src/libcamera/pipeline/meson.build b/src/libcamera/pipeline/meson.build\n>> index b6160d346cf7..8a61991c0fec 100644\n>> --- a/src/libcamera/pipeline/meson.build\n>> +++ b/src/libcamera/pipeline/meson.build\n>> @@ -12,6 +12,9 @@ foreach pipeline : pipelines\n>>           continue\n>>       endif\n>>\n>> -    subdir(pipeline)\n>>       subdirs += pipeline\n>> +    subdir(pipeline)\n>> +\n>> +    # Don't reuse the pipeline variable below, the subdirectory may have\n>> +    # overwritten it.\n>>   endforeach\n>>\n>> base-commit: 1c512d406536d72a393c38c3f6a75fe0fdb9ecb2\n>> --\n>> Regards,\n>>\n>> Laurent Pinchart\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 AB01EBD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 May 2023 16:44:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1F7CF60544;\n\tMon,  8 May 2023 18:44:34 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D7F2F6053A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 May 2023 18:44:32 +0200 (CEST)","from [192.168.1.105] (unknown [103.251.226.10])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D3D627CE;\n\tMon,  8 May 2023 18:44:25 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1683564274;\n\tbh=dKW+XAhy6+LlCojV7wdXA9Vf5WzCx9IhS55wG+1EQAU=;\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=Q/balHAn7Kkmz4Px8mKZmi2n3bqdf1Mx5tozRnsgbx5K53ThOf3WJstZrk44qKXqb\n\tsKRZ0TyyDtQPT+P6oD2jOhwYxI8NZECwv4ex/HKWS8mEKezIRLgO2dcMMfObzlVDDv\n\ttgVPyw6yp/IjUjZdmVcyAiDBoQFmnG9cpixzLmjqAa7thNbjLCD0KAvOSRlx+KssPb\n\t+pDlqr8XrVCE3yccp+jn1L50WrQPWYfUPpIWj7777OdljqHBy4wGQjWb4oKSkmhE7D\n\to6OxofOzRhmMhqQAQeVxC7B7c/VthHyYjK3z2Lkw0UsI0uK4Z89mZfrmP+FirWteL8\n\tUWKXs1krSLKng==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1683564266;\n\tbh=dKW+XAhy6+LlCojV7wdXA9Vf5WzCx9IhS55wG+1EQAU=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=vaKnaVb8sjQ2uSfW1kYw5Q1oTihbsl8PsNjpxa6DAS3TiqUuKiZd22xKYME+vD+4H\n\tPT5jtmjniuGB2RQArtVgdbSL0D1n8MdE7vOl/hLT1UnCCyPTtqw1ytM+5wa/ZbUYnM\n\t1saXvBsif12KxdBvOp0I0zG/pZpgkov6uC3m2H4Q="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"vaKnaVb8\"; dkim-atps=neutral","Message-ID":"<1514e755-e75a-4713-6d26-4a7fdb4d74ad@ideasonboard.com>","Date":"Mon, 8 May 2023 22:14:26 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.7.1","Content-Language":"en-US","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20230508132709.20542-1-laurent.pinchart@ideasonboard.com>\n\t<ead75uapu74wo7c3mvyyerddysbq6hulnkcvas5aec7zyjpqci@2f66zlvykauc>","In-Reply-To":"<ead75uapu74wo7c3mvyyerddysbq6hulnkcvas5aec7zyjpqci@2f66zlvykauc>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] meson: Fix usage of overwritten\n\tpipeline variable","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":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@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>"}}]