fdisk
I have a question about (or a enhancement request) running fdisk. When asking to list known partition types, I get about 70 lines of output. Generally that would not be a problem, but I was running in a Debian install/rescue iso that uses busybox in a 25 line terminal. I do not have a way to scroll up and thus cannot see the first 40 or so partition types.
Is there a way to use a pager for this? In this situation 'more' is available but 'less' is not. Otherwise I think an automatic pause every 20 lines or so would be appropriate to build into the partition type listing.
-- Bruce Dubbs
Quoted 11 lines · Bruce Dubbs
I have a question about (or a enhancement request) running fdisk. When asking to list known partition types, I get about 70 lines of output. Generally that would not be a problem, but I was running in a Debian install/rescue iso that uses busybox in a 25 line terminal. I do not have a way to scroll up and thus cannot see the first 40 or so partition types.
Is there a way to use a pager for this? In this situation 'more' is available but 'less' is not. Otherwise I think an automatic pause every 20 lines or so would be appropriate to build into the partition type listing.
hmm, I'm getting 27 lines (at a maximum line length of 79 characters) as output of the 'l' command here - even if I resize the xterm to 20x80 characters.
OTOH, the main help output via the 'm' command uses 38 lines. Shouldn't you also have issues with that one in your environment?
Have a nice day,
Berny
Quoted 13 lines · Bernhard Voelker
Quoted 11 lines · Bruce Dubbs
I have a question about (or a enhancement request) running fdisk. When asking to list known partition types, I get about 70 lines of output. Generally that would not be a problem, but I was running in a Debian install/rescue iso that uses busybox in a 25 line terminal. I do not have a way to scroll up and thus cannot see the first 40 or so partition types.
Is there a way to use a pager for this? In this situation 'more' is available but 'less' is not. Otherwise I think an automatic pause every 20 lines or so would be appropriate to build into the partition type listing.
Quoted 5 lines
hmm, I'm getting 27 lines (at a maximum line length of 79 characters) as output of the 'l' command here - even if I resize the xterm to 20x80 characters.
OTOH, the main help output via the 'm' command uses 38 lines. Shouldn't you also have issues with that one in your environment?
In a konsole terminal resized to
# echo $LINES 25 # fdisk --version fdisk from util-linux 2.26.2
Yes, the main menu scrolls off the top do the topmost line is:
n add a new partition
but that is not a big problem in konsole because I can scroll back the buffer. The l command lists the partition types and the topmost line of the screen is entry number 44.
If it's meaningful, for konsole, I do not use a LANG or any LC_* variables and the TERM variable is xterm.
The difficult problem is in busybox where there is no scroll back capability.
The problem should be relatively easy to reproduce. Get a copy of debian-8.1.0-amd64-DVD-1.iso and boot it either to HW or in a virtual system (I'm using qemu). Follow the prompts and drop to a terminal and then run fdisk.
-- Bruce
-- Bruce
Quoted 29 lines · Bruce Dubbs
Quoted 13 lines · Bernhard Voelker
Quoted 11 lines · Bruce Dubbs
I have a question about (or a enhancement request) running fdisk. When asking to list known partition types, I get about 70 lines of output. Generally that would not be a problem, but I was running in a Debian install/rescue iso that uses busybox in a 25 line terminal. I do not have a way to scroll up and thus cannot see the first 40 or so partition types.
Is there a way to use a pager for this? In this situation 'more' is available but 'less' is not. Otherwise I think an automatic pause every 20 lines or so would be appropriate to build into the partition type listing.
Quoted 5 lines
hmm, I'm getting 27 lines (at a maximum line length of 79 characters) as output of the 'l' command here - even if I resize the xterm to 20x80 characters.
OTOH, the main help output via the 'm' command uses 38 lines. Shouldn't you also have issues with that one in your environment?In a konsole terminal resized to
# echo $LINES 25 # fdisk --version fdisk from util-linux 2.26.2Yes, the main menu scrolls off the top do the topmost line is:
Quoted 8 lines
n add a new partition
but that is not a big problem in konsole because I can scroll back the buffer. The l command lists the partition types and the topmost line of the screen is entry number 44.
The difficult problem is in busybox where there is no scroll back capability.
If you do not switch VTs, the Linux kernel has a limited "scroll back" capability:
use <Shift>+<PgUp> or <Shift>+<PgDn>.
There are serious enough limitations to this that it's not really viable except as a workaround:
-only things that have been on-screen after you last switched to the current VT will be visible
-switch VTs, and you lose history
But it may be useful to you.
HTH,
Isaac Dunham
Karel Zak
maintainerQuoted 9 lines · Bruce Dubbs
I have a question about (or a enhancement request) running fdisk. When asking to list known partition types, I get about 70 lines of output. Generally that would not be a problem, but I was running in a Debian install/rescue iso that uses busybox in a 25 line terminal. I do not have a way to scroll up and thus cannot see the first 40 or so partition types.
Is there a way to use a pager for this? In this situation 'more' is available but 'less' is not. Otherwise I think an automatic pause every 20 lines or so would be appropriate to build into the partition type listing.
We have lib/pager.c and setup_pager(), but it assumes that the pager is running all time and maintain stdout until parent process terminate.
Maybe we can implement something like
pid = setup_temporary_pager();
<list partition types>
close_pager(pid);
as I don't think we want to use pager all time for fdisk.
Volunteers?:-)
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 21 lines · Karel Zak
Quoted 9 lines · Bruce Dubbs
I have a question about (or a enhancement request) running fdisk. When asking to list known partition types, I get about 70 lines of output. Generally that would not be a problem, but I was running in a Debian install/rescue iso that uses busybox in a 25 line terminal. I do not have a way to scroll up and thus cannot see the first 40 or so partition types.
Is there a way to use a pager for this? In this situation 'more' is available but 'less' is not. Otherwise I think an automatic pause every 20 lines or so would be appropriate to build into the partition type listing.
We have
lib/pager.candsetup_pager(), but it assumes that the pager is running all time and maintain stdout until parent process terminate.Maybe we can implement something like
pid =
setup_temporary_pager();
<list partition types>
close_pager(pid);
Quoted 5 lines
as I don't think we want to use pager all time for fdisk.
Volunteers?:-)
Karel
I'm tempted to volunteer, but I'd like to run something by you first.
I presume that setup_temporary_pager() needs to spawn a pager, with the pager inheriting stdout/stderr and stdout temporarily redirected to the pipe, and then close_pager() needs to close the pipe and swap the old stdout/stderr back in, then wait for pid to exit.
Thus, I'm thinking that the following prototypes would be better:
/* create a pipe, spawn a temporary pager,
* dup()s fd 1 and possibly fd 2 before redirecting to the pipe
* if an fd is not dup()'d, set the corresponding duplicate to -1 */pid_t setup_temporary_pager(int *dupout, int *duperr);
/* close the pipe, dup2() the saved fds back over fds 1/2,
* close the duplicates, and wait for the temporary pager to exit
* if either fd is -1, skip it.
*/
void close_pager(pid, int dupout, int duperr);
setup_temporary_pager will return -1 if it does not spawn the pager (whether by failure or by PAGER=cat), or if there are problems during the redirection dance.
It will refuse to spawn a pager if (!isatty(STDOUT_FILENO)).
Does this sound sensible?
Thanks,
Isaac Dunham
Karel Zak
maintainerQuoted 15 lines · Isaac Dunham
Thus, I'm thinking that the following prototypes would be better:
/* create a pipe, spawn a temporary pager,
* dup()s fd 1 and possibly fd 2 before redirecting to the pipe
* if an fd is not dup()'d, set the corresponding duplicate to -1 */pid_tsetup_temporary_pager(int *dupout, int *duperr);/* close the pipe,
dup2()the saved fds back over fds 1/2,
* close the duplicates, and wait for the temporary pager to exit
* if either fd is -1, skip it.
*/
voidclose_pager(pid, int dupout, int duperr);
Quoted 4 lines
setup_temporary_pagerwill return -1 if it does not spawn the pager (whether by failure or by PAGER=cat), or if there are problems during the redirection dance.
It will refuse to spawn a pager if (!isatty(STDOUT_FILENO)).
Yes, on non-tty stdout the both functions have to do nothing.
Quoted 1 line
Does this sound sensible?
Yes, go ahead.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com