"<<" redirection not binary safe
Closed / Fixed1189293fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 14 years ago
Descriptionplain2005-04-25 07:46:18
Redirection from data (using "<<") loses zero-characters: exec wc << [string repeat "\0" 42] returns "0 0 0", rather than "0 0 42" as it should.
dkfplain2005-04-25 17:09:02
Logged In: YES user_id=79902 Effect replicated in code that is definitely binary clean (od -c) so whatever the problem is (probably C strings in the tclpcreatepipeline code) it is not the fault of nul handling in wc.
hobbsplain2005-05-31 09:22:45
Logged In: YES user_id=72656 Indeed unix/tclUnixPipe.c:TclpCreateTempFile (and likely other plats as well) just get contents passed as a C string. We need to change this to a counted string of DString, if we can be sure noone uses this internal API.
avl42plain2005-07-27 19:01:27
Logged In: YES user_id=830354 Internal APIs shouldn't be used by anyone else. Even if they are, some wrapper-function can be created for the old functionality, and the implementation of exec could use some TclpCreateTempFileEx(), until some minor or major version-number change allows for a change. I don't see why this should be a blocker.
dkfplain2005-07-27 19:06:35
Logged In: YES user_id=79902 The question is whether BLT uses this. I don't think anyone else does.
avl42plain2005-08-02 04:35:35
Logged In: YES user_id=830354 So, is it in "our" (well your) reach to fix BLT as well?
dkfplain2005-08-02 14:58:24
Logged In: YES user_id=79902 I have never touched the source to BLT, and I don't intend to start now. Speaking personally, of course. :-)
hobbsplain2005-10-05 11:46:14
Logged In: YES user_id=72656 I found a slot to use for an old, unused TclpCreateTempFile sig change in 8.1 (never used essentially). However, the problem to fixing it is harder ... the processing of the command line is char* based, so we don't have a counted string at any point.
hobbsplain2006-04-23 08:02:20
Logged In: YES user_id=72656 I have found that in fact BLT no longer uses TclCreatePipeline, but it is Tcl_OpenCommandChannel that must be enhanced to take an obj-based version. For 'exec' in particular, this is something that could be done with internal routines.
dgpplain2011-06-07 00:05:08
dgpok, the comments suggest there's nothing fundamental blocking a fix. dgpJust needs someone to roll up sleeves and do it. dgpIs this broken in releases before 8.5 as well? dgpWas this broken even in Tcl 8.0 ? dgp% info patch 8.0.5 % exec wc << \0\0 0 0 0 dgpAppears so
dgpplain2012-07-02 23:23:19
Yikes! Fix for this was much simpler than believed. Please review/test the proposed fix on bug-1189293 branch to confirm I got the fix right on Windows before committing to release branches.
dgpplain2012-07-05 20:51:52
allow_comments - 1 committed.
Log in (anonymous is fine) to add a comment.