Whereas the "$@" form would produce
texmfstart.rb "--option=hi there"
This second form is what you want, no?
Ah, I see. (is that bash-only?)
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 machine running 'sh' (couldn't tell which version), but it's man entry says the same: if $@ is within a pair of double quotes, the positional parameters are substituted and quoted, separated by unquoted spaces ("$1""$2" ... ) So I think it's safe, and increases robustness, to change $@ -> "$@" in all the stub scripts.
Would it not work to simply point the variable TEXMFLOCAL to ~/texmf?
I was a little leery but tried it. Meanwhile here's a patch that fixes the need for that: --- a/scripts/context/ruby/ctxtools.rb Wed Jul 26 14:50:16 2006 -0400 +++ b/scripts/context/ruby/ctxtools.rb Wed Jul 26 14:53:57 2006 -0400 @@ -2314,7 +2314,7 @@ class Commands end def locatedlocaltree - return `kpsewhich --expand-var $TEXMFLOCAL`.chomp rescue nil + return `kpsewhich --expand-var '$TEXMFLOCAL'`.chomp rescue nil end def extractarchive(archive) The only problem is that it'll now, as intended, use the TEXMFLOCAL from texmf.cnf. But TEXMFLOCAL is probably not ~/texmf, so you'll still have to force the setting like this: TEXMFLOCAL=~/texmf texmfstart ctxtools --updatecontext The next problem was this message during the update: chmod: cannot access `scripts/context/unix/stubs/*': No such file or directory For my second attempt at ruby programming (the first being the two glorious quotes above), I looked to see what ctxtools.rb was doing around the chmod. It was supposed to report an error with this line: report("change x-permissions of '" + stubs + "' manually") But the line was not executed, because it was in a ruby 'rescue' clause. But when system("chmod +x ....") fails, it returns false, but does not throw an exception for rescue. So I rewrote the extractarchive() function to wrap the system() calls in if/unless clauses rather than rescue clauses. In doing so I noticed why the chmod failed: the path should be scripts/context/stubs/unix/* rather than scripts/context/unix/stubs/* The patch below does that change as well as the change of rescue -> if/unless. With these patches the automatic update went smoothly. One question: How safe is it that the ctxtools.rb script is overwritten by the unzip in the middle of running the script? Will ruby execute half from the old script and half from the new script? It wasn't an issue for me, I eventually realized, because the -u switch to unzip meant that my updated ctxtools.rb was not overwritten. But in general it will be. --- a/scripts/context/ruby/ctxtools.rb Wed Jul 26 14:54:24 2006 -0400 +++ b/scripts/context/ruby/ctxtools.rb Wed Jul 26 15:36:21 2006 -0400 @@ -2318,26 +2318,19 @@ class Commands end def extractarchive(archive) - if FileTest.file?(archive) then - begin - system("unzip -uo #{archive}") - rescue - report("fatal error, make sure that you have 'unzip' in your path") - return false - else - if System.unix? then - begin - system("chmod +x scripts/context/unix/stubs/*") - rescue - report("change x-permissions of 'scripts/context/unix/stubs/*' manually") - end - end - return true - end - else + unless FileTest.file?(archive) then report("fatal error, '{archive}' has not been downloaded") return false end + unless system("unzip -uo #{archive}") then + report("fatal error, make sure that you have 'unzip' in your path") + return false + end + stubs = "scripts/context/stubs/unix/*" + if System.unix? and not system("chmod +x " + stubs) then + report("change x-permissions of '" + stubs + "' manually") + end + return true end def remakeformats