From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oO36W-0002dd-2o for mharc-grub-devel@gnu.org; Tue, 16 Aug 2022 16:24:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oO36V-0002dV-5c for grub-devel@gnu.org; Tue, 16 Aug 2022 16:23:59 -0400 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]:41517) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oO36T-0002jP-Fo for grub-devel@gnu.org; Tue, 16 Aug 2022 16:23:58 -0400 Received: by mail-qv1-xf2c.google.com with SMTP id j1so3934589qvv.8 for ; Tue, 16 Aug 2022 13:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=6Uo9exFI9n363kakQ9duzJGQDvL5WeIphdNcoXlnRYw=; b=4JBrnXJpL5wLS4t0fQklbGoTuax7HWFrk9aki2K3q+rsMpt6z1WVK+S+MnHC/EfHXL OwRDbmwN5tQJn5JolVQ/2HYphWFyJeYsLYCd3qbMG1Qkl+Bz7bpQsy493OpyOsy7XU+q vodeGt0O4NJFuJ3n/tcbYiOmJXDGE3ITpANZjGrMHGKEDm8bSg2B+AH/aPA5h6yWLcPI tXkVXA+a6nz5bASjX4uiccmugnb/ON4Tg0UvLO/aLzqRADg4iKOk4YIqHYLBkgA0l6uE 5Qpuehu1toW/dbs03ZyFcy7SvU8Ue2qtOCmPoMHaY+HefkRdhqK3eNS98Jec1OxIEmOO dubg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=6Uo9exFI9n363kakQ9duzJGQDvL5WeIphdNcoXlnRYw=; b=yL5BsTPXrPji7lnQfB2tWnfN3jHCXXJNN8vj0GNZXURsZuErVOuj3LoLDs9pI5cb8r HocUWVwiVn4TdeGfgBikZ/w8JomeJ4vVfYvGzN4wR58Vi3Lc6g1W5Gdj4YgqReo94RDk TILGaHyaE3kTG2DpSFI8nHuLtrh9YaV6niN0hev6DAvL30nO1ccAGRGOuvOUQlHFEMZZ XZI4ELDGfWSdO897WYzwmyea3JOnI9QoomQrqeeMdg3jCY8jSavY4VKpUA02UaWOBeIO 5mrOkgNZalUG9TYqP1B4OzzTqBYa+vyiz4nOeyeeYU0TZmlDZIE6gl0CCnyKrA3nenRs ZVHQ== X-Gm-Message-State: ACgBeo2StkTIqhEVBv718HQsqm4udJy2hg+/T46wF090RACsf7sXy+mr g6SOyNl1/34qM2tTMNcqmTQln3+lTPF4Kg== X-Google-Smtp-Source: AA6agR5Z7jNw5snsTCpNpsJiOoFm/J5y16wPMzIKSbHPuq+u0Bi9VL/JjYoSPaK+tcv/R344/ylREg== X-Received: by 2002:a05:6214:2265:b0:474:8865:7ba2 with SMTP id gs5-20020a056214226500b0047488657ba2mr19169645qvb.98.1660681434353; Tue, 16 Aug 2022 13:23:54 -0700 (PDT) Received: from localhost.localdomain ([37.218.244.249]) by smtp.gmail.com with ESMTPSA id u19-20020a05620a0c5300b006b5f8f32a8fsm12423654qki.114.2022.08.16.13.23.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 13:23:53 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Glenn Washburn Subject: [PATCH] grub-core/kern/corecmd: Quote variable values when displayed by the set command Date: Tue, 16 Aug 2022 15:22:53 -0500 Message-Id: <20220816202253.258771-1-development@efficientek.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::f2c; envelope-from=development@efficientek.com; helo=mail-qv1-xf2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2022 20:23:59 -0000 Variable values may contain spaces at the end or newlines. However, when displayed without quotes this is not obvious and can lead to confusion as to the actual contents of variables. Signed-off-by: Glenn Washburn --- grub-core/kern/corecmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/corecmd.c b/grub-core/kern/corecmd.c index fc54f43f2..ac976e4c6 100644 --- a/grub-core/kern/corecmd.c +++ b/grub-core/kern/corecmd.c @@ -40,7 +40,7 @@ grub_core_cmd_set (struct grub_command *cmd __attribute__ ((unused)), { struct grub_env_var *env; FOR_SORTED_ENV (env) - grub_printf ("%s=%s\n", env->name, grub_env_get (env->name)); + grub_printf ("%s=\"%s\"\n", env->name, grub_env_get (env->name)); return 0; } -- 2.34.1