Bug 28048 - univention-repository-update (/var/lib/univention-repository/var/clean.sh)
univention-repository-update (/var/lib/univention-repository/var/clean.sh)
Product: UCS
Classification: Unclassified
Component: Update - Repository administration
UCS 3.0
Other Linux
: P5 normal (vote)
: UCS 4.2
Assigned To: Philipp Hahn
Stefan Gohmann
: interim-3
: 28607 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2012-07-24 14:15 CEST by rolandb
Modified: 2017-04-04 18:29 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
hahn: Patch_Available+


Note You need to log in before you can comment on or make changes to this bug.
Description rolandb 2012-07-24 14:15:51 CEST
Hallo Zusammen

UCS 3.0-1 Errata 93 

Ich habe das lokale Repositoy auf 3.0-2 upgedatet:
univention-repository-update net --updateto 3.0-2

Hier die Ausgabe:
==> repository.log <==
Downloading 1740 index files using 10 threads...
Begin time: Tue Jul 24 13:46:12 2012
[10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]...
End time: Tue Jul 24 13:46:18 2012


1.4 MiB will be downloaded into archive.
Downloading 7 archive files using 7 threads...
Begin time: Tue Jul 24 13:46:35 2012
[7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]...
End time: Tue Jul 24 13:46:35 2012

13.1 GiB in 2266 files and 42 directories can be freed.
Run /var/lib/univention-repository/var/clean.sh for this purpose.

Running the Post Mirror script ...

/bin/sh: /var/lib/univention-repository/var/postmirror.sh: No such file or directory

Post Mirror script has completed. See above output for any possible errors.

***** Starting univention-repository-update at Tue Jul 24 13:45:49 2012

Setting repository/mirror/version/end
File: /etc/apt/mirror.list

Nun müssen wir uns diese Ausgabe ansehen und das Script
13.1 GiB in 2266 files and 42 directories can be freed.
Run /var/lib/univention-repository/var/clean.sh for this purpose.

Ich gebe hier nur ein paar Zeilen aus:

cd /var/lib/univention-repository/mirror || exit 1
echo 'Removing 2266 unnecessary files [14051115008 bytes]...'
rm -f 'maintained/3.0-0/dists/univention/main/binary-amd64/Packages'
echo -n '[0%]'
echo -n .
rm -f 'maintained/3.0-0/dists/univention/main/binary-amd64/Packages.gz'
rm -f 'maintained/3.0-0/dists/univention/main/binary-i386/Packages'
rm -f 'maintained/3.0-0/dists/univention/main/binary-i386/Packages.gz'
rm -f 'maintained/sec6/extern/Packages'
rm -f 'maintained/sec6/extern/AdobeReader-deu_9.4.2-1_amd64.deb'
rm -f 'maintained/sec6/extern/AdobeReader-enu_9.4.2-1_i386.deb'
rm -f 'maintained/sec6/extern/AdobeReader-enu_9.4.2-1_amd64.deb'
rm -f 'maintained/sec6/extern/AdobeReader-deu_9.4.2-1_i386.deb'
rm -f 'maintained/sec6/extern/Packages.gz'
rm -f 'maintained/sec1/extern/AdobeReader-deu_8.1.4_amd64.deb'
echo -n .

cd /var/lib/univention-repository/mirror
root@server:/var/lib/univention-repository/mirror# ls -1

Das Script wird nie eine Datei löschen weil die Pfadangabe flasch ist! Der Pfad bei rmdir würde stimmen, aber die Verzeichniss sind nicht leer, darum wird auch nier nichts gelöscht.
Dann würde mich wunder nehmen, woher weiss das Script welche Dateien gelöscht werden sollen? 

ucr search repository/mirror/version
repository/mirror/version/end: 3.0-2
repository/mirror/version/start: 2.2-0

Also möchte ich von UCS2.2 bis UCS3.0-2 in meinem lokalen Mirror haben. Doch dieses Script löscht viele Pakete? Wie wird diese Liste generiert?

Hier noch dazu ein paar Hinmweise:
find /var/lib/univention-repository/mirror -type f | wc -l
Das Script gibt folgendes aus:
13.1 GiB in 2266 files and 42 directories can be freed.

mfg, Rolandb
Comment 1 Stefan Gohmann univentionstaff 2012-09-19 17:09:12 CEST
*** Bug 28607 has been marked as a duplicate of this bug. ***
Comment 2 Philipp Hahn univentionstaff 2014-02-07 19:24:00 CET
Debian-Bug: <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=735197>
Upstream: <https://github.com/apt-mirror/apt-mirror/blob/master/apt-mirror#L812>

Our patch 03-disable-hostprefixes.patch adds striping on additional level to sanitise_uri().
The same function is later used in process_file() and removes the first level of the directory. Calling the function here is wrong, since the method is recursively crawling the file system and not handling arbitrary URIs.

--- /usr/bin/apt-mirror 2014-02-05 16:50:01.337385849 +0100
+++ /root/apt-mirror    2014-02-07 19:20:06.756119432 +0100
@@ -658,7 +663,7 @@
     $file =~ s[~][%7E]g if get_variable("_tilde");
     return 1 if $skipclean{remove_double_slashes($file)};
     return 1 if $file =~ /\/preup\.sh$|\/postup\.sh$/;
-    push @rm_files, sanitise_uri($file);
+    push @rm_files, $file;
     my (undef, undef, undef, undef, undef, undef, undef, $size, undef, undef, undef, undef, $blocks) = stat($file);
     $unnecessary_bytes += $blocks * 512;
     return 0;
Comment 3 Philipp Hahn univentionstaff 2017-01-17 14:56:06 CET
r17052 | Bug #43339,Bug #39582,Bug #28048: apt-mirror
 Don't strip prefix directory.

Package: apt-mirror
Version: 0.5.1-1A~
Branch: ucs_4.2-0

r75869 | Bug #43339,Bug #39582,Bug #28048: apt-mirror CL
Comment 4 Stefan Gohmann univentionstaff 2017-03-21 08:49:28 CET
Tests: OK

Changelog: OK
Comment 5 Stefan Gohmann univentionstaff 2017-04-04 18:29:56 CEST
UCS 4.2 has been released:

If this error occurs again, please use "Clone This Bug".