use $mirror instead of $path in calling system(gunzip)

Bug #1730285 reported by cheng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt-mirror (Ubuntu)
New
Undecided
Unassigned

Bug Description

I am getting the following errors when running

sudo -u apt-mirror apt-mirror

Processing indexes: [
Psh: 1: cannot create archive.ubuntu.com/ubuntu//dists/trusty/main/binary-amd64/Packages: Permission denied
sh: 1: cannot create archive.ubuntu.com/ubuntu//dists/trusty/restricted/binary-amd64/Packages: Permission denied
Psh: 1: cannot create archive.ubuntu.com/ubuntu//dists/trusty-security/main/binary-amd64/Packages: Permission denied
sh: 1: cannot create archive.ubuntu.com/ubuntu//dists/trusty-security/restricted/binary-amd64/Packages: Permission denied
Psh: 1: cannot create archive.ubuntu.com/ubuntu//dists/trusty-updates/main/binary-amd64/Packages: Permission denied
sh: 1: cannot create archive.ubuntu.com/ubuntu//dists/trusty-updates/restricted/binary-amd64/Packages: Permission denied
Psh: 1: cannot create archive.ubuntu.com/ubuntu//dists/trusty-backports/main/binary-amd64/Packages: Permission denied
sh: 1: cannot create archive.ubuntu.com/ubuntu//dists/trusty-backports/restricted/binary-amd64/Packages: Permission denied
]

After looking at the source code, I believe the following code fragment inside "process_index_gz" should be the following:

    if ( $index =~ s/\.gz$// )
    {
        system("gunzip < $mirror$index.gz > $mirror$index");
        print "done!\n";
    }

instead of the original:

    if ( $index =~ s/\.gz$// )
    {
        system("gunzip < $path/$index.gz > $path/$index");
        print "done!\n";
    }

Since $path despite its name came from:

    $path = sanitise_uri($uri);

and $mirror came from:

    $mirror = get_variable("mirror_path") . "/" . $path;

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: apt-mirror 0.5.1-1ubuntu1 [modified: usr/bin/apt-mirror]
ProcVersionSignature: Ubuntu 4.4.0-98.121-generic 4.4.90
Uname: Linux 4.4.0-98-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.10
Architecture: amd64
Date: Sun Nov 5 22:11:54 2017
InstallationDate: Installed on 2017-11-04 (1 days ago)
InstallationMedia: Ubuntu-Server 16.04.3 LTS "Xenial Xerus" - Release amd64 (20170801)
PackageArchitecture: all
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: apt-mirror
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.cron.d.apt-mirror:
 #
 # Regular cron jobs for the apt-mirror package
 #
 0 4 * * * apt-mirror /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log
mtime.conffile..etc.apt.mirror.list: 2017-11-04T21:42:43.202920
mtime.conffile..etc.cron.d.apt-mirror: 2017-11-05T21:32:52.960585

Revision history for this message
cheng (pfcheng) wrote :
Revision history for this message
Ed Peguillan III (yankee14-ed) wrote :

I am also having this exact bug.

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.