[tex-live] tlmgr w/ --machine-readable uses incorrect file descriptor

Norbert Preining preining at logic.at
Tue Feb 20 06:44:57 CET 2018


Dear Nakata-san,


> > With the −−machine−readable option, tlmgr writes to stdout in the fixed
> > line-oriented format described here, and the usual informational messages
> > for human consumption are written to stderr (normally they are written to stdout).
> 
> Does tlmgr --version --machine-readable fall under the latter category (i.e.,
> information consumed by human)?

Yes probably. --machine-readable is not fully supported by each and
every command, thus the discrepancy. At the moment what tlmgr does is
simply
  info(give_version());
give_version computes a proper machine readable output in this case, but
info works in a way that under --machine-readable it outputs to stderr.

I just committed the following change:
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -436,7 +436,12 @@ sub main {
   ddebug("arguments: @ARGV\n") if @ARGV;

   if ($opts{"version"} || (defined $action && $action eq "version")) {
-    info(give_version());
+    if ($::machinereadable) {
+      # give_version already is machinereadable aware
+      print give_version();
+    } else {
+      info(give_version());
+    }
     exit(0);
   }
which outputs the info to stdout in case of --machine-readable --version

Thanks

Norbert

--
PREINING Norbert                               http://www.preining.info
Accelia Inc.     +    JAIST     +    TeX Live     +    Debian Developer
GPG: 0x860CDC13   fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13


More information about the tex-live mailing list