[BusyBox 0003914]: busybox unzip overwrite existing files

bugs at busybox.net bugs at busybox.net
Sun Jun 29 13:58:47 UTC 2008


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=3914 
====================================================================== 
Reported By:                prien
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   3914
Category:                   Other
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             06-29-2008 06:58 PDT
Last Modified:              06-29-2008 06:58 PDT
====================================================================== 
Summary:                    busybox unzip overwrite existing files
Description: 
when i execute busybox unzip -o myfile.zip, I want to decompress new myfile
to overwrite existing old myfile,but it produces unexpected results. If the
size of the new file(myfile) is smalller than the old one, it cannot
completely override the old file, and I got the wrong file.

I look for the source code in archival/unzip.c and find 369 line:

369    dst_fd = bb_xopen(dst_fn, O_WRONLY | O_CREAT);

I change it with:

369    dst_fd = bb_xopen(dst_fn, O_WRONLY | O_CREAT | O_TRUNC);

so busybox unzip -o myfile.zip can work right
====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-29-08 06:58  prien          New Issue                                    
06-29-08 06:58  prien          Status                   new => assigned     
06-29-08 06:58  prien          Assigned To               => BusyBox         
======================================================================




More information about the busybox-cvs mailing list