Tcl Source Code

View Ticket
Login
Ticket UUID: 1109294
Title: Tcl_OpenFileChannel doesn't say that argv must end in NULL
Type: Bug Version: obsolete: 8.4.9
Submitter: davidw Created on: 2005-01-25 18:50:40
Subsystem: 25. Channel System Assigned To: andreas_kupries
Priority: 7 High Severity:
Status: Closed Last Modified: 2005-10-06 05:10:13
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2005-10-05 22:10:13
Description:
The comments for 

int
TclCreatePipeline(interp, argc, argv, pidArrayPtr,
inPipePtr,
outPipePtr, errFilePtr)

say that:

    CONST char **argv;/* Array of strings describing
commands in
 * pipeline plus I/O redirection with <,
 * <<,  >, etc.  Argv[argc] must be NULL. */

But the documentation for Tcl_OpenFileChannel makes no
mention of this!  Either the documentation should be
changed, or the command should dispense with the final
NULL requirement (it has an argc, so why does it need a
final NULL, too?).
User Comments: andreas_kupries added on 2005-10-06 05:10:11:
Logged In: YES 
user_id=75003

Accepted the patch and applied to both 8.4 and cvs head.

dkf added on 2005-02-01 17:14:16:
Logged In: YES 
user_id=79902

OK, in that case (BLT no longer using it) just fix it so
that argv[argc] is never referred to.

davidw added on 2005-01-28 06:20:57:
Logged In: YES 
user_id=240

I couldn't find TclCreatePipeline in the version of BLT that
ships with Debian: 2.4z

dgp added on 2005-01-26 21:50:43:
Logged In: YES 
user_id=80530

Note that pre-patch, the
TclCreatePipeline routine
ignores the value of its
argc argument.  Note also
the comment that the
routine is directly called
by BLT.  Would be wise to
check whether BLT relies on
the argc value getting ignored.

davidw added on 2005-01-26 06:15:42:

File Added - 117153: 1109294.diff

davidw added on 2005-01-26 06:15:41:
Logged In: YES 
user_id=240

I whipped up the following patch, which eliminates the
requirement for argv[argc] to exist and be NULL.  It works
for me, and seems to pass the relevant tests.  I've got a
nasty case of the flu, so my addled brain may have missed
something:-)

andreas_kupries added on 2005-01-26 02:02:04:
Logged In: YES 
user_id=75003

Note: David had a mem corruption issue and crash because of
this. The easy fix, updating the docs, might not be the
right fix.

This needs a deeper look.

Attachments: