Package: apt-cacher Version: 0.9.4 Severity: normal Tags: patch
I have apt-cacher set up to serve previously downloaded debs. Some of these are symlinks to directories I have archived to CD and made read only. apt-cacher opens all files read/write when it's checking that the file is complete and so fails on some debs. This is only really necessary when the file is not downloaded at all or only partially downloaded. The attached patch fixes this. -- System Information: Debian Release: 3.1 Architecture: i386 (i686) Kernel: Linux 2.6.11.9 Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1) Versions of packages apt-cacher depends on: ii curl 7.13.2-2 Get a file from an HTTP, HTTPS, FT ii perl 5.8.4-8 Larry Wall's Practical Extraction ii thttpd [httpd-cgi] 2.23beta1-3 tiny/turbo/throttling HTTP server -- no debconf information --- /usr/share/apt-cacher/apt-cacher.pl 2005-05-27 19:07:36.000000000 +0100 +++ /extra/cgi-bin/apt-cacher 2005-06-09 21:26:41.000000000 +0100 @@ -517,23 +517,15 @@ if (!-f $cached_file) { barf("Tried to create $cached_file, but failed"); } -# Ok, the file exists. Open it if we didn't already. -if (!$is_open) { - #print STDERR "--- Open $cached_file\n"; - debug_message("open $cached_file"); - - if (!sysopen(CF, $cached_file, O_RDWR)) { - writeerrorlog("unable to open incomplete $cached_file: $!"); - barf("Unable to open incomplete $cached_file: $!"); - } - $is_open = 1; -} - # Is it incomplete? if (!-f "$private_dir/$new_filename.complete") { $is_incomplete = 1; #print STDERR "--- File is not complete\n"; debug_message("file is not complete"); + if (!sysopen(CF, $cached_file, O_RDWR)) { + writeerrorlog("unable to open incomplete $cached_file: $!"); + barf("Unable to open incomplete $cached_file: $!"); + } if (flock(CF, LOCK_EX|LOCK_NB)) { # file locked, nobody's touching it ... # Have to truncate it, because we can't rely on "resume" @@ -562,7 +554,7 @@ my $header_printed=0; # reopen the file to not share the lock with the fetcher my $fromfile; -if (!sysopen($fromfile, $cached_file, O_RDWR)) { +if (!sysopen($fromfile, $cached_file, O_RDONLY)) { # don't barf. If there are network problems, they are signaled via errorfile # below, but not here # writeerrorlog("weird, unable to open incomplete $cached_file: $!"); -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]