apt downloads new repositories with “If-Modified-Since: Tue, 09 Jun 1931 07:27:48 GMT”

Bug #744832 reported by Anders Kaseorg
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: apt

When apt downloads package information from a new repository, it sends an If-Modified-Since header from 1931:

GET /apt/dists/natty/debathena/binary-i386/Packages.bz2 HTTP/1.1
Host: debathena.mit.edu
Connection: keep-alive
Cache-Control: max-age=0
If-Modified-Since: Sun, 07 Jun 1931 07:40:36 GMT
User-Agent: Debian APT-HTTP/1.3 (0.8.13ubuntu2)

which is so far in the past as to trigger bugs in some date parsing implementations, such as Perl’s Date::Parse::str2time:

$ perl -MDate::Parse -e 'print str2time("Sun, 07 Jun 1931 07:40:36 GMT")'
1938584436
$ perl -MPOSIX -e 'print strftime("%a, %d %b %Y %T %z", gmtime(1938584436))'
Sat, 07 Jun 2031 07:40:36 -0400

If apt does not have a copy of the file yet, it should send no If-Modified-Since header at all, instead of one that’s far in the past.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: apt 0.8.13ubuntu2
ProcVersionSignature: Ubuntu 2.6.38-7.39-generic 2.6.38
Uname: Linux 2.6.38-7-generic x86_64
NonfreeKernelModules: openafs
Architecture: amd64
Date: Tue Mar 29 04:12:36 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64 (20101202)
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: apt
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Anders Kaseorg (andersk) wrote :
Revision history for this message
Torsten Spindler (tspindler) wrote :

I looked at method/http.cc and there is a check for last modified to be 0 or not:

      if (Itm->LastModified != 0)
      {
  sprintf(Buf,"If-Modified-Since: %s\r\n",TimeRFC1123(Itm->LastModified).c_str());
  Req += Buf;
      }

I guess that the LastModified field is not correctly initialized, as this changelog entry states it has been fixed:

apt (0.7.7) unstable; urgency=low
...
  * methods/https.cc:
    - only send LastModified if we actually have a file

Michael Vogt (mvo)
Changed in apt (Ubuntu):
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt - 0.8.13.1ubuntu1

---------------
apt (0.8.13.1ubuntu1) natty; urgency=low

  * merged fixes from the debian-sid (LP: #744832)

apt (0.8.13.1) unstable; urgency=low

  * apt-pkg/acquire-item.cc: Use stat buffer if stat was
    successful, not if it failed (Closes: #620546)
 -- Michael Vogt <email address hidden> Mon, 04 Apr 2011 14:40:51 +0200

Changed in apt (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.