[NTG-context] updating context on Ubuntu 6.06

Sanjoy Mahajan sanjoy at mrao.cam.ac.uk
Thu Jul 27 14:37:11 CEST 2006


> > It was hard to find a machine not running bash, a measure of the
> > success of free software.  But I eventually found a nearby Solaris
> >   
> more a measure of the lack of diversity ... imagine everyone living a 
> house of the same design, driving the same car, etc etc

Or instead walking, cycling, or taking public transit...but I dream.

> can you try: ...

I ran this ruby script (on Linux):

  def locatedlocaltree
      tree = `kpsewhich --expand-path $TEXMFLOCAL`.chomp rescue nil
      unless tree && FileTest.directory?(tree) then
      tree = `kpsewhich --expand-path $TEXMF`.chomp rescue nil
      end
      return tree
  end

  print locatedlocaltree+"\n"

and got the error due to lack of quotes around $TEXMF{,LOCAL}:

  kpsewhich: option `--expand-path' requires an argument
  kpsewhich: option `--expand-path' requires an argument

Unix definitely needs those quotes to protect the variables in the
backquoted command from the shell.

Also the 'rescue nil' doesn't seem to have any effect.  Probably
similar to system(), the `cmd` construct doesn't raise an exception if
the command fails or even isn't found.  Instead you get tree equal to
the empty string, since `` captures (the empty) stdout.

Is path expansion (instead of variable expansion) a risky change?  It
might make tree a colon-separated list.  That will cause trouble for
the directory test in the 'unless' clause, and also break later uses
of the returned value of locatedlocaltree that assume it is one path
element.

-Sanjoy

`Never underestimate the evil of which men of power are capable.'
         --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.


More information about the ntg-context mailing list