It's nice that wget and unzip are included with J for Windows users, but
there's a small bug in the implementation. Whereas
~system\extras\util\pacman.ijs puts quotes around the unzip command:
UNZIP=: '"',(jpath '~install/tools/zip/unzip.exe'),'" -o -C '
it does not do so for the wget command:
HTTPCMD=: jpath '~install/tools/ftp/wget.exe -O %O -o %L -t %T %U'
which causes problems when the path to the J folder includes spaces (say it's
installed in C:\Program Files). Specifically, PacMan cannot operate because
when it trys to call wget the OS responds with
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
But wait, there's more. The call will /still/ fail, due to cmd.exe's arcane
option parsing. To wit:
If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:
1. If all of the following conditions are met, then quote
characters
on the command line are preserved:
- no /S switch
- exactly two quote characters
- no special characters between the two quote characters,
where special is one of: &<>()@^|
- there are one or more whitespace characters between the
the two quote characters
- the string between the two quote characters is the name
of an executable file.
2. Otherwise, old behavior is to see if the first character is
a quote character and if so, strip the leading character and
remove the last quote character on the command line, preserving
any text after the last quote character.
There are a variety of options to fix this. The easiest is probably to quote
the entire string before passing it to shell:
e=. shellcmd dquote HTTPCMD rplc '%O';(dquote p);'%L';(dquote
q);'%T';t;'%U';f
or to use the parenthesizing mechanism discovered by Oleg in
http://www.jsoftware.com/pipermail/programming/2007-April/006177.html :
e=. shellcmd '(',')',~ HTTPCMD rplc '%O';(dquote p);'%L';(dquote
q);'%T';t;'%U';f
A more robust solution is to include the fix in ~system\packages\misc\task.ijs
itself, either by quoting or parenthesizing all arguments, as above, or by
using a modification I posted in
http://www.jsoftware.com/pipermail/programming/2007-April/006178.html .
The former method is a subtly dangerous (because it may change the actual
command issued), and if it's adopted I suggest we introduce new verbs which
quote (or parenthesize) their arguments, and not change the present verbs.
That way we're backwards compatible, but the user has the option to pass the
buck if he's not positive his command will pass muster with cmd.exe. If during
his testing he discovers the new verbs cause trouble, he can always do the
legwork himself, and use the old (present) ones.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm