From bfc9b2f89c4cd8962a74ab750c870a90da961805 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 16 May 2014 18:34:14 +0000 Subject: NOPERLDOC envvar override to avoid pod2usage() invoking perldoc (thread at http://tug.org/pipermail/tex-live/2014-May/035206.html) git-svn-id: svn://tug.org/texlive/trunk@34059 c570f23f-e606-0410-a88d-b1316a301751 --- Master/install-tl | 50 ++++++++++++++++++++++-------- Master/texmf-dist/scripts/texlive/tlmgr.pl | 23 +++++++++----- 2 files changed, 52 insertions(+), 21 deletions(-) (limited to 'Master') diff --git a/Master/install-tl b/Master/install-tl index e4d2740459e..8b70cfa1bf5 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -1,7 +1,7 @@ #!/usr/bin/env perl # $Id$ # -# Copyright 2007-2013 +# Copyright 2007-2014 # Reinhard Kotucha, Norbert Preining, Karl Berry, Siep Kroonenberg. # This file is licensed under the GNU General Public License version 2 # or any later version. @@ -234,13 +234,28 @@ if ($opt_gui eq "expert") { } if ($opt_help) { - if (win32()) { - pod2usage(-exitstatus => 0, -verbose => 2, - -noperldoc => 1, -output => \*STDOUT); + # theoretically we could make a subroutine with all the same + # painful checks as we do in tlmgr, but let's not bother until people ask. + my @noperldoc = (); + if (win32() || $ENV{"NOPERLDOC"}) { + @noperldoc = ("-noperldoc", "1"); + } + + # Tweak less stuff same as tlmgr, though. + # less can break control characters and thus the output of pod2usage + # is broken. We add/set LESS=-R in the environment and unset + # LESSPIPE and LESSOPEN to try to help. + # + if (defined($ENV{'LESS'})) { + $ENV{'LESS'} .= " -R"; } else { - pod2usage(-exitstatus => 0, -verbose => 2, -file => $0); + $ENV{'LESS'} = "-R"; } - die "sorry, pod2usage failure, maybe download failure?"; + delete $ENV{'LESSPIPE'}; + delete $ENV{'LESSOPEN'}; + + pod2usage(-exitstatus => 0, -verbose => 2, @noperldoc); + die "sorry, pod2usage did not work; maybe a download failure?"; } if ($opt_version) { @@ -265,14 +280,14 @@ if ($opt_version) { exit 0; } -die "Options custom-bin and in-place are incompatible." - if ($opt_in_place and $opt_custom_bin); +die "$0: Options custom-bin and in-place are incompatible.\n" + if ($opt_in_place && $opt_custom_bin); -die "Options profile and in-place are incompatible." - if ($opt_in_place and $opt_profile); +die "$0: Options profile and in-place are incompatible.\n" + if ($opt_in_place && $opt_profile); -die "Options profile-seed and in-place are incompatible." - if ($opt_in_place and $opt_profileseed); +die "$0: Options profile-seed and in-place are incompatible.\n" + if ($opt_in_place && $opt_profileseed); if ($#ARGV >= 0) { # we still have arguments left, should only be gui, otherwise die @@ -2216,7 +2231,12 @@ runnable, or installation will fail. C<-force-arch> is a synonym. =item B<-help>, B<--help>, B<-?> -Display this help and exit. +Display this help and exit (on the web via +L). Sometimes the +C and/or C programs on the system have problems, +possibly resulting in control characters being literally output. This +can't always be detected, but you can set the C environment +variable and C will not be used. =item B<-in-place> @@ -2361,6 +2381,10 @@ Omit creating the ConTeXt cache. This is useful for redistributors. Specify the respective directories. +=item C + +Don't try to run the C<--help> message through C. + =back diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index a20fc17e71f..dc9afba79e8 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -286,11 +286,12 @@ sub main { } if ($opts{"help"} || $opts{"h"}) { - # perldoc does ASCII emphasis on the output, so it's nice to use it. - # But not all Unix platforms have it, and on Windows our Config.pm - # can apparently interfere, so always skip it there. + # perldoc does ASCII emphasis on the output, and runs it through + # $PAGER, so people want it. But not all Unix platforms have it, + # and on Windows our Config.pm can apparently interfere, so always + # skip it there. Or if users have NOPERLDOC set in the environment. my @noperldoc = (); - if (win32()) { + if (win32() || $ENV{"NOPERLDOC"}) { @noperldoc = ("-noperldoc", "1"); } else { if (!TeXLive::TLUtils::which("perldoc")) { @@ -309,9 +310,10 @@ sub main { } } } - # in some cases LESSPIPE of less breaks control characters - # and the output of pod2usage is broken. - # We add/set LESS=-R in the environment and unset LESSPIPE to be sure + # less can break control characters and thus the output of pod2usage + # is broken. We add/set LESS=-R in the environment and unset + # LESSPIPE and LESSOPEN to try to help. + # if (defined($ENV{'LESS'})) { $ENV{'LESS'} .= " -R"; } else { @@ -6242,7 +6244,12 @@ revision number for the loaded TeX Live Perl modules are shown, too. =head2 help -Gives this help information (same as C<--help>). +Display this help information and exit (same as C<--help>, and on the +web at L). Sometimes the +C and/or C programs on the system have problems, +resulting in control characters being literally output. This can't +always be detected, but you can set the C environment +variable and C will not be used. =head2 version -- cgit v1.2.3