https://bugzilla.redhat.com/show_bug.cgi?id=1329059
Bug ID: 1329059 Summary: Don't produce terminal control sequences in perldoc Product: Fedora Version: rawhide Component: perl-Pod-Perldoc Keywords: FutureFeature, Reopened Assignee: ppisar@redhat.com Reporter: praiskup@redhat.com QA Contact: extras-qa@fedoraproject.org CC: extras-qa@fedoraproject.org, hhorak@redhat.com, jmlich83@gmail.com, mmaslano@redhat.com, perl-devel@lists.fedoraproject.org, ppisar@redhat.com, ToddAndMargo@zoho.com Depends On: 1258741
+++ This bug was initially created as a clone of Bug #1258741 +++
Short summary, command 'PAGER=less perldoc perlreref' behaves oddly.
The issue is that perldoc *always* produces some terminal (color?) sequences, and less (by default) is careful to escape terminal sequences rather then printing them in a raw form.
This bug is here to ask whether it is possible (or makes sense) to not produce terminal sequences in perldoc output. Or simply request for brainstorm.
See the original bug report for more info.
Referenced Bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=1258741 [Bug 1258741] "PAGER=less perldoc perlreref" escapes color sequences, drop them or interpret them
https://bugzilla.redhat.com/show_bug.cgi?id=1329059
Petr Pisar ppisar@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |CLOSED Resolution|--- |WORKSFORME Last Closed| |2016-04-21 02:28:49
--- Comment #1 from Petr Pisar ppisar@redhat.com --- I cannot reproduce it on Fedora 23:
TERM=xterm LESSOPEN=|/usr/bin/lesspipe.sh %s ncurses-5.9-21.20150214.fc23.x86_64 ncurses-libs-5.9-21.20150214.fc23.x86_64 xterm-318-2.fc23.x86_64 less-481-1.fc23.x86_64 perl-Pod-Perldoc-3.25-347.fc23.noarch
Though I admit some people sometimes complained about the same issue. I would welcome reliable reproducer.
To the question: Yes, perldoc has "-t" argument that disables ANSI sequences on the output. I think "perldoc --help" is not so hard way to discover it.
I can fairly reproduce it with "perldoc -T perlreref | less". The capital -T prints the output to stdout instead of sending it to a pager. But the perldoc (that I have, the behavior changes with various perldoc versions) feeds the pager from a temporary file. strace shows:
[pid 3367] execve("/usr/bin/less", ["less"], ["XDG_VTNR=1", "XDG_SESSION_ID=1", "SSH_AGENT_PID=2103", "HOSTNAME=dhcp-0-146.brq.redhat.c"..., "SHELL=/bin/bash", "TERM=xterm", "HISTSIZE=1000", "TERMPATH=/home/petr/.termcap:/et"..., "WINDOWID=65011747", "QTDIR=/usr/lib64/qt-3.3", "QTINC=/usr/lib64/qt-3.3/include", "XORG_RUN_AS_USER_OK=1", "USER=petr", "XTERM_SHELL=/bin/bash", "LS_COLORS=rs=0:di=01;34:ln=01;36"..., "SSH_AUTH_SOCK=/tmp/ssh-QUjk3MkTh"..., "PAGER=less", "PATH=/home/petr/bin:/usr/lib64/q"..., "MAIL=/var/spool/mail/petr", "_=/usr/bin/less", "QT_IM_MODULE=xim", "PWD=/home/petr", "XMODIFIERS=@im=SCIM", "EDITOR=/usr/bin/vim", "LANG=cs_CZ.UTF-8", "MODULEPATH=/etc/scl/modulefiles:"..., "LOADEDMODULES=", "HISTCONTROL=ignoredups", "XTERM_VERSION=XTerm(318)", "XTERM_LOCALE=cs_CZ.UTF-8", "HOME=/home/petr", "XDG_SEAT=seat0", "SHLVL=5", "LESS=-R", "LOGNAME=petr", "CVS_RSH=ssh", "QTLIB=/usr/lib64/qt-3.3/lib", "MODULESHOME=/usr/share/Modules", "LESSOPEN=|/usr/bin/lesspipe.sh %"..., "WINDOWPATH=1", "XDG_RUNTIME_DIR=/run/user/500", "DISPLAY=:0.0", "GTK_IM_MODULE=scim", "XAUTHORITY=/home/petr/.Xauthorit"..., "CCACHE_HASHDIR=", "BASH_FUNC_module()=() { eval `/"..., "BASH_FUNC_scl()=() { local CMD="...]) = 0
I suspect perldoc sets LESS=-R. I dont' have the variable in my environment:
$ set |grep LESS LESSOPEN='|/usr/bin/lesspipe.sh %s'
"perldoc -T perlreref | LESS=-R less" works for me.
From my point of view, perldoc is fine in Fedora. This is issue in RHEL-7's perldoc.
https://bugzilla.redhat.com/show_bug.cgi?id=1329059
--- Comment #2 from Petr Pisar ppisar@redhat.com --- Actually I cannot reproduce it in RHEL-7 either. Thought it works there probably for some other reason. If you want to open a bug for RHEL-7, I need the reproducer.
https://bugzilla.redhat.com/show_bug.cgi?id=1329059
--- Comment #3 from Pavel Raiskup praiskup@redhat.com --- (In reply to Petr Pisar from comment #1)
I cannot reproduce it on Fedora 23:
I feel I'm facing some magic, because I'm not able to reproduce this on F23 neither, *now*.
To the question: Yes, perldoc has "-t" argument that disables ANSI sequences on the output. I think "perldoc --help" is not so hard way to discover it.
The question is whether it would be possible to not print terminal sequences *by default*; not how it can be done. But yes -- as it obviously works on F23, there is no need to change anything.
I suspect perldoc sets LESS=-R. I dont' have the variable in my environment:
That's right.
From my point of view, perldoc is fine in Fedora. This is issue in RHEL-7's perldoc.
Correct.
(In reply to Petr Pisar from comment #2)
Actually I cannot reproduce it in RHEL-7 either. Thought it works there probably for some other reason. If you want to open a bug for RHEL-7, I need the reproducer.
In RHEL7, I'm able to reproduce it. Perldoc does not set the LESS variable, can be debugged by:
$ cat lesswrap #! /bin/sh env | grep -i less less "$@"
$ PAGER=./lesswrap perldoc perlreref
Petr, can you confirm?
https://bugzilla.redhat.com/show_bug.cgi?id=1329059
--- Comment #4 from Pavel Raiskup praiskup@redhat.com --- (In reply to Pavel Raiskup from comment #3)
In RHEL7, I'm able to reproduce it. Perldoc does not set the LESS variable, can be debugged by:
$ cat lesswrap #! /bin/sh env | grep -i less less "$@"
$ PAGER=./lesswrap perldoc perlreref
Petr, can you confirm?
While, of course, you can use:
$ PERLDOCDEBUG=1 PAGER=./lesswrap perldoc perlreref $ # hit the CTRL^Z $ # open the temp file generated by perldoc to see that the color sequences # are there.
https://bugzilla.redhat.com/show_bug.cgi?id=1329059
--- Comment #5 from Petr Pisar ppisar@redhat.com --- Yes, in RHEL-7 if the PAGER is defined, then the ANSI sequences are not interpreted.
https://bugzilla.redhat.com/show_bug.cgi?id=1329059
Petr Pisar ppisar@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugzilla.redhat.com | |/show_bug.cgi?id=1614708
perl-devel@lists.fedoraproject.org