Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2012-07-05
20:51 • Closed ticket [1189293fff]: "<<" redirection not binary safe... artifact: 5002b78ce6 user: dgp
2012-07-02
23:23 • Ticket [1189293fff]: 5 changes artifact: d2b795208e user: dgp
2011-06-07
00:05 • Ticket [1189293fff]: 4 changes artifact: 8d1c02a4ba user: dgp
2006-04-23
08:02 • Ticket [1189293fff]: 6 changes artifact: 3f41165f54 user: hobbs
2005-10-05
11:46 • Ticket [1189293fff]: 5 changes artifact: ed718fdcf0 user: hobbs
2005-08-02
14:58 • Ticket [1189293fff]: 4 changes artifact: 4631438c51 user: dkf
04:35 • Ticket [1189293fff]: 4 changes artifact: 83b185ebef user: avl42
2005-07-27
19:06 • Ticket [1189293fff]: 4 changes artifact: ea8228bdbf user: dkf
19:01 • Ticket [1189293fff]: 5 changes artifact: a1c1a4dbfb user: avl42
2005-05-31
09:22 • Ticket [1189293fff]: 5 changes artifact: 4161b42884 user: hobbs
2005-04-25
17:09 • Ticket [1189293fff]: 4 changes artifact: 0a0914cc55 user: dkf
07:46 • New ticket [1189293fff]. artifact: 691c7f1f25 user: avl42

"<<" 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.