Package: tcl8.4
Version: 8.4.9-1

The `exec' Tcl builtin command, and also `open' when used in pipeline
mode, cannot pass certain arguments to commands.  Any arguments
starting with < or > and many starting with | & 2 will be interpreted
as redirection attempts and there is no way to quote or override this
behaviour.

There should be a syntax which indicates that subsequent arguments are
not redirections.  (This is better than a per-argument quoting
arrangement because it means that pre-prepared argument lists do not
need to be passed through a quoter routine.)

The exercise is to allow for example what would be achieved in sh with
   echo ">" not a redirect >filename

Possible alternatives I can think of are:
   exec -redirects-as-options > filename -- echo > not a redirect
   exec > filename <>-- echo > not a redirect
but there are numerous possibilities.

Just to forestall the response "don't do that then", consider for
example how in Tcl one might feed a mail message to
  /usr/sbin/sendmail -odq -oee -oi -t -f <>
?

liberator:~> tclsh8.4
% exec /usr/sbin/sendmail < filename odq -oee -oi -t -f <>
couldn't read file ">": no such file or directory
%

Don't just focus on a workaround (for this case or in general);
obviously I know that there are workarounds.  But the workarounds are
inconvenient particularly in the general case.  I have a program where
an untrusted string ought to go through an argument to an external
program.  Any application which wants to pass arbitrary data as
arguments to external programs risks coming up against this
limitation.

Tcl should obviously be able to run any command that Unix itself is
able to support.

Ian.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to