[tex-live] oversimplyfied test for lzmadec existence

Jukka Salmi j+tex-live at 2009.salmi.ch
Wed Jan 14 16:07:44 CET 2009


Hello,

after installing TL 2008 on a NetBSD/i386 4.0 system I noticed that
tlmgr(1) always complains about lzmadec not being found (I do have a
usable lzmadec binary in my $PATH):

$ tlmgr arch list
Use of uninitialized value in concatenation (.) or string at /opt/texlive/2008/bin/i386-netbsd/tlmgr line 1819, <TMP> line 4977.
no binary of lzmadec for  detected.

(The same warning seems to be printed for other tlmgr actions, even
though it's not always fatal.)

Looking at setup_programs() from tlpkg/TeXLive/TLUtils.pm, it seems to
me that tlmgr gives up too early:

  Returns -1 if the architecture is not supported (i.e., there is no
  C<lzmadec> binary for that arch present), 0 for programs don't work, and
  1 for success.
  [...]
  # check for existence of lzmadec; this determines whether the present
  # pltform is supported.  [...]
  [...]
  return(-1) if (! -r $lzmadec);

(BTW, why -r instead of -x?)

The attached patch changes this behaviour (in a backward compatible way,
of course ;-)) to try to run the program even if the absolute path is
not given.

Any comments?


Regards, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~
-------------- next part --------------
--- tlpkg/TeXLive/TLUtils.pm.orig	2008-12-30 00:56:17.000000000 +0100
+++ tlpkg/TeXLive/TLUtils.pm	2009-01-14 16:02:26.000000000 +0100
@@ -1271,12 +1271,15 @@ sub setup_programs {
   }
 
   # check for existence of lzmadec; this determines whether the present
-  # pltform is supported.  Because of conv_to_w32_path possibly adding
+  # pltform is supported.  But don't give up yet if it's not supported
+  # since the test for a working lzmadec below could still succeed if
+  # the binary is found in $PATH.
+  # Because of conv_to_w32_path possibly adding
   # quotes, strip them away for the file test.  Since all other uses of
   # conv_to_w32_path use the result in shell commands, this is the most
   # expedient thing to do.
   (my $lzmadec = $::progs{'lzmadec'}) =~ s/^"(.*)"/$1/;
-  return(-1) if (! -r $lzmadec);
+  my $found_lzmadec = -x $lzmadec;
 
   # check that the programs are actually working
   my $nul = "/dev/null";
@@ -1291,7 +1294,7 @@ sub setup_programs {
       warn "$::progs{$prog} $opt failed (status $ret): $!\n";
       warn "Output is:\n";
       system ("$::progs{$prog} $opt");
-      return 0;
+      return $found_lzmadec ? 0 : -1;
     }
   }
   return 1;


More information about the tex-live mailing list