texlive[44243] Master/tlpkg/TeXLive/TLUtils.pm: (wsystem): report

commits+karl at tug.org commits+karl at tug.org
Mon May 8 01:16:48 CEST 2017


Revision: 44243
          http://tug.org/svn/texlive?view=revision&revision=44243
Author:   karl
Date:     2017-05-08 01:16:48 +0200 (Mon, 08 May 2017)
Log Message:
-----------
(wsystem): report exit status in warning.

(setup_unix_one): quote '$def' in system() call,
hoping to placate spaces in the path. Doc tweaks.

Modified Paths:
--------------
    trunk/Master/tlpkg/TeXLive/TLUtils.pm

Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm	2017-05-07 23:08:56 UTC (rev 44242)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm	2017-05-07 23:16:48 UTC (rev 44243)
@@ -554,11 +554,12 @@
 sub wsystem {
   my ($msg, at args) = @_;
   info("$msg @args ...\n");
-  my $status = system(@args);
-  if ($status != 0) {
-    tlwarn("$0:  command failed: @args: $!\n");
+  my $retval = system(@args);
+  if ($retval != 0) {
+    $retval /= 256 if $retval > 0;
+    tlwarn("$0:  command failed (status $retval): @args: $!\n");
   }
-  return $status;
+  return $retval;
 }
 
 
@@ -578,6 +579,7 @@
     my $pwd = cwd ();
     die "$0: system(@args) failed in $pwd, status $retval";
   }
+  return $retval;
 }
 
 =item C<run_cmd($cmd)>
@@ -2302,19 +2304,18 @@
   if (-r $def) {
     my $ready = 0;
     if (-x $def) {
-      ddebug("default $def is readable and executable!\n");
-      # checking only for the executable bit is not enough, we have
-      # to check for actualy "executability" since a "noexec" mount
-      # option may interfere, which is not taken into account by
-      # perl's -x test.
+      ddebug("default $def has executable permissions\n");
+      # we have to check for actual "executability" since a "noexec"
+      # mount option may interfere, which is not taken into account by -x.
       $::progs{$p} = $def;
       if ($arg ne "notest") {
-        my $ret = system("$def $arg > /dev/null 2>&1" ); # we are on Unix
+        my $ret = system("'$def' $arg >/dev/null 2>&1" ); # we are on Unix
         if ($ret == 0) {
           $ready = 1;
           debug("Using shipped $def for $p (tested).\n");
         } else {
-          ddebug("Shipped $def has -x but cannot be executed.\n");
+          ddebug("Shipped $def has -x but cannot be executed, "
+                 . "trying tmp copy.\n");
         }
       } else {
         # do not test, just return
@@ -2363,11 +2364,10 @@
     $test_fallback = 1;
   }
   if ($test_fallback) {
-    # all our playing around and copying did not succeed, try the
-    # fallback
+    # all our playing around and copying did not succeed, try PATH.
     $::progs{$p} = $p;
     if ($arg ne "notest") {
-      my $ret = system("$p $arg > /dev/null 2>&1");
+      my $ret = system("$p $arg >/dev/null 2>&1");
       if ($ret == 0) {
         debug("Using system $p (tested).\n");
       } else {



More information about the tex-live-commits mailing list