Enable pager by default
PATCH 1/1 Enable pager by default
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
So just enable pager by default which leads to a much better experience.
---
util/grub.d/00_header.in | 2 ++ 1 file changed, 2 insertions(+)
util/grub.d/00_header.in +2 -0
@@ -43,6 +43,8 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_ if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi cat << EOF +set pager=1 + if [ -s \$prefix/grubenv ]; then load_env fi
Signature · 1 line
2.21.0
Quoted 8 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
So just enable pager by default which leads to a much better experience.
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Daniel
Hello Daniel,
Quoted 8 lines · Daniel Kiper
Quoted 7 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
Quoted 7 lines
Quoted 1 line
So just enable pager by default which leads to a much better experience.
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Ok. I'll then explore having a paginated output only for the help command instead of globally enabling it by default.
Quoted 2 lines
Daniel
Best regards,
Signature · 3 lines
Javier Martinez Canillas Software Engineer - Desktop Hardware Enablement Red Hat
Quoted 13 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 10 lines · Daniel Kiper
Quoted 8 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
So just enable pager by default which leads to a much better experience.
Quoted 7 lines
Quoted 4 lines
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Ok. I'll then explore having a paginated output only for the help command instead of globally enabling it by default.
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce "-p" (pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
Daniel
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 14 lines · Daniel Kiper
Quoted 8 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
So just enable pager by default which leads to a much better experience.
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Quoted 7 lines
Quoted 2 lines
Ok. I'll then explore having a paginated output only for the help command instead of globally enabling it by default.
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce "-p" (pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
I think default paging behavior could be handled by an environment variable with paging disabled by default. GRUB's console could then print a very short message instructing people to set the variable to enable command paging. I believe this would handle both concerns.
Nicholas Vinson
Quoted 8 lines
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 23 lines · Nicholas Vinson
Quoted 22 lines · Daniel Kiper
Quoted 20 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 8 lines · Daniel Kiper
Quoted 7 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
Quoted 6 lines
Quoted 1 line
So just enable pager by default which leads to a much better experience.
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Ok. I'll then explore having a paginated output only for the help command instead of globally enabling it by default.
Quoted 7 lines
Quoted 4 lines
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce "-p" (pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
I think default paging behavior could be handled by an environment variable with paging disabled by default. GRUB's console could then print a very
Well, it is handled in that way. So?
Quoted 2 lines
short message instructing people to set the variable to enable command paging. I believe this would handle both concerns.
This is an option too. Though I am not convinced to change the global variable to change the behavior of one command.
Daniel
Hello Daniel,
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 14 lines · Daniel Kiper
Quoted 8 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
So just enable pager by default which leads to a much better experience.
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Quoted 8 lines
Quoted 2 lines
Ok. I'll then explore having a paginated output only for the help command instead of globally enabling it by default.
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce "-p" (pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
So I've tried different approaches to solves this. I'm not that sure about introducing a -p option, since I think that we could have the same issue of users not knowing that have to use this option to scroll the output.
Unless we print for each command a message after its output, telling users that have to use -p if they want to have paginated output for that command.
What do you think about the following patch? That way we can specify if the output for each command must be printed with the pager enabled or not.
Probably should be broken in 2 patches, but just want to know your opinion.
From 7c4da6295ebd3a034d1f7e32099eab33efa465d4 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <[email protected]>
Date: Tue, 22 Oct 2019 15:35:12 +0200
Subject: [PATCH v2] Add a GRUB_COMMAND_FLAG_PAGINATED to request paginated
output for commands
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
Since the out for some commands may not fit into a screen, add a new flag GRUB_COMMAND_FLAG_PAGINATED that can be used when registering commands that can be used to request the pager to be enabled while executing the handler.
---
Changes in v2:
- Only enable pager temporarily while printing output for commands that asked for paginated output instead of doing it globally using the pager variable.
grub-core/commands/help.c | 3 ++- grub-core/commands/minicmd.c | 13 ++++++++----- grub-core/normal/dyncmd.c | 7 +++++++ grub-core/normal/term.c | 17 +++++++++++++++++ grub-core/script/execute.c | 7 +++++++ include/grub/command.h | 4 +++- include/grub/normal.h | 3 +++ 7 files changed, 47 insertions(+), 7 deletions(-)
grub-core/commands/help.c +2 -1
@@ -142,7 +142,8 @@ static grub_extcmd_t cmd;GRUB_MOD_INIT (help) { - cmd =grub_register_extcmd ("help" , grub_cmd_help,0 , + cmd =grub_register_extcmd ("help" , grub_cmd_help, +GRUB_COMMAND_FLAG_PAGINATED ,N_ ("[PATTERN ...]" ),N_ ("Show a help message." ),0 ); }
grub-core/commands/minicmd.c +8 -5
@@ -21,6 +21,7 @@#include <grub/mm.h> #include <grub/err.h> #include <grub/env.h> +#include <grub/extcmd.h> #include <grub/misc.h> #include <grub/file.h> #include <grub/disk.h>
@@ -75,7 +76,7 @@ grub_mini_cmd_cat (struct grub_command *cmd __attribute__ ((unused)),/* help */ static grub_err_t -grub_mini_cmd_help (struct grub_command *cmd __attribute__ ((unused)), +grub_mini_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)),int argc __attribute__ ((unused)),char *argv[] __attribute__ ((unused))) {
@@ -188,7 +189,8 @@ grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)),/* Not reached. */ } -static grub_command_t cmd_cat, cmd_help; +static grub_command_t cmd_cat; +static grub_extcmd_t cmd_help;static grub_command_t cmd_dump, cmd_rmmod, cmd_lsmod, cmd_exit;GRUB_MOD_INIT (minicmd)
@@ -197,8 +199,9 @@ GRUB_MOD_INIT(minicmd)grub_register_command ("cat" , grub_mini_cmd_cat,N_ ("FILE" ),N_ ("Show the contents of a file." )); cmd_help = -grub_register_command ("help" , grub_mini_cmd_help, -0 ,N_ ("Show this message." )); +grub_register_extcmd ("help" , grub_mini_cmd_help, +GRUB_COMMAND_FLAG_PAGINATED , +0 ,N_ ("Show this message." ),0 ); cmd_dump =grub_register_command ("dump" , grub_mini_cmd_dump,N_ ("ADDR [SIZE]" ),N_ ("Show memory contents." ));
@@ -216,7 +219,7 @@ GRUB_MOD_INIT(minicmd)GRUB_MOD_FINI (minicmd) {grub_unregister_command (cmd_cat); -grub_unregister_command (cmd_help); +grub_unregister_extcmd (cmd_help);grub_unregister_command (cmd_dump);grub_unregister_command (cmd_rmmod);grub_unregister_command (cmd_lsmod);
grub-core/normal/dyncmd.c +7 -0
@@ -78,11 +78,18 @@ grub_dyncmd_dispatcher (struct grub_extcmd_context *ctxt, cmd =grub_command_find (name);if (cmd) { +/* Temporarily enable paginated output for commands that asked for it */ +if (cmd->flags &GRUB_COMMAND_FLAG_PAGINATED ) +grub_enable_temp_more (); +if (cmd->flags &GRUB_COMMAND_FLAG_BLOCKS && cmd->flags &GRUB_COMMAND_FLAG_EXTCMD ) ret =grub_extcmd_dispatcher (cmd, argc, args, ctxt->script);else ret = (cmd->func) (cmd, argc, args); + +if (cmd->flags &GRUB_COMMAND_FLAG_PAGINATED ) +grub_disable_temp_more (); }else ret = grub_errno;
grub-core/normal/term.c +17 -0
@@ -57,6 +57,7 @@ static struct term_state *term_states = NULL;/* If the more pager is active. */ static int grub_more; +static int temp_more;static void putcode_real (grub_uint32_t code,struct grub_term_output *term,int fixed_tab);
@@ -128,6 +129,22 @@ grub_set_more (int onoff)grub_normal_reset_more (); } +void +grub_enable_temp_more (void ) +{ + temp_more = grub_more; + +if (!temp_more) +grub_set_more (1 ); +} + +void +grub_disable_temp_more (void ) +{ +if (!temp_more) +grub_set_more (0 ); +} +enum {GRUB_CP437_UPDOWNARROW =0x12 ,
grub-core/script/execute.c +7 -0
@@ -1017,6 +1017,10 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)/* Execute the GRUB command or function. */ if (grubcmd) { +/* Temporarily enable paginated output for commands that asked for it */ +if (grubcmd->flags &GRUB_COMMAND_FLAG_PAGINATED ) +grub_enable_temp_more (); +if (grub_extractor_level && !(grubcmd->flags &GRUB_COMMAND_FLAG_EXTRACTOR )) ret = grub_error (GRUB_ERR_EXTRACTOR,
@@ -1027,6 +1031,9 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd) ret =grub_extcmd_dispatcher (grubcmd, argc, args, argv.script); else ret = (grubcmd->func) (grubcmd, argc, args); + +if (grubcmd->flags &GRUB_COMMAND_FLAG_PAGINATED ) +grub_disable_temp_more (); }else ret =grub_script_function_call (func, argc, args);
include/grub/command.h +3 -1
@@ -37,7 +37,9 @@ typedef enum grub_command_flags/* This command accepts only options preceding direct arguments. */ GRUB_COMMAND_OPTIONS_AT_START =0x100 ,/* Can be executed in an entries extractor. */ - GRUB_COMMAND_FLAG_EXTRACTOR = 0x200 +GRUB_COMMAND_FLAG_EXTRACTOR =0x200 , +/* This command output must be paginated. */ + GRUB_COMMAND_FLAG_PAGINATED = 0x400 } grub_command_flags_t;struct grub_command ;
include/grub/normal.h +3 -0
@@ -134,6 +134,9 @@ void read_terminal_list (const char *prefix);void grub_set_more (int onoff); +void grub_enable_temp_more (void ); +void grub_disable_temp_more (void ); +void grub_normal_reset_more (void );void grub_xputs_normal (const char *str);
Signature · 6 lines
2.21.0 -- Javier Martinez Canillas Software Engineer - Desktop Hardware Enablement Red Hat
Quoted 54 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 14 lines · Daniel Kiper
Quoted 8 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
So just enable pager by default which leads to a much better experience.
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Quoted 8 lines
Quoted 2 lines
Ok. I'll then explore having a paginated output only for the help command instead of globally enabling it by default.
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce "-p" (pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
So I've tried different approaches to solves this. I'm not that sure about introducing a -p option, since I think that we could have the same issue of users not knowing that have to use this option to scroll the output.
Unless we print for each command a message after its output, telling users that have to use -p if they want to have paginated output for that command.
What do you think about the following patch? That way we can specify if the output for each command must be printed with the pager enabled or not.
Probably should be broken in 2 patches, but just want to know your opinion.
From
7c4da6295ebd3a034d1f7e32099eab33efa465d4Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <[email protected]>
Date: Tue, 22 Oct 2019 15:35:12 +0200
Subject: [PATCH v2] Add aGRUB_COMMAND_FLAG_PAGINATEDto request paginated
output for commandsWhen user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
Quoted 5 lines
Since the out for some commands may not fit into a screen, add a new flag
GRUB_COMMAND_FLAG_PAGINATEDthat can be used when registering commands that can be used to request the pager to be enabled while executing the handler.Signed-off-by Javier Martinez Canillas <[email protected]>
In general I like the idea but I think patch requires some polishing...
Hmmm... Still thinking about "-p" flag which allows user to choose between pager on/off. Or something which I proposed in the email to Michael...
Quoted 117 lines
---
Changes in v2:
- Only enable pager temporarily while printing output for commands that asked for paginated output instead of doing it globally using the pager variable.grub-core/commands/help.c | 3 ++- grub-core/commands/minicmd.c | 13 ++++++++----- grub-core/normal/dyncmd.c | 7 +++++++ grub-core/normal/term.c | 17 +++++++++++++++++ grub-core/script/execute.c | 7 +++++++ include/grub/command.h | 4 +++- include/grub/normal.h | 3 +++ 7 files changed, 47 insertions(+), 7 deletions(-)grub-core/commands/help.c +2
-1@@ -142,7 +142,8 @@ static grub_extcmd_t cmd;GRUB_MOD_INIT (help) { - cmd =grub_register_extcmd ("help" , grub_cmd_help,0 , + cmd =grub_register_extcmd ("help" , grub_cmd_help, +GRUB_COMMAND_FLAG_PAGINATED ,N_ ("[PATTERN ...]" ),N_ ("Show a help message." ),0 ); }grub-core/commands/minicmd.c +8
-5@@ -21,6 +21,7 @@#include <grub/mm.h> #include <grub/err.h> #include <grub/env.h> +#include <grub/extcmd.h> #include <grub/misc.h> #include <grub/file.h> #include <grub/disk.h> @@ -75,7 +76,7 @@ grub_mini_cmd_cat (struct grub_command *cmd __attribute__ ((unused)),/* help */ static grub_err_t -grub_mini_cmd_help (struct grub_command *cmd __attribute__ ((unused)), +grub_mini_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)),int argc __attribute__ ((unused)),char *argv[] __attribute__ ((unused))) {@@ -188,7 +189,8 @@ grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)),/* Not reached. */ } -static grub_command_t cmd_cat, cmd_help; +static grub_command_t cmd_cat; +static grub_extcmd_t cmd_help;static grub_command_t cmd_dump, cmd_rmmod, cmd_lsmod, cmd_exit;GRUB_MOD_INIT (minicmd)@@ -197,8 +199,9 @@ GRUB_MOD_INIT(minicmd)grub_register_command ("cat" , grub_mini_cmd_cat,N_ ("FILE" ),N_ ("Show the contents of a file." )); cmd_help = -grub_register_command ("help" , grub_mini_cmd_help, -0 ,N_ ("Show this message." )); +grub_register_extcmd ("help" , grub_mini_cmd_help, +GRUB_COMMAND_FLAG_PAGINATED , +0 ,N_ ("Show this message." ),0 ); cmd_dump =grub_register_command ("dump" , grub_mini_cmd_dump,N_ ("ADDR [SIZE]" ),N_ ("Show memory contents." ));@@ -216,7 +219,7 @@ GRUB_MOD_INIT(minicmd)GRUB_MOD_FINI (minicmd) {grub_unregister_command (cmd_cat); -grub_unregister_command (cmd_help); +grub_unregister_extcmd (cmd_help);grub_unregister_command (cmd_dump);grub_unregister_command (cmd_rmmod);grub_unregister_command (cmd_lsmod);grub-core/normal/dyncmd.c +7
-0@@ -78,11 +78,18 @@ grub_dyncmd_dispatcher (struct grub_extcmd_context *ctxt, cmd =grub_command_find (name);if (cmd) { +/* Temporarily enable paginated output for commands that asked for it */ +if (cmd->flags &GRUB_COMMAND_FLAG_PAGINATED ) +grub_enable_temp_more (); +if (cmd->flags &GRUB_COMMAND_FLAG_BLOCKS && cmd->flags &GRUB_COMMAND_FLAG_EXTCMD ) ret =grub_extcmd_dispatcher (cmd, argc, args, ctxt->script);else ret = (cmd->func) (cmd, argc, args); + +if (cmd->flags &GRUB_COMMAND_FLAG_PAGINATED ) +grub_disable_temp_more (); }else ret = grub_errno;grub-core/normal/term.c +1
-0@@ -57,6 +57,7 @@ static struct term_state *term_states = NULL;/* If the more pager is active. */ static int grub_more; +static int temp_more;static void putcode_real (grub_uint32_t code,struct grub_term_output *term,int fixed_tab);
grub-core/normal/term.c grub_set_more (int onoff) · line 138
Quoted 10 lines
grub-core/normal/term.c +7
-0@@ -128,6 +129,22 @@ grub_set_more (int onoff)grub_normal_reset_more (); } +void +grub_enable_temp_more (void ) +{ + temp_more = grub_more; + +if (!temp_more) +grub_set_more (1 );
Does it change pager variable value? If yes I think that you should store its original value here and restore below.
grub-core/normal/term.c grub_set_more (int onoff) · line 145
Quoted 7 lines
grub-core/normal/term.c +7
-0+} + +void +grub_disable_temp_more (void ) +{ +if (!temp_more) +grub_set_more (0 );
Daniel
What is the advantage of having -p versus just using pager=1? We should not duplicate functionality. It increases code size with no benefit.
The easiest solution for informing the user is to add it to stating prompt in GRUB console
Quoted 214 lines · Daniel Kiper
Quoted 54 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 14 lines · Daniel Kiper
Quoted 8 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
So just enable pager by default which leads to a much better experience.
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Quoted 8 lines
Quoted 2 lines
Ok. I'll then explore having a paginated output only for the help command instead of globally enabling it by default.
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce "-p" (pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
So I've tried different approaches to solves this. I'm not that sure about introducing a -p option, since I think that we could have the same issue of users not knowing that have to use this option to scroll the output.
Unless we print for each command a message after its output, telling users that have to use -p if they want to have paginated output for that command.
What do you think about the following patch? That way we can specify if the output for each command must be printed with the pager enabled or not.
Probably should be broken in 2 patches, but just want to know your opinion.
From
7c4da6295ebd3a034d1f7e32099eab33efa465d4Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <[email protected]>
Date: Tue, 22 Oct 2019 15:35:12 +0200
Subject: [PATCH v2] Add aGRUB_COMMAND_FLAG_PAGINATEDto request paginated
output for commandsWhen user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
Quoted 5 lines
Since the out for some commands may not fit into a screen, add a new flag
GRUB_COMMAND_FLAG_PAGINATEDthat can be used when registering commands that can be used to request the pager to be enabled while executing the handler.Signed-off-by Javier Martinez Canillas <[email protected]>In general I like the idea but I think patch requires some polishing...
Hmmm... Still thinking about "-p" flag which allows user to choose between pager on/off. Or something which I proposed in the email to Michael...
Quoted 117 lines
---
Changes in v2:
- Only enable pager temporarily while printing output for commands that asked for paginated output instead of doing it globally using the pager variable.grub-core/commands/help.c | 3 ++- grub-core/commands/minicmd.c | 13 ++++++++----- grub-core/normal/dyncmd.c | 7 +++++++ grub-core/normal/term.c | 17 +++++++++++++++++ grub-core/script/execute.c | 7 +++++++ include/grub/command.h | 4 +++- include/grub/normal.h | 3 +++ 7 files changed, 47 insertions(+), 7 deletions(-)grub-core/commands/help.c +2
-1@@ -142,7 +142,8 @@ static grub_extcmd_t cmd;GRUB_MOD_INIT (help) { - cmd =grub_register_extcmd ("help" , grub_cmd_help,0 , + cmd =grub_register_extcmd ("help" , grub_cmd_help, +GRUB_COMMAND_FLAG_PAGINATED ,N_ ("[PATTERN ...]" ),N_ ("Show a help message." ),0 ); }grub-core/commands/minicmd.c +8
-5@@ -21,6 +21,7 @@#include <grub/mm.h> #include <grub/err.h> #include <grub/env.h> +#include <grub/extcmd.h> #include <grub/misc.h> #include <grub/file.h> #include <grub/disk.h> @@ -75,7 +76,7 @@ grub_mini_cmd_cat (struct grub_command *cmd __attribute__ ((unused)),/* help */ static grub_err_t -grub_mini_cmd_help (struct grub_command *cmd __attribute__ ((unused)), +grub_mini_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)),int argc __attribute__ ((unused)),char *argv[] __attribute__ ((unused))) {@@ -188,7 +189,8 @@ grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)),/* Not reached. */ } -static grub_command_t cmd_cat, cmd_help; +static grub_command_t cmd_cat; +static grub_extcmd_t cmd_help;static grub_command_t cmd_dump, cmd_rmmod, cmd_lsmod, cmd_exit;GRUB_MOD_INIT (minicmd)@@ -197,8 +199,9 @@ GRUB_MOD_INIT(minicmd)grub_register_command ("cat" , grub_mini_cmd_cat,N_ ("FILE" ),N_ ("Show the contents of a file." )); cmd_help = -grub_register_command ("help" , grub_mini_cmd_help, -0 ,N_ ("Show this message." )); +grub_register_extcmd ("help" , grub_mini_cmd_help, +GRUB_COMMAND_FLAG_PAGINATED , +0 ,N_ ("Show this message." ),0 ); cmd_dump =grub_register_command ("dump" , grub_mini_cmd_dump,N_ ("ADDR [SIZE]" ),N_ ("Show memory contents." ));@@ -216,7 +219,7 @@ GRUB_MOD_INIT(minicmd)GRUB_MOD_FINI (minicmd) {grub_unregister_command (cmd_cat); -grub_unregister_command (cmd_help); +grub_unregister_extcmd (cmd_help);grub_unregister_command (cmd_dump);grub_unregister_command (cmd_rmmod);grub_unregister_command (cmd_lsmod);grub-core/normal/dyncmd.c +7
-0@@ -78,11 +78,18 @@ grub_dyncmd_dispatcher (struct grub_extcmd_context *ctxt, cmd =grub_command_find (name);if (cmd) { +/* Temporarily enable paginated output for commands that asked for it */ +if (cmd->flags &GRUB_COMMAND_FLAG_PAGINATED ) +grub_enable_temp_more (); +if (cmd->flags &GRUB_COMMAND_FLAG_BLOCKS && cmd->flags &GRUB_COMMAND_FLAG_EXTCMD ) ret =grub_extcmd_dispatcher (cmd, argc, args, ctxt->script);else ret = (cmd->func) (cmd, argc, args); + +if (cmd->flags &GRUB_COMMAND_FLAG_PAGINATED ) +grub_disable_temp_more (); }else ret = grub_errno;grub-core/normal/term.c +1
-0@@ -57,6 +57,7 @@ static struct term_state *term_states = NULL;/* If the more pager is active. */ static int grub_more; +static int temp_more;static void putcode_real (grub_uint32_t code,struct grub_term_output *term,int fixed_tab);grub-core/normal/term.c grub_set_more (int onoff) · line 138
Quoted 10 lines
grub-core/normal/term.c +7
-0@@ -128,6 +129,22 @@ grub_set_more (int onoff)grub_normal_reset_more (); } +void +grub_enable_temp_more (void ) +{ + temp_more = grub_more; + +if (!temp_more) +grub_set_more (1 );Does it change pager variable value? If yes I think that you should store its original value here and restore below.
grub-core/normal/term.c grub_set_more (int onoff) · line 145
Quoted 7 lines
grub-core/normal/term.c +7
-0+} + +void +grub_disable_temp_more (void ) +{ +if (!temp_more) +grub_set_more (0 );Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
Hello Daniel,
On 10/24/19 4:50 PM, Daniel Kiper wrote:
[snip]
Quoted 16 lines
Quoted 16 lines
From
7c4da6295ebd3a034d1f7e32099eab33efa465d4Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <[email protected]>
Date: Tue, 22 Oct 2019 15:35:12 +0200
Subject: [PATCH v2] Add aGRUB_COMMAND_FLAG_PAGINATEDto request paginated
output for commandsWhen user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
Since the out for some commands may not fit into a screen, add a new flag
GRUB_COMMAND_FLAG_PAGINATEDthat can be used when registering commands that can be used to request the pager to be enabled while executing the handler.
Quoted 8 lines
Quoted 1 line
Signed-off-by Javier Martinez Canillas <[email protected]>In general I like the idea but I think patch requires some polishing...
Hmmm... Still thinking about "-p" flag which allows user to choose between pager on/off. Or something which I proposed in the email to Michael...
I'm OK with any of the other two approaches too. But it seems that Vladimir is worried about the added complexity for these.
I honestly think that the approach in this patch is the least bad option since it doesn't require a special configuration or the user to do anything, just execute the command printing a lot of stuff and get paginated output by default.
Can't think why users would want to execute commands that print a lot of messages without the output being paginated, or why they would want to execute a command like help in in batch mode. It's only useful in interactive mode.
And also the patch is quite trivial, it already uses all the existing code for the pager option.
But I'll wait for the discussion to settle and a solution to be agreed upon, before posting a new patch for this.
Quoted 120 lines
Quoted 120 lines
---
Changes in v2:
- Only enable pager temporarily while printing output for commands that asked for paginated output instead of doing it globally using the pager variable.grub-core/commands/help.c | 3 ++- grub-core/commands/minicmd.c | 13 ++++++++----- grub-core/normal/dyncmd.c | 7 +++++++ grub-core/normal/term.c | 17 +++++++++++++++++ grub-core/script/execute.c | 7 +++++++ include/grub/command.h | 4 +++- include/grub/normal.h | 3 +++ 7 files changed, 47 insertions(+), 7 deletions(-)grub-core/commands/help.c +2
-1@@ -142,7 +142,8 @@ static grub_extcmd_t cmd;GRUB_MOD_INIT (help) { - cmd =grub_register_extcmd ("help" , grub_cmd_help,0 , + cmd =grub_register_extcmd ("help" , grub_cmd_help, +GRUB_COMMAND_FLAG_PAGINATED ,N_ ("[PATTERN ...]" ),N_ ("Show a help message." ),0 ); }grub-core/commands/minicmd.c +8
-5@@ -21,6 +21,7 @@#include <grub/mm.h> #include <grub/err.h> #include <grub/env.h> +#include <grub/extcmd.h> #include <grub/misc.h> #include <grub/file.h> #include <grub/disk.h> @@ -75,7 +76,7 @@ grub_mini_cmd_cat (struct grub_command *cmd __attribute__ ((unused)),/* help */ static grub_err_t -grub_mini_cmd_help (struct grub_command *cmd __attribute__ ((unused)), +grub_mini_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)),int argc __attribute__ ((unused)),char *argv[] __attribute__ ((unused))) {@@ -188,7 +189,8 @@ grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)),/* Not reached. */ } -static grub_command_t cmd_cat, cmd_help; +static grub_command_t cmd_cat; +static grub_extcmd_t cmd_help;static grub_command_t cmd_dump, cmd_rmmod, cmd_lsmod, cmd_exit;GRUB_MOD_INIT (minicmd)@@ -197,8 +199,9 @@ GRUB_MOD_INIT(minicmd)grub_register_command ("cat" , grub_mini_cmd_cat,N_ ("FILE" ),N_ ("Show the contents of a file." )); cmd_help = -grub_register_command ("help" , grub_mini_cmd_help, -0 ,N_ ("Show this message." )); +grub_register_extcmd ("help" , grub_mini_cmd_help, +GRUB_COMMAND_FLAG_PAGINATED , +0 ,N_ ("Show this message." ),0 ); cmd_dump =grub_register_command ("dump" , grub_mini_cmd_dump,N_ ("ADDR [SIZE]" ),N_ ("Show memory contents." ));@@ -216,7 +219,7 @@ GRUB_MOD_INIT(minicmd)GRUB_MOD_FINI (minicmd) {grub_unregister_command (cmd_cat); -grub_unregister_command (cmd_help); +grub_unregister_extcmd (cmd_help);grub_unregister_command (cmd_dump);grub_unregister_command (cmd_rmmod);grub_unregister_command (cmd_lsmod);grub-core/normal/dyncmd.c +7
-0@@ -78,11 +78,18 @@ grub_dyncmd_dispatcher (struct grub_extcmd_context *ctxt, cmd =grub_command_find (name);if (cmd) { +/* Temporarily enable paginated output for commands that asked for it */ +if (cmd->flags &GRUB_COMMAND_FLAG_PAGINATED ) +grub_enable_temp_more (); +if (cmd->flags &GRUB_COMMAND_FLAG_BLOCKS && cmd->flags &GRUB_COMMAND_FLAG_EXTCMD ) ret =grub_extcmd_dispatcher (cmd, argc, args, ctxt->script);else ret = (cmd->func) (cmd, argc, args); + +if (cmd->flags &GRUB_COMMAND_FLAG_PAGINATED ) +grub_disable_temp_more (); }else ret = grub_errno;grub-core/normal/term.c +1
-0@@ -57,6 +57,7 @@ static struct term_state *term_states = NULL;/* If the more pager is active. */ static int grub_more; +static int temp_more;static void putcode_real (grub_uint32_t code,struct grub_term_output *term,int fixed_tab);@@ -128,6 +129,22 @@ grub_set_more (int onoff)grub_normal_reset_more (); }
Quoted 12 lines
grub-core/normal/term.c grub_set_more (int onoff) · line 138
Quoted 7 lines
grub-core/normal/term.c +7
-0+void +grub_enable_temp_more (void ) +{ + temp_more = grub_more; + +if (!temp_more) +grub_set_more (1 );Does it change pager variable value? If yes I think that you should store its original value here and restore below.
Yes it does and that's why I added the temp_more variable.
It only calls to gru_set_more() if pager is disabled, since if is already enabled, then there's no need to call grub_set_more(1).
Quoted 8 lines
grub-core/normal/term.c grub_set_more (int onoff) · line 145
Quoted 7 lines
grub-core/normal/term.c +7
-0+} + +void +grub_disable_temp_more (void ) +{ +if (!temp_more) +grub_set_more (0 );
Same here, the pager only needs to be disabled if it wasn't enabled before.
Quoted 2 lines
Daniel
Best regards,
Signature · 3 lines
Javier Martinez Canillas Software Engineer - Desktop Hardware Enablement Red Hat
Quoted 41 lines · Javier Martinez Canillas
Hello Daniel,
On 10/24/19 4:50 PM, Daniel Kiper wrote:
[snip]
Quoted 16 lines
Quoted 16 lines
From
7c4da6295ebd3a034d1f7e32099eab33efa465d4Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <[email protected]>
Date: Tue, 22 Oct 2019 15:35:12 +0200
Subject: [PATCH v2] Add aGRUB_COMMAND_FLAG_PAGINATEDto request paginated
output for commandsWhen user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
Since the out for some commands may not fit into a screen, add a new flag
GRUB_COMMAND_FLAG_PAGINATEDthat can be used when registering commands that can be used to request the pager to be enabled while executing the handler.Quoted 7 lines
Quoted 1 line
Signed-off-by Javier Martinez Canillas <[email protected]>In general I like the idea but I think patch requires some polishing...
Hmmm... Still thinking about "-p" flag which allows user to choose between pager on/off. Or something which I proposed in the email to Michael...
I'm OK with any of the other two approaches too. But it seems that Vladimir is worried about the added complexity for these.
I honestly think that the approach in this patch is the least bad option since it doesn't require a special configuration or the user to do anything, just execute the command printing a lot of stuff and get paginated output by default.
Can't think why users would want to execute commands that print a lot of messages without the output being paginated, or why they would want to execute a command like help in in batch mode. It's only useful in interactive mode.
Quoted 5 lines
And also the patch is quite trivial, it already uses all the existing code for the pager option.
But I'll wait for the discussion to settle and a solution to be agreed upon, before posting a new patch for this.
After some thinking it seems to me that Valdimir is right and we should not over-complicate the solution. Let's print the message on interactive screen how to enable paging.
Daniel
I agree.
One of the Super Grub2 Disk options consists on showing from its menu the COPYRIGHT page... the pager variable is set to true so that the output is paged when the cat command is run.
This usecase might not work anymore if something else than prompting a message on the interactive screen was used.
Quoted 74 lines · Daniel Kiper
Quoted 11 lines · Javier Martinez Canillas
Hello Daniel,
On 10/24/19 4:50 PM, Daniel Kiper wrote:
[snip]
Quoted 5 lines
Quoted 5 lines
From
7c4da6295ebd3a034d1f7e32099eab33efa465d4Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <[email protected]>
Date: Tue, 22 Oct 2019 15:35:12 +0200
Subject: [PATCH v2] Add aGRUB_COMMAND_FLAG_PAGINATEDto requestpaginated
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
output for commands
When user enters into the GRUB shell and tries to use help command,
lot of
Quoted 1 line
Quoted 1 line
Quoted 1 line
information is scrolled out of screen and the user doesn't have
chance to
Quoted 1 line
Quoted 1 line
Quoted 1 line
read it. Also, there isn't any information about 'set pager=1' at the
end
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
of the help output, to tell the user how scrolling could be enabled.
Since the out for some commands may not fit into a screen, add a new
flag
Quoted 1 line
Quoted 1 line
Quoted 1 line
GRUB_COMMAND_FLAG_PAGINATEDthat can be used when registeringcommands that
Quoted 1 line
Quoted 1 line
Quoted 1 line
can be used to request the pager to be enabled while executing the
handler.
Quoted 10 lines
Quoted 8 lines
Quoted 2 lines
Signed-off-by Javier Martinez Canillas <[email protected]>In general I like the idea but I think patch requires some polishing...
Hmmm... Still thinking about "-p" flag which allows user to choose between pager on/off. Or something which I proposed in the email to Michael...
I'm OK with any of the other two approaches too. But it seems that
Vladimir
Quoted 3 lines
is worried about the added complexity for these.
I honestly think that the approach in this patch is the least bad option
since
Quoted 1 line
it doesn't require a special configuration or the user to do anything,
just
Quoted 1 line
execute the command printing a lot of stuff and get paginated output by
default.
Quoted 2 lines
Can't think why users would want to execute commands that print a lot of
messages
Quoted 1 line
without the output being paginated, or why they would want to execute a
command
Quoted 3 lines
like help in in batch mode. It's only useful in interactive mode.
And also the patch is quite trivial, it already uses all the existing
code for
Quoted 3 lines
the pager option.
But I'll wait for the discussion to settle and a solution to be agreed
upon,
Quoted 1 line
before posting a new patch for this.
After some thinking it seems to me that Valdimir is right and we should not over-complicate the solution. Let's print the message on interactive screen how to enable paging.
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Support free software. Donate to Super Grub Disk. Apoya el software libre. Dona a Super Grub Disk. https://www.supergrubdisk.org/donate/
Quoted 1 line · Daniel Kiper
On Fri, Oct 25, 2019 at 11:02:04AM +0200, Javier Martinez Canillas wrote:
[snip]
Quoted 8 lines
Quoted 3 lines
But I'll wait for the discussion to settle and a solution to be agreed upon, before posting a new patch for this.
After some thinking it seems to me that Valdimir is right and we should not over-complicate the solution. Let's print the message on interactive screen how to enable paging.
Ok, sounds good to me.
Quoted 2 lines
Daniel
Best regards,
Signature · 3 lines
Javier Martinez Canillas Software Engineer - Desktop Hardware Enablement Red Hat
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 14 lines · Daniel Kiper
Quoted 8 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
So just enable pager by default which leads to a much better experience.
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Quoted 7 lines
Quoted 2 lines
Ok. I'll then explore having a paginated output only for the help command instead of globally enabling it by default.
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce "-p" (pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
I'd like to add option to the list, which is grub could provide the information to have the commands able to tell they are executed in shell's interactive (aka command-line) or batch mode. After they could turn on/off paginated output according to the shell mode they are with.
Thanks,
Michael
Quoted 7 lines
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 28 lines · Michael Chang
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 14 lines · Daniel Kiper
Quoted 8 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
So just enable pager by default which leads to a much better experience.
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Quoted 7 lines
Quoted 2 lines
Ok. I'll then explore having a paginated output only for the help command instead of globally enabling it by default.
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce "-p" (pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
Quoted 4 lines
I'd like to add option to the list, which is grub could provide the information to have the commands able to tell they are executed in shell's interactive (aka command-line) or batch mode. After they could turn on/off paginated output according to the shell mode they are with.
Sounds interesting. However, I would go further. If pager == 1 and we are in batch mode then paging is inactive. If pager == 2 and we are in batch mode then paging is active. If we are in interactive mode then if pager != 0 then paging is active.
Daniel
Quoted 34 lines · Daniel Kiper
Quoted 28 lines · Michael Chang
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 14 lines · Daniel Kiper
Quoted 8 lines · Javier Martinez Canillas
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help command, lot of information is scrolled out of screen and the user doesn't have chance to read it. Also, there isn't any information about 'set pager=1' at the end of the help output, to tell the user how scrolling could be enabled.
So just enable pager by default which leads to a much better experience.
Hmmm... What will happen if a command produce tons of output during boot process? I am afraid that it will hang indefinitely waiting for an user input. This should not happen. So, I tend to agree that current help command behavior is annoying but I do not like the solution.
Quoted 7 lines
Quoted 2 lines
Ok. I'll then explore having a paginated output only for the help command instead of globally enabling it by default.
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce "-p" (pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
Quoted 4 lines
I'd like to add option to the list, which is grub could provide the information to have the commands able to tell they are executed in shell's interactive (aka command-line) or batch mode. After they could turn on/off paginated output according to the shell mode they are with.
Quoted 4 lines
Sounds interesting. However, I would go further. If pager == 1 and we are in batch mode then paging is inactive. If pager == 2 and we are in batch mode then paging is active. If we are in interactive mode then if pager != 0 then paging is active.
I agree completely. In this way we no longer have to worry about setting page=1 would disrupt boot process as some command output could go overly log and at the same time setting page=2 could enforce paginated output everywhere, like what is working now. :)
Thanks,
Michael
Quoted 2 lines
Daniel
Quoted 52 lines · On Fri, 25 Oct 2019, 08:20 Michael Chang, <[email protected]> wrote:
Quoted 3 lines · Daniel Kiper
Quoted 2 lines · Michael Chang
Quoted 1 line · Daniel Kiper
On Tue, Oct 22, 2019 at 10:30:20AM +0200, Javier Martinez Canillas
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hello Daniel,
Quoted 1 line · Daniel Kiper
On Fri, Oct 18, 2019 at 02:43:18PM +0200, Javier Martinez
Quoted 3 lines · Canillas
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help
command, lot of
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
information is scrolled out of screen and the user doesn't have
chance to
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
read it. Also, there isn't any information about 'set pager=1'
at the end
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
of the help output, to tell the user how scrolling could be
enabled.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
So just enable pager by default which leads to a much better
experience.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Hmmm... What will happen if a command produce tons of output
during boot
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
process? I am afraid that it will hang indefinitely waiting for
an user
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
input. This should not happen. So, I tend to agree that current
help
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
command behavior is annoying but I do not like the solution.
Ok. I'll then explore having a paginated output only for the help
command
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
instead of globally enabling it by default.
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce
"-p"
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
(pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
I'd like to add option to the list, which is grub could provide the information to have the commands able to tell they are executed in shell's interactive (aka command-line) or batch mode. After they could turn on/off paginated output according to the shell mode they are with.
Quoted 4 lines
Sounds interesting. However, I would go further. If pager == 1 and we are in batch mode then paging is inactive. If pager == 2 and we are in batch mode then paging is active. If we are in interactive mode then if pager != 0 then paging is active.
Quoted 5 lines
I agree completely. In this way we no longer have to worry about setting page=1 would disrupt boot process as some command output could go overly log and at the same time setting page=2 could enforce paginated output everywhere, like what is working now. :)
This increases complexity. Like what is batch mode. Is running sourcefile batch or no? There will be edge cases like this. More complexity is more risk. Moreover in this case the risk is not contained unlike in e.g. filesystem modules that are not even loaded unless needed. Also it fails at informing the user. In fact it does the opposite by making it more confusing at first glance. Informing the user on welcome message is better
Quoted 12 lines
Thanks,
MichaelQuoted 2 lines
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 54 lines · Vladimir 'phcoder' Serbinenko
Quoted 52 lines · On Fri, 25 Oct 2019, 08:20 Michael Chang, <[email protected]> wrote:
Quoted 3 lines · Daniel Kiper
Quoted 2 lines · Michael Chang
Quoted 1 line · Daniel Kiper
On Tue, Oct 22, 2019 at 10:30:20AM +0200, Javier Martinez Canillas
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hello Daniel,
Quoted 1 line · Daniel Kiper
On Fri, Oct 18, 2019 at 02:43:18PM +0200, Javier Martinez
Quoted 3 lines · Canillas
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Peter Jones <[email protected]>
When user enters into the GRUB shell and tries to use help
command, lot of
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
information is scrolled out of screen and the user doesn't have
chance to
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
read it. Also, there isn't any information about 'set pager=1'
at the end
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
of the help output, to tell the user how scrolling could be
enabled.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
So just enable pager by default which leads to a much better
experience.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Hmmm... What will happen if a command produce tons of output
during boot
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
process? I am afraid that it will hang indefinitely waiting for
an user
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
input. This should not happen. So, I tend to agree that current
help
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
command behavior is annoying but I do not like the solution.
Ok. I'll then explore having a paginated output only for the help
command
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
instead of globally enabling it by default.
Great! Though I would think about something which can be used also in other commands producing a lot of output. Maybe we should introduce
"-p"
Quoted 12 lines
Quoted 7 lines
Quoted 2 lines
(pause) command line option for such commands. And I am not against using existing code to do a pause. We just have to do it carefully.
I'd like to add option to the list, which is grub could provide the information to have the commands able to tell they are executed in shell's interactive (aka command-line) or batch mode. After they could turn on/off paginated output according to the shell mode they are with.
Sounds interesting. However, I would go further. If pager == 1 and we are in batch mode then paging is inactive. If pager == 2 and we are in batch mode then paging is active. If we are in interactive mode then if pager != 0 then paging is active.
Quoted 7 lines
Quoted 5 lines
I agree completely. In this way we no longer have to worry about setting page=1 would disrupt boot process as some command output could go overly log and at the same time setting page=2 could enforce paginated output everywhere, like what is working now. :)
This increases complexity. Like what is batch mode. Is running sourcefile batch or no?
Yes, any running script (via source or similar) from interactive shell is also batch mode, only the command directly read from user's input in grub's command shell is considered interactive.
Quoted 5 lines
There will be edge cases like this. More complexity is more risk. Moreover in this case the risk is not contained unlike in e.g. filesystem modules that are not even loaded unless needed. Also it fails at informing the user. In fact it does the opposite by making it more confusing at first glance. Informing the user on welcome message is better
OK. Adimttedly new behavior is more complex and more difficult to tell would inadvertantly enable interactive output. I am fine going with either way being discussed in this thread. :)
Thanks,
Michael
Quoted 18 lines
Quoted 6 lines
Thanks,
MichaelQuoted 1 line
Quoted 7 lines
Quoted 1 line
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel