[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#333200: apt-get source: warn before truncating pre-existing files



Package: apt
Version: 0.5.28.6
Severity: wishlist

If you already have one of the files needed by apt-get source, it can skip
the download, or resume the download if the existing file is smaller than the
one to be downloaded. After seeing this feature work a few times, I thought I
could count on it, until...

Having downloaded a large .orig.tar.gz over a slow connection, I used apt-get
source to finish the job (download the dsc and diff and extract them). This
time, it didn't skip the download of the existing file. It truncated the
existing file to 0 and started over. Ouch! When you're expecting an append,
truncation is a very unpleasant surprise.

The reason for this rudeness was that the mtime on the file didn't match what
was on the server. I didn't do the original download with an mtime-preserving
method. So now I have to ask: how valuable is that mtime comparison? Is it
not enough that I have a file of the correct size and name? Is it really
likely that a file named "xfree86_4.3.0.dfsg.1.orig.tar.gz" will be anything
but the correct file, and that the mtime will allow you to make the
distinction? I doubt it. Especially when the file is complete and matches the
md5sum in the .dsc file!

If the mtime comparison must be retained, there should at least be a warning
before a truncate, like this:

  Modification time of existing file xfree86_4.3.0.dfsg.1.orig.tar.gz
  does not match the corresponding file on the server. What shall I do?
  [U]se existing file (resume download if incomplete)
  [M]ove existing file out of the way before downloading
  [E]rase existing file
  [U/m/e] _

Or even this would be an improvement:
  Modification time of existing file xfree86_4.3.0.dfsg.1.orig.tar.gz
  does not match the corresponding file on the server. Existing file
  contents will be lost. If you value this file, press ctrl-C NOW!
then sleep(5) before the truncate

There is a better way to deal with resumed downloads when there's a chance
the file contents won't match: subtract a few K from the resume point and
compare what you get to what's at the end of the existing file. This doesn't
require any special server support and wouldn't need anything like the kludge
of utime'ing the file on SIGINT.

-- Package-specific info:

-- System Information:
Debian Release: 3.1
Architecture: powerpc (ppc)
Kernel: Linux 2.6.11-powerpc
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages apt depends on:
ii  libc6                       2.3.2.ds1-22 GNU C Library: Shared libraries an
ii  libgcc1                     1:3.4.3-13   GCC support library
ii  libstdc++5                  1:3.3.5-13   The GNU Standard C++ Library v3

-- debconf-show failed



Reply to: