ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From news...@hotu.com
Subject Re: create cab in linux; patch request
Date Thu, 10 Oct 2002 23:20:50 GMT
  Stefan Bodewig wrote:

>this is what google has given me as the second hit:
>
><http://www.pld.kernel.pl/pool/l/libcabinet/>
>  
>

Thanks Stefan.  Although the link contained an rpm, I was able to 
extract the necessary files to get it to work.

However, I ran into trouble with ant.  The cab task in ant would hang 
when the file list was very large.  With a very simple code change, I 
was able to get it to work again, so how can I get this fix into the ant 
distribution?  Is it sufficient to post here, or should I post to the 
devel list?

Here is the problem and the fix.  Listcab (the executable that comes 
with libcabinet) runs in interactive mode, prompting the user for the 
files to archive, one at a time.  In order to accommodate this, the cab 
task builds a StringBuffer which lists all of the files to archive, one 
per line.  The task then exec's listcab, sends the entire buffer to its 
stdin, then pumps the stdout and stderr so that it doesn't hang. 
 Unfortunately stdin's buffer can become full if the list is very large, 
causing the write to stdin to hang.  The fix is to simply start the 
stdout/stderr reader threads before sending the file list to stdin.

[newsham@frodo optional]$ pwd
/home/newsham/jakarta-ant-1.5.1/src/main/org/apache/tools/ant/taskdefs/optional
[newsham@frodo optional]$ diff Cab.java.old Cab.java
270,272d269
<                 out.write(sb.toString().getBytes());
<                 out.flush();
<                 out.close();
284a282,285
 >
 >                 out.write(sb.toString().getBytes());
 >                 out.flush();
 >                 out.close();

Thanks,
Jim Newsham



--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message