From unknown Sat Jun 14 19:45:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62982: Command-line parsing fails if parameters contain spaces Resent-From: Jacob Bachmeyer Original-Sender: "Debbugs-submit" Resent-CC: bug-dejagnu@gnu.org Resent-Date: Fri, 21 Apr 2023 02:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62982 X-GNU-PR-Package: dejagnu X-GNU-PR-Keywords: To: 62982@debbugs.gnu.org X-Debbugs-Original-To: bug-dejagnu@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168204260426082 (code B ref -1); Fri, 21 Apr 2023 02:04:01 +0000 Received: (at submit) by debbugs.gnu.org; 21 Apr 2023 02:03:24 +0000 Received: from localhost ([127.0.0.1]:38958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppg7P-0006mb-Ts for submit@debbugs.gnu.org; Thu, 20 Apr 2023 22:03:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:45814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppg7N-0006mT-J7 for submit@debbugs.gnu.org; Thu, 20 Apr 2023 22:03:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppg7M-0000W4-Ly for bug-dejagnu@gnu.org; Thu, 20 Apr 2023 22:03:21 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppg7M-00046x-Dk for bug-dejagnu@gnu.org; Thu, 20 Apr 2023 22:03:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=TXgZS0Q5yexPCi/lHaXk7esWcGqzfVrYa0CvKGe7b7U=; b=FUyKaO7LSn+lp/ db2/z/BPzN9r2+J+teccxHUcPnDLB+hY9Jp/fd95sDSJvJ+4kuVkMvJ4lf9klfl5yJ9tX/pzRTrG5 HoPaqPdaLyWFvowHonuLu3OrO8JGBopBCDY/rTtSRAFBi9yuPk73CSaWBRV3ZMsJvjCgzcANB766H roWVNf9zmy6c4hLBRHAD7XzU7H1bihz2sM39DhblVz8/elunDpS7tnA+Z753xrPTUgiwz1siPbi6r kSGR+uScPFr9m5JRBtjPioWS1Jw9H6MfDhb28C1Jim2/yFM7nI7nqDw7Tu+ANNUcAJFBi0Tj73WdM qSNl4h5DnM0kezhutlIw==; Received: from jcb by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1ppg7M-0005ya-14 for bug-dejagnu@gnu.org; Thu, 20 Apr 2023 22:03:20 -0400 From: Jacob Bachmeyer Date: Thu, 20 Apr 2023 22:03:19 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Forwarding problem report to assign a bug number to this. In brief, the code that restores certain variables assigned as a result of the command line arguments fails if any of those values contain whitespace. This is a problem becuase the --target_board option can legitimately be a list of mulitple targets to run. -- Jacob --=-=-= Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-From-Line: christoph.muellner@vrull.eu Mon Apr 17 14:36:14 2023 Return-path: Envelope-to: jcb@gnu.org Delivery-date: Mon, 17 Apr 2023 14:36:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by fencepost.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1poTi2-0004Zj-S2 for jcb@gnu.org; Mon, 17 Apr 2023 14:36:14 -0400 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1poThn-0006eN-Mj for jcb@gnu.org; Mon, 17 Apr 2023 14:36:14 -0400 Received: by mail-ej1-x634.google.com with SMTP id u3so14733277ejj.12 for ; Mon, 17 Apr 2023 11:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1681756556; x=1684348556; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aW9RnYSruEPLIpUYzcdS9urOLOrxHQ2NMAhRM1SohsU=; b=V3Y1iLYcjKe7EpgDW3CjahP8MP7F72lUhKniPts40mE9jjtcxfy6emB8E8wxjBjaVJ OOLFf+t+tgjv+S4p/MSMC6ohptLsd6MUJmJ4CurFhyDrH3AOJVWj72tWkkW8NoJLInat 291dP6kS6b7Wl0WMN1pRwnlIRkah/1h5H10Elq2wgUshVDZ1bhuVnB/ZAYxxxX9TgTZD pKFu2TzfQYfMNFF1MdEANW9wRhqMQyQJAsD1ZZwUuSpJqVDCORqr9lQWcpdTcElqAO3E /nxf1PEq5TInxWiuza1qXUfOkBQx5hYJYycN8mZEziwV1jaCQhKimTb6PhjtHAQUjQZX nF8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681756556; x=1684348556; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aW9RnYSruEPLIpUYzcdS9urOLOrxHQ2NMAhRM1SohsU=; b=Nl7Cx+K7Ekv2xaaVKnBzAzhzNCE1A4ALLImpoAwVHdNq0S7t3rF1a4ewBA6EuZZqTs qNqcg+FGQmC2zL2inRb0HjBOTf/ParHVUCxREXdE22S61jFsvbTf23MyRgDyltvK6oh2 1OJsoRJK9kbNO9OwhxQi0uTJS53fy/XkSNAdY9D0C+UtAqQPsig8zEHqZebNcHxvUVuN ygmBM0WZnQkwdntwnK0jHb2zXdSbGSY2lzKpSux66tCUCHwY1ErVYQeKKfxd2gsZKPdu Dg1lUgSmVf75iKz8Z++sycx30nN+gyYTP/87UwYkHEcrr2U+M5gnuSDtz210SkFPzMYW gsHw== X-Gm-Message-State: AAQBX9d4PGhUmvZbmFUl7Zf1LLSqmuYgjVjX6QE2zPs/hi7LhaAmDtMS T0xmfgjbBQrn4sIL5iutbyCbxwy0unUeuXaGuSg= X-Google-Smtp-Source: AKy350ZztqdGAumjhOJl7wwSewrBEp1b1NDSb8/hxlqdtqAlKuuRDqPqjSEJeNWMkEIGlgrtZ3JJzg== X-Received: by 2002:a17:907:9090:b0:932:e6d5:bd7c with SMTP id ge16-20020a170907909000b00932e6d5bd7cmr7752825ejb.20.1681756555985; Mon, 17 Apr 2023 11:35:55 -0700 (PDT) Received: from beast.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id d15-20020a056402078f00b00505034c27b9sm6113149edy.28.2023.04.17.11.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 11:35:55 -0700 (PDT) From: Christoph Muellner To: dejagnu@gnu.org, Jacob Bachmeyer , Rob Savoye , Kito Cheng , Vineet Gupta Cc: =?UTF-8?q?Christoph=20M=C3=BCllner?= Subject: [PATCH] runtest: Allow multi-word arguments Date: Mon, 17 Apr 2023 20:35:52 +0200 Message-Id: <20230417183552.516546-1-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=christoph.muellner@vrull.eu; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DKIM_VALID_EF=-0.1,SPF_HELO_NONE=0.001,SPF_PASS=-0.001,T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action From: Christoph Müllner A recent change (5fafcd43) introduced a command line argument cache, that ensures that command line arguments have a higher priority than configuration files. That cache uses the following code to save and restore: save_cmd_var: upvar 1 $name target_var restore_cmd_vars" uplevel 1 set $name $value This works well unless $value becomes a multi-word string (i.e. a string that contains spaces), because in this case the command becomes: uplevel 1 set $name arg-word0 arg-word1 ... Obviously this will trigger the following error: wrong # args: should be "set varName ?newValue?" Quoting "$value" does not help, because the quotes are evaluated before executing set. Let's fix this by using upvar for the restore code as well: upvar 1 $name target_var set $target_var "$value" Here, the quotes will be evaluated when executing the set command. This has been reported in a downstream project, where this bug prevented running the GCC regression tests when building in multilib configuration: https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1201 The actual command in this report was: set target_list riscv-sim/-march=rv32imac/-mabi=ilp32/-mcmodel=medlow \ riscv-sim/-march=rv32imafdc/-mabi=ilp32d/-mcmodel=medlow \ riscv-sim/-march=rv64imac/-mabi=lp64/-mcmodel=medlow \ riscv-sim/-march=rv64imafdc/-mabi=lp64d/-mcmod Signed-off-by: Christoph Müllner --- runtest.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtest.exp b/runtest.exp index 7c6018f..0829fda 100644 --- a/runtest.exp +++ b/runtest.exp @@ -432,7 +432,8 @@ namespace eval ::dejagnu::command_line { variable cmd_var_list foreach {name value} $cmd_var_list { - uplevel 1 set $name $value + upvar 1 $name target_var + set $target_var "$value" } verbose "Variables set by command line arguments restored." 4 } -- 2.39.2 --=-=-=-- From unknown Sat Jun 14 19:45:34 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Jacob Bachmeyer Subject: bug#62982: closed (now fixed in Git master) Message-ID: References: <6441FA29.9080907@gmail.com> X-Gnu-PR-Message: they-closed 62982 X-Gnu-PR-Package: dejagnu Reply-To: 62982@debbugs.gnu.org Date: Fri, 21 Apr 2023 02:52:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1682045521-30951-1" This is a multi-part message in MIME format... ------------=_1682045521-30951-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #62982: Command-line parsing fails if parameters contain spaces which was filed against the dejagnu package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 62982@debbugs.gnu.org. --=20 62982: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D62982 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1682045521-30951-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 62982-done) by debbugs.gnu.org; 21 Apr 2023 02:51:31 +0000 Received: from localhost ([127.0.0.1]:38998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppgry-00081P-JK for submit@debbugs.gnu.org; Thu, 20 Apr 2023 22:51:30 -0400 Received: from mail-ot1-f50.google.com ([209.85.210.50]:47239) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppgrx-00080d-3E for 62982-done@debbugs.gnu.org; Thu, 20 Apr 2023 22:51:29 -0400 Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-6a5f1503886so632970a34.2 for <62982-done@debbugs.gnu.org>; Thu, 20 Apr 2023 19:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682045483; x=1684637483; h=content-transfer-encoding:subject:to:mime-version:user-agent :reply-to:from:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=aYITIq6/vgNdlD42mnzGyL8MbxxkjGJZcO91/0Ek99Q=; b=VG1A0s5oleYOlsBtEjuq60Z0IOVBHCqVjBPTMzTtNgnyvE4+9DwnUw3XyEiwZaLedL XnQoAbjWrWdskVrnS4GgU0L0lzQq7r2dVwkaul7rZ1rYi9cVCqBei9aoNCNOt8ksP+1D cxw7aDzB5L/KwjnH24/QJe+dz2M6y8iuQgUDrP0WLm5WN8LwtXeR1+Vvs1GCDU+1mlhz i+CoZNnHvMvXdWKAEE25eLXpFypOO1urlgy7ZPNRQIUJwN5PF1mCFIvXuoplRRZo4DTI meTSK+VYi5zkg+3sT3bVVdkZi7aOAiKIIfGp560UJCagdxcKdfhswjEKG11wDvsKEfTJ ZFgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682045483; x=1684637483; h=content-transfer-encoding:subject:to:mime-version:user-agent :reply-to:from:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=aYITIq6/vgNdlD42mnzGyL8MbxxkjGJZcO91/0Ek99Q=; b=Rft1VmtdOT6luYonZ0+3qZE9MDvLYwxPMWx+Oq9I/tfzryvFcRlBrcOQa6FX1GZMft E4/+XfodP6e/tMcx4BsDraxENBpcTKc0hmA9uFpwIQOA9M1clTKOcVdIfHZJ1JAWUnVS HdapCpWALC35Ku8ZO7v63C3qLgyLxb0zNvgYK59Uo6Jpvdv/V8n3Xxjuqr2G2P2BFyO3 pRt5qdOSlFnJM6Qq1jPwOOfUw5HRpaol2v++TMdr5bimebFCDuRcICeqooBU83rrkLst 40AFE3biBnm5pDdwKlJ9QlIyifbGkjxCTYVUx/tGksOjUGOwjMFy7VITWG6K1qmnnjla yv5w== X-Gm-Message-State: AAQBX9fge5V1uAwWJmPxvZc3W6HDTZ2mnNgITbvPNs/BHntKieC/x/lZ uoEs118KLWnRTHRg8T/lqikJ5twj1f0= X-Google-Smtp-Source: AKy350aiUsZJlLVFQlvPR2S0/ITTX9lUe8tk/fDzfWIgFUM8Ww5txlk8vHiZ4ywqibdOGeXNRI/P2w== X-Received: by 2002:a05:6830:20d6:b0:6a5:edcd:8c8a with SMTP id z22-20020a05683020d600b006a5edcd8c8amr1917139otq.1.1682045482683; Thu, 20 Apr 2023 19:51:22 -0700 (PDT) Received: from [127.0.0.1] ([70.133.144.20]) by smtp.gmail.com with ESMTPSA id d17-20020a056830045100b006a63283a9e5sm394079otc.75.2023.04.20.19.51.22 for <62982-done@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Apr 2023 19:51:22 -0700 (PDT) Message-ID: <6441FA29.9080907@gmail.com> Date: Thu, 20 Apr 2023 21:51:21 -0500 From: Jacob Bachmeyer User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.22) Gecko/20090807 MultiZilla/1.8.3.4e SeaMonkey/1.1.17 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: 62982-done@debbugs.gnu.org Subject: now fixed in Git master Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 62982-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: jcb62281@gmail.com Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Fixed in commit c298959ef991b389b64a825f70094738c6a48780. ------------=_1682045521-30951-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 21 Apr 2023 02:03:24 +0000 Received: from localhost ([127.0.0.1]:38958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppg7P-0006mb-Ts for submit@debbugs.gnu.org; Thu, 20 Apr 2023 22:03:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:45814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppg7N-0006mT-J7 for submit@debbugs.gnu.org; Thu, 20 Apr 2023 22:03:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppg7M-0000W4-Ly for bug-dejagnu@gnu.org; Thu, 20 Apr 2023 22:03:21 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppg7M-00046x-Dk for bug-dejagnu@gnu.org; Thu, 20 Apr 2023 22:03:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=TXgZS0Q5yexPCi/lHaXk7esWcGqzfVrYa0CvKGe7b7U=; b=FUyKaO7LSn+lp/ db2/z/BPzN9r2+J+teccxHUcPnDLB+hY9Jp/fd95sDSJvJ+4kuVkMvJ4lf9klfl5yJ9tX/pzRTrG5 HoPaqPdaLyWFvowHonuLu3OrO8JGBopBCDY/rTtSRAFBi9yuPk73CSaWBRV3ZMsJvjCgzcANB766H roWVNf9zmy6c4hLBRHAD7XzU7H1bihz2sM39DhblVz8/elunDpS7tnA+Z753xrPTUgiwz1siPbi6r kSGR+uScPFr9m5JRBtjPioWS1Jw9H6MfDhb28C1Jim2/yFM7nI7nqDw7Tu+ANNUcAJFBi0Tj73WdM qSNl4h5DnM0kezhutlIw==; Received: from jcb by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1ppg7M-0005ya-14 for bug-dejagnu@gnu.org; Thu, 20 Apr 2023 22:03:20 -0400 From: Jacob Bachmeyer To: bug-dejagnu@gnu.org Subject: Command-line parsing fails if parameters contain spaces Date: Thu, 20 Apr 2023 22:03:19 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Forwarding problem report to assign a bug number to this. In brief, the code that restores certain variables assigned as a result of the command line arguments fails if any of those values contain whitespace. This is a problem becuase the --target_board option can legitimately be a list of mulitple targets to run. -- Jacob --=-=-= Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-From-Line: christoph.muellner@vrull.eu Mon Apr 17 14:36:14 2023 Return-path: Envelope-to: jcb@gnu.org Delivery-date: Mon, 17 Apr 2023 14:36:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by fencepost.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1poTi2-0004Zj-S2 for jcb@gnu.org; Mon, 17 Apr 2023 14:36:14 -0400 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1poThn-0006eN-Mj for jcb@gnu.org; Mon, 17 Apr 2023 14:36:14 -0400 Received: by mail-ej1-x634.google.com with SMTP id u3so14733277ejj.12 for ; Mon, 17 Apr 2023 11:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1681756556; x=1684348556; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aW9RnYSruEPLIpUYzcdS9urOLOrxHQ2NMAhRM1SohsU=; b=V3Y1iLYcjKe7EpgDW3CjahP8MP7F72lUhKniPts40mE9jjtcxfy6emB8E8wxjBjaVJ OOLFf+t+tgjv+S4p/MSMC6ohptLsd6MUJmJ4CurFhyDrH3AOJVWj72tWkkW8NoJLInat 291dP6kS6b7Wl0WMN1pRwnlIRkah/1h5H10Elq2wgUshVDZ1bhuVnB/ZAYxxxX9TgTZD pKFu2TzfQYfMNFF1MdEANW9wRhqMQyQJAsD1ZZwUuSpJqVDCORqr9lQWcpdTcElqAO3E /nxf1PEq5TInxWiuza1qXUfOkBQx5hYJYycN8mZEziwV1jaCQhKimTb6PhjtHAQUjQZX nF8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681756556; x=1684348556; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aW9RnYSruEPLIpUYzcdS9urOLOrxHQ2NMAhRM1SohsU=; b=Nl7Cx+K7Ekv2xaaVKnBzAzhzNCE1A4ALLImpoAwVHdNq0S7t3rF1a4ewBA6EuZZqTs qNqcg+FGQmC2zL2inRb0HjBOTf/ParHVUCxREXdE22S61jFsvbTf23MyRgDyltvK6oh2 1OJsoRJK9kbNO9OwhxQi0uTJS53fy/XkSNAdY9D0C+UtAqQPsig8zEHqZebNcHxvUVuN ygmBM0WZnQkwdntwnK0jHb2zXdSbGSY2lzKpSux66tCUCHwY1ErVYQeKKfxd2gsZKPdu Dg1lUgSmVf75iKz8Z++sycx30nN+gyYTP/87UwYkHEcrr2U+M5gnuSDtz210SkFPzMYW gsHw== X-Gm-Message-State: AAQBX9d4PGhUmvZbmFUl7Zf1LLSqmuYgjVjX6QE2zPs/hi7LhaAmDtMS T0xmfgjbBQrn4sIL5iutbyCbxwy0unUeuXaGuSg= X-Google-Smtp-Source: AKy350ZztqdGAumjhOJl7wwSewrBEp1b1NDSb8/hxlqdtqAlKuuRDqPqjSEJeNWMkEIGlgrtZ3JJzg== X-Received: by 2002:a17:907:9090:b0:932:e6d5:bd7c with SMTP id ge16-20020a170907909000b00932e6d5bd7cmr7752825ejb.20.1681756555985; Mon, 17 Apr 2023 11:35:55 -0700 (PDT) Received: from beast.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id d15-20020a056402078f00b00505034c27b9sm6113149edy.28.2023.04.17.11.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 11:35:55 -0700 (PDT) From: Christoph Muellner To: dejagnu@gnu.org, Jacob Bachmeyer , Rob Savoye , Kito Cheng , Vineet Gupta Cc: =?UTF-8?q?Christoph=20M=C3=BCllner?= Subject: [PATCH] runtest: Allow multi-word arguments Date: Mon, 17 Apr 2023 20:35:52 +0200 Message-Id: <20230417183552.516546-1-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=christoph.muellner@vrull.eu; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DKIM_VALID_EF=-0.1,SPF_HELO_NONE=0.001,SPF_PASS=-0.001,T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action From: Christoph Müllner A recent change (5fafcd43) introduced a command line argument cache, that ensures that command line arguments have a higher priority than configuration files. That cache uses the following code to save and restore: save_cmd_var: upvar 1 $name target_var restore_cmd_vars" uplevel 1 set $name $value This works well unless $value becomes a multi-word string (i.e. a string that contains spaces), because in this case the command becomes: uplevel 1 set $name arg-word0 arg-word1 ... Obviously this will trigger the following error: wrong # args: should be "set varName ?newValue?" Quoting "$value" does not help, because the quotes are evaluated before executing set. Let's fix this by using upvar for the restore code as well: upvar 1 $name target_var set $target_var "$value" Here, the quotes will be evaluated when executing the set command. This has been reported in a downstream project, where this bug prevented running the GCC regression tests when building in multilib configuration: https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1201 The actual command in this report was: set target_list riscv-sim/-march=rv32imac/-mabi=ilp32/-mcmodel=medlow \ riscv-sim/-march=rv32imafdc/-mabi=ilp32d/-mcmodel=medlow \ riscv-sim/-march=rv64imac/-mabi=lp64/-mcmodel=medlow \ riscv-sim/-march=rv64imafdc/-mabi=lp64d/-mcmod Signed-off-by: Christoph Müllner --- runtest.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtest.exp b/runtest.exp index 7c6018f..0829fda 100644 --- a/runtest.exp +++ b/runtest.exp @@ -432,7 +432,8 @@ namespace eval ::dejagnu::command_line { variable cmd_var_list foreach {name value} $cmd_var_list { - uplevel 1 set $name $value + upvar 1 $name target_var + set $target_var "$value" } verbose "Variables set by command line arguments restored." 4 } -- 2.39.2 --=-=-=-- ------------=_1682045521-30951-1--