-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use -r with less for help output #391
Conversation
Not opposed to this, but I want to make sure I understand what's going on. I can only reproduce this issue on fedora. I have no issues on Mac/Ubuntu. From what I can tell, the output of groff is different on fedora. This is the hexdump of the output from mac/ubuntu: https://gist.github.com/jamesls/9eba11c743d06eb58a5b I'm not intimately familiar with fedora, so I'm not sure why there's a difference. Perhaps the easiest way to fix this is to just change the default pager, but I wonder if there's a way to get uniform groff output across the linux platforms. I did verify that if I take the output from |
After some digging, I found that Debian ships /etc/groff/man.local that disables use of SGR escape codes (ANSI colors, the things that mess up the output) for man pages. Presumably OSX does similar. In this case, we see in your hexdump it falling back to the "old" way of using a backspace and repeating the character. the grotty man page says
So it seems passing -r to less gives maximum compatibility. For Debian/Ubuntu/OSX that are using the backspace method, the -r doesn't affect things. For Fedora (and anyone else whose grotty outputs SGR codes) it looks correct The other option is to force grotty to only output the "old" method with "-P-c" to groff. This seems to be what man does on Fedora
that also probably works everywhere. |
I posted a support request on AWS for this same problem. Also I found that there is a similar problem with console output. I have only pasted the last bit from the aws ec2 get-console-output command here: Verifying : 32:bind-libs-9.8.2-0.17.rc1.29.amzn1.x86_64 6/6 \r\n\r\nUpdated:\r\n bind-libs.x86_64 32:9.8.2-0.17.rc1.30.amzn1 \r\n bind-utils.x86_64 32:9.8.2-0.17.rc1.30.amzn1 \r\n java-1.6.0-openjdk.x86_64 1:1.6.0.0-62.1.11.11.90.55.amzn1 \r\n\r\nComplete!\r\n[ OK ]\r\r\ncloud-init: puppet[ OK ]\r\r\ncloud-init: runcmd[ OK ]\r\r\nMounting other filesystems: [ OK ]\r\r\nRetrigger failed udev events--type=failed is deprecated and will be removed from a future udev release.\r\n[ OK ]\r\r\nGenerating SSH1 RSA host key: [ OK ]\r\r\nStarting sshd: [ OK ]\r\r\nntpdate: Synchronizing with time server: [ OK ]\r\r\nStarting ntpd: [ OK ]\r\r\nStarting sendmail: [ OK ]\r\r\nStarting sm-client: [ OK ]\r\r\nStarting crond: [ OK ]\r\r\nStarting atd: [ OK ]\r\r\nRunning cloud-init user-scriptsSep 16 05:23:05 ip-192-168-100-148 kernel: Kernel logging (proc) stopped.\r\nSep 16 05:23:05 util kernel: imklog 5.8.10, log source = /proc/kmsg started.\r\n[ 128.589483] EXT4-fs (xvdf1): mounted filesystem with ordered data mode. Opts: (null)\r\nSep 16 05:24:10 util kernel: [ 128.589483] EXT4-fs (xvdf1): mounted filesystem with ordered data mode. Opts: (null)\r\n[ OK ]\r\r\n\r\nAmazon Linux AMI release 2013.03\r\nKernel 3.4.43-43.43.amzn1.x86_64 on an x86_64\r\n\r\nutil.ops.mmd login: " Chandana |
Thanks @ianw for the research, much appreciated. While I thought it would be nice to have groff create the same output on all platforms, it doesn't seem like that would help much. Given that fedora users will have to change their @ianw just want to double check, from your quoted output of the grotty man page, it says to use |
hmm, -R is a restricted version. let's use that |
On some platforms, such as Fedora, groff by default outputs control characters which less will display escaped by default (on other platforms such as Debian and OSX this is disabled via local customisations and falls back to the old method of backspacing over characters). Using less -R as the pager means that output looks correct in both cases.
@ianw Thanks for all your help with this. |
groff outputs control characters which less will display escaped by
default. Since it's all safe (non-cursor moving) commands like bold,
underline, etc., by default allow less to process them with -r