apt-setup generator 50mirror.ubuntu writes to wrong file, fails to update

Bug #964930 reported by Sgifford
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt-setup (Ubuntu)
Fix Released
Medium
Brian Murray

Bug Description

In the process of setting up a preseed file to load Ubuntu Precise Pangolin from a local mirror, I ran into a problem where the installation would fail. The logs reported it could not find most of the packages on my mirror to install, but if I ran "in-target apt-get update" everything worked fine. Looking through the log files, it was clear that "apt-get update" was not being run for most of my mirrors.

After some troubleshooting, I believe I have found a bug in the installer file "/usr/lib/apt-setup/generators/50mirror.ubuntu".

That file seems to take a command-line parameter telling it where to write the generated configuration. "apt-setup" runs the generator and tells it what filename to write into, then "apt-setup-verify" checks the file, and updates the mirror information with "in-target apt-get ... update".

Towards the beginning, 50mirror.ubuntu sets $file to $1, and later it writes its configuration to $file. In between, however, it uses "file" as a temporary loop variable, like this:
for file in $ROOT/etc/apt/sources.list.base \
  $ROOT/etc/apt/sources.list.new; do
    ...
done

After that loop completes, $file is set to the last of those files, instead of the original file that was passed in. That makes the script write its configuration to the wrong place, so apt-setup-verify doesn't verify the file, and doesn't run "in-target apt-get ... update". As a result, the index files for my mirrors aren't loaded, and no packages can be found there.

After changing "for file" to "for file2", the installation completed successfully.

Sgifford (sgifford)
description: updated
description: updated
Changed in apt-setup (Ubuntu):
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Brian Murray (brian-murray)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt-setup - 1:0.55ubuntu2

---------------
apt-setup (1:0.55ubuntu2) precise; urgency=low

  * generators/50mirrors.ubuntu: do not reuse the file variable (LP: #964930)
 -- Brian Murray <email address hidden> Wed, 28 Mar 2012 17:04:23 +0100

Changed in apt-setup (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.