* [PATCH] grub-core/kern/corecmd: Quote variable values when displayed by the set command
@ 2022-08-16 20:22 Glenn Washburn
2022-08-19 14:03 ` Daniel Kiper
0 siblings, 1 reply; 3+ messages in thread
From: Glenn Washburn @ 2022-08-16 20:22 UTC (permalink / raw)
To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn
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 <development@efficientek.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] grub-core/kern/corecmd: Quote variable values when displayed by the set command
2022-08-16 20:22 [PATCH] grub-core/kern/corecmd: Quote variable values when displayed by the set command Glenn Washburn
@ 2022-08-19 14:03 ` Daniel Kiper
2022-08-19 22:11 ` Glenn Washburn
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Kiper @ 2022-08-19 14:03 UTC (permalink / raw)
To: Glenn Washburn; +Cc: grub-devel
On Tue, Aug 16, 2022 at 03:22:53PM -0500, Glenn Washburn wrote:
> 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 <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
... but I have strange feeling I should wait a bit before merging it.
Anyway, if I do not hear any objections I will take this patch...
> ---
> 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;
> }
Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] grub-core/kern/corecmd: Quote variable values when displayed by the set command
2022-08-19 14:03 ` Daniel Kiper
@ 2022-08-19 22:11 ` Glenn Washburn
0 siblings, 0 replies; 3+ messages in thread
From: Glenn Washburn @ 2022-08-19 22:11 UTC (permalink / raw)
To: Daniel Kiper; +Cc: grub-devel
On Fri, 19 Aug 2022 16:03:03 +0200
Daniel Kiper <dkiper@net-space.pl> wrote:
> On Tue, Aug 16, 2022 at 03:22:53PM -0500, Glenn Washburn wrote:
> > 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 <development@efficientek.com>
>
> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
>
> ... but I have strange feeling I should wait a bit before merging it.
>
> Anyway, if I do not hear any objections I will take this patch...
So I have noticed that this patch can be improved. There are some
variables whose value is a null pointer, not a pointer to the empty
string. Before this patch, such a variable would be displayed as
'var=(null)', with this patch it gets displayed as 'var="(null)"'. I
think this patch should instead print 'var=""'. Does this sound good
for a v2?
Glenn
>
> > ---
> > 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;
> > }
>
> Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-19 22:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-16 20:22 [PATCH] grub-core/kern/corecmd: Quote variable values when displayed by the set command Glenn Washburn
2022-08-19 14:03 ` Daniel Kiper
2022-08-19 22:11 ` Glenn Washburn
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.