[BusyBox 0004134]: tee - does not copy input twice to stdout

bugs at busybox.net bugs at busybox.net
Wed Jul 16 16:18:01 PDT 2008


The following issue has been CLOSED 
====================================================================== 
http://busybox.net/bugs/view.php?id=4134 
====================================================================== 
Reported By:                cristic
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   4134
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             07-14-2008 19:53 PDT
Last Modified:              07-16-2008 16:18 PDT
====================================================================== 
Summary:                    tee - does not copy input twice to stdout
Description: 
In busybox-1.11.1, "tee -" does not copy the input twice to standard
output, as expected:

$ echo abc >A
$ ./tee - <A
abc
$

Here is the behavior for tee in GNU coreutils 6.12:
$ tee - <A
abc
abc
$

Thank you,
Cristian

====================================================================== 

---------------------------------------------------------------------- 
 vda - 07-14-08 22:09  
---------------------------------------------------------------------- 
Please test attached 7.patch 

---------------------------------------------------------------------- 
 cristic - 07-15-08 17:00  
---------------------------------------------------------------------- 
The patch seems to be a correct fix for the bug reported.  There is another
problem in tee though.  I can open a new bug report if it's preferable. 
The  issue is an infinite loop when the file open on line 55 (svn-22831)
fails.

Here's a trivial test case:
$ echo abc| tee ""
tee: : No such file or directory
tee: : No such file or directory
tee: : No such file or directory
tee: : No such file or directory
tee: : No such file or directory
...

This generates an infinite loop.  The same happens if you replace "" with
a file name for which you lack permissions.  I think the patch is just to
increment argv if the file open fails:
		if (NOT_LONE_DASH(*argv)) {
			*fp = fopen_or_warn(*argv, mode);
			if (*fp == NULL) {
				retval = EXIT_FAILURE;
+ 			        argv++; 
				continue;
			}
		}

Best,
Cristian 

---------------------------------------------------------------------- 
 vda - 07-16-08 00:34  
---------------------------------------------------------------------- 
Thanks! fixed in svn. 

---------------------------------------------------------------------- 
 cristic - 07-16-08 14:25  
---------------------------------------------------------------------- 
Cool, I think this can be closed now. 

---------------------------------------------------------------------- 
 vda - 07-16-08 16:18  
---------------------------------------------------------------------- 
fixed in svn 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-14-08 19:53  cristic        New Issue                                    
07-14-08 19:53  cristic        Status                   new => assigned     
07-14-08 19:53  cristic        Assigned To               => BusyBox         
07-14-08 22:09  vda            File Added: 7.patch                          
07-14-08 22:09  vda            Note Added: 0009304                          
07-15-08 16:44  cristic        Issue Monitored: cristic                     
07-15-08 17:00  cristic        Note Added: 0009334                          
07-16-08 00:34  vda            Note Added: 0009374                          
07-16-08 14:25  cristic        Note Added: 0009444                          
07-16-08 16:18  vda            Status                   assigned => closed  
07-16-08 16:18  vda            Note Added: 0009464                          
======================================================================



More information about the busybox-cvs mailing list