Hej Håkon
Jag tar detta på engelska ifall någon fler vill veta om vad jag
anser om det hela.
On Tue, Nov 28, 2006 at 02:44:19AM +0100, Håkon Stordahl wrote:
> Package: debarchiver
> Version: 0.6.5
> Severity: normal
> Tags: patch
>
> It seems that when a package which is not readable by debarchiver is
> uploaded in one of the incoming directories, the program will exit
> with an error, but without removing the lock file. Because of the
> remaining lock file, debarchiver fails to start the next time it is
> run.
This is probably true. I have not seen that problem before, but I have
not uploaded read-only files either.
> The cause of the problem seems to be the functions incomingError
> and rejectError, and I've attached a patch trying to fix it. The patch
> also addresses some other potential problems related to these functions,
> as explained in the comments in the code.
>
> However, I've not studied the code extensively and I'm not very familiar
> with Perl, so I might have misunderstood something about these functions.
Comments on the patch is below. It seems to fix one other problem as well.
Thanks a lot for that.
>
> With no changes to the default configuration, the following commands
> demonstrate the problem:
Ok, thanks.
> $pwd
> /var/lib/debarchiver
>
> $ls -l incoming/unstable/
> total 3648
> -rw------- 1 root debarchiver 3729124 2005-09-23 14:10
> kernel-image-2.6.12-20050923_10.00.Custom_i386.deb
>
> $sudo -u debarchiver debarchiver --dl 6 -so
> Message: Loading config file /etc/debarchiver.conf:
>
>
> Debug: Change to dir /var/lib/debarchiver/incoming
> Debug: Change to dir /var/lib/debarchiver/dists
> Debug: Read Release file in sarge/main/binary-i386
> Debug: Read Release file in sarge/main/source
> Debug: Read Release file in sarge/contrib/binary-i386
> Debug: Read Release file in sarge/contrib/source
> Debug: Read Release file in sarge/non-free/binary-i386
> Debug: Read Release file in sarge/non-free/source
> Debug: Read Release file in etch/main/binary-i386
> Debug: Read Release file in etch/main/source
> Debug: Read Release file in etch/contrib/binary-i386
> Debug: Read Release file in etch/contrib/source
> Debug: Read Release file in etch/non-free/binary-i386
> Debug: Read Release file in etch/non-free/source
> Debug: Read Release file in sid/main/binary-i386
> Debug: Read Release file in sid/main/source
> Debug: Read Release file in sid/contrib/binary-i386
> Debug: Read Release file in sid/contrib/source
> Debug: Read Release file in sid/non-free/binary-i386
> Debug: Read Release file in sid/non-free/source
> Debug: Change to dir /var/lib/debarchiver/incoming
> Message: Creating lockfile debarchiver.lock
> Debug: CMD: touch debarchiver.lock
> Debug: Creating lockfile debarchiver.lock
>
> Debug: Change to dir /var/lib/debarchiver/incoming/testing
> Debug: Change to dir /var/lib/debarchiver/incoming/unstable
> dpkg-deb: failed to read archive
> `kernel-image-2.6.12-20050923_10.00.Custom_i386.deb': Permission denied
> Debug: File : 0
> Debug: override .pkg
> Debug: Load override file for unstable, main
> Debug: Add to override, kernel-image-2.6.12-20050923
> Message: Delete
> /var/lib/debarchiver/dists/unstable/main/binary-i386//kernel-image-2.6.12-20050923_*_i386.deb
> Debug: CMD: rm -f
> /var/lib/debarchiver/dists/unstable/main/binary-i386//kernel-image-2.6.12-20050923_*_i386.deb
> Debug: Delete
> /var/lib/debarchiver/dists/unstable/main/binary-i386//kernel-image-2.6.12-20050923_*_i386.deb
>
> Message: Installing kernel-image-2.6.12-20050923_10.00.Custom_i386.deb to
> /var/lib/debarchiver/dists/unstable/main/binary-i386/.
> Debug: CMD: cp -af kernel-image-2.6.12-20050923_10.00.Custom_i386.deb
> /var/lib/debarchiver/dists/unstable/main/binary-i386/
> cp: cannot open `kernel-image-2.6.12-20050923_10.00.Custom_i386.deb' for
> reading: Permission denied
> Error: Installing kernel-image-2.6.12-20050923_10.00.Custom_i386.deb to
> /var/lib/debarchiver/dists/unstable/main/binary-i386/.
>
> Message: Removing lockfile debarchiver.lock.
> Debug: CMD: rm debarchiver.lock
> rm: cannot remove `debarchiver.lock': No such file or directory
> Error: Removing lockfile debarchiver.lock.
Ahh of course. It create the lockfile and then change directory...
> EXIT: 2
>
> $ls -l incoming/
> total 12
> -rw-r--r-- 1 debarchiver debarchiver 0 2006-11-27 22:08 debarchiver.lock
> drwxrwsr-x 2 root debarchiver 4096 2006-09-29 20:59 stable
> drwxrwsr-x 2 root debarchiver 4096 2006-09-29 20:59 testing
> drwxrwsr-x 2 root debarchiver 4096 2006-11-27 22:01 unstable
>
>
> -- System Information:
> Debian Release: 4.0
> APT prefers unstable
> APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable')
> Architecture: i386 (i686)
> Shell: /bin/sh linked to /bin/bash
> Kernel: Linux 2.6.16.22-20060701
> Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
>
> Versions of packages debarchiver depends on:
> ii adduser 3.99 Add and remove users and groups
> ii apt-utils 0.6.46.3 APT utility programs
> ii dpkg-dev 1.13.24 package building tools for Debian
> ii opalmod 0.1.14 A set of Perl modules for
> various
>
> debarchiver recommends no packages.
>
> -- no debconf information
>
--- a/src/debarchiver.pl 2006-07-20 08:08:17.000000000 +0000
+++ b/src/debarchiver.pl 2006-11-25 16:31:10.000000000 +0000
@@ -1188,6 +1188,12 @@
# 2005-05-06 Daniel Leidert <[EMAIL PROTECTED]>
# Add arg to handle signature verification in inputdir and distinput-dirs
# independetly.
+# 2006-11-24 HÃ¥kon Stordahl <[EMAIL PROTECTED]>
+# Substituted the call to rejectChangesFile with a call to pdebug,
+# to explicitly trigger the error handler incomingError, which
+# itself contains a call to rejectChangesFile. This is in order
+# to avoid a situation in which an error in rejectChangesFile
+# causes rejectChangesFile to be called again.
###############################################################################
sub findAndSortChangesFiles($;$) {
@@ -1207,8 +1213,11 @@
uploaderIsChangesFileOwner($cfile);
my ($verify, $reason) = verifyChangesFile($cfile, $verify);
if ($verify =~ /^reject$/) {
- # Reject .changes file.
- rejectChangesFile();
+ # Reject .changes file by calling pdebug with error
+ # level 2, which in turn calls the error handler
+ # for this function, incomingError, which calls
+ # rejectChangesFile.
+ pdebug(2, "Rejecting $cfile.");
}
elsif ($verify =~ /^incomplete$/) {
# Handle incomplete .changes file.
>>>>>>>> Ok this part looks good.
@@ -1696,6 +1705,29 @@
###############################################################################
######################### LOCK HANDLERS #######################################
###############################################################################
+# Changelog:
+# 2006-11-24 HÃ¥kon Stordahl <[EMAIL PROTECTED]>
+# Tried to fix the error handler functions incomingError and
+# rejectError, by removing the lock file in rejectError instead
+# of incomingError, so the lock file is not removed immediately
+# after an error, but rather if another error occurs while
+# handling the error. Also added a call to exit in rejectError
+# so the program will terminate in this case.
+#
+# Because of the chdir in handleSorting, the lock file name
+# needs to prefixed by $inputdir in the functions incomingError
+# and rejectError.
+#
+# Restored the error handler in incomingError so subsequent
+# errors are treated in the same way.
+#
+# Also moved the call to mailReject from the function rejectError
+# to the function incomingError, so a mail is sent each time
+# a .changes file is rejected. When called from rejectError,
+# which actually is the error handler of incomingError, which
+# itself is an error handler and calls rejectChangesFile, a mail
+# would only be sent if there was a problem with the rejection.
+###############################################################################
sub incomingLock() {
&createLockExit("$lockfile");
@@ -1708,15 +1740,16 @@
}
sub incomingError() {
- &setErrorHandler(undef);
- &removeLockfile("$lockfile");
&setErrorHandler(\&rejectError);
&rejectChangesFile();
+ &mailReject();
+ &setErrorHandler(\&incomingError);
}
sub rejectError() {
&setErrorHandler(undef);
- &mailReject();
+ &removeLockfile("$inputdir/$lockfile");
+ exit;
}
>>>>>>>>>> Ahh you found the problem that was reported in #375932.
thanks a lot for that.
Regards,
// Ola
--
--------------------- Ola Lundqvist ---------------------------
/ [EMAIL PROTECTED] Annebergsslingan 37 \
| [EMAIL PROTECTED] 654 65 KARLSTAD |
| +46 (0)54-10 14 30 +46 (0)70-332 1551 |
| http://www.opal.dhs.org UIN/icq: 4912500 |
\ gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9 /
---------------------------------------------------------------
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]