debian/0000755000000000000000000000000012204740640007165 5ustar debian/patches/0000755000000000000000000000000012204740004010606 5ustar debian/patches/series0000644000000000000000000000002511671744237012043 0ustar 10mbox-locking.patch debian/patches/10mbox-locking.patch0000644000000000000000000000521712204740004014366 0ustar #! /bin/sh /usr/share/dpatch/dpatch-run ## 10mbox-locking.dpatch by Niko Tyni ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Policy-compliant mbox locking (hopefully). @DPATCH@ --- a/lib/Email/LocalDelivery/Mbox.pm +++ b/lib/Email/LocalDelivery/Mbox.pm @@ -10,7 +10,7 @@ use File::Path; use File::Basename; use Email::Simple 1.998; # needed for ->header_obj -use Fcntl ':flock'; +use Fcntl qw(:DEFAULT :seek); use Symbol qw(gensym); sub deliver { @@ -40,7 +40,7 @@ # This will make streaming a bit more annoying. -- rjbs, 2007-05-25 print $fh "\n" unless $email->as_string =~ /\n$/; - $class->_close_fh($fh) || next; + $class->_close_fh($fh, $file) || next; push @rv, $file; } return @rv; @@ -53,14 +53,14 @@ my $fh = gensym; open $fh, ">> $file" or return; - $class->getlock($fh) || return; + $class->getlock($fh, $file) || return; seek $fh, 0, 2; return $fh; } sub _close_fh { - my ($class, $fh) = @_; - $class->unlock($fh) || return; + my ($class, $fh, $file) = @_; + $class->unlock($fh, $file) || return; close $fh or return; return 1; } @@ -101,17 +101,69 @@ } sub getlock { + my ($class, $fh, $file) = @_; + for (1..10) { + return 0 unless $class->getlock_fcntl($fh); + return 1 if $class->getlock_dotlock($file); + sleep int(rand(10 * $_)); + } + $class->unlock_fcntl($fh); + return 0; + +} + +sub getlock_fcntl { my ($class, $fh) = @_; - for (1 .. 10) { - return 1 if flock($fh, LOCK_EX | LOCK_NB); + my $lock = pack('ss@256', F_WRLCK, SEEK_SET); + for (1..10) { + return 1 if fcntl($fh, F_SETLK, $lock); sleep $_; } + return 0 ; +} + +sub getlock_dotlock { + my ($class, $file) = @_; + my $lockfile = $file . ".lock"; + my $cmd = "/usr/bin/dotlockfile"; + system($cmd, $lockfile); + return 1 unless $?; + if ($? == -1) { + die("Couldn't exec $cmd: $!"); + } + if ($? & 127) { + warn("$cmd exited with signal " . ($? & 127)); + } return 0; } sub unlock { + my ($class,$fh, $file) = @_; + return 0 unless $class->unlock_dotlock($file); + return 0 unless $class->unlock_fcntl($fh); + return 1; +} + +sub unlock_fcntl { my ($class, $fh) = @_; - flock($fh, LOCK_UN); + my $lock = pack('ss@256', F_UNLCK, SEEK_SET); + return 1 if fcntl($fh, F_SETLK, $lock); + return 0; +} + +sub unlock_dotlock { + my ($class, $file) = @_; + my $lockfile = $file . ".lock"; + my $cmd = "/usr/bin/dotlockfile"; + system($cmd, "-u", $lockfile); + return 1 unless $?; + if ($? == -1) { + die("Couldn't exec $cmd: $!"); + } + if ($? & 127) { + warn("$cmd exited with signal " . ($? & 127)); + } + return 0; } 1; debian/watch0000644000000000000000000000020012101263756010212 0ustar version=3 https://metacpan.org/release/Email-LocalDelivery/ .+/Email-LocalDelivery-v?(\d.*)\.(?:tar\.(?:gz|bz2)|tgz|tbz|zip) debian/copyright0000644000000000000000000000234012204736447011131 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Source: https://metacpan.org/release/Email-LocalDelivery Upstream-Contact: Ricardo Signes Upstream-Name: Email-LocalDelivery Files: * Copyright: 2003, Simon Cozens License: Artistic or GPL-1+ Files: debian/* Copyright: 2005, 2006, Niko Tyni 2007, Krzysztof Krzyzaniak (eloy) 2007, gregor herrmann 2008, Damyan Ivanov 2013, Florian Schlichting License: Artistic or GPL-1+ License: Artistic This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl. . On Debian systems, the complete text of the Artistic License can be found in `/usr/share/common-licenses/Artistic'. License: GPL-1+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. . On Debian systems, the complete text of version 1 of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-1'. debian/control0000644000000000000000000000246712204740436010604 0ustar Source: libemail-localdelivery-perl Section: perl Priority: optional Maintainer: Debian Perl Group Uploaders: Niko Tyni , gregor herrmann , Krzysztof Krzyzaniak (eloy) , Damyan Ivanov , Florian Schlichting Build-Depends: debhelper (>= 8) Build-Depends-Indep: libcapture-tiny-perl, libemail-foldertype-perl, libemail-simple-perl, libfile-path-expand-perl, liblockfile1, perl (>= 5.13.4) | libtest-more-perl (>= 0.96), perl Standards-Version: 3.9.4 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-perl/packages/libemail-localdelivery-perl.git Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/libemail-localdelivery-perl.git Homepage: https://metacpan.org/module/Email::LocalDelivery Package: libemail-localdelivery-perl Architecture: all Depends: ${misc:Depends}, ${perl:Depends}, libemail-foldertype-perl, libemail-simple-perl, libfile-path-expand-perl, liblockfile1 Description: module to deliver a piece of email - simply Email::LocalDelivery delivers an email to a list of mailboxes. . Achtung! You might be better off looking at Email::Sender, and at Email::Sender::Transport::Maildir and Email::Sender::Transport::Mbox. They are heavily used and more carefully monitored. debian/compat0000644000000000000000000000000212204736674010377 0ustar 8 debian/changelog0000644000000000000000000000643612204740640011050 0ustar libemail-localdelivery-perl (1.200-1) unstable; urgency=low [ gregor herrmann ] * Change my email address. * debian/control: remove versions from (build) dependencies, all fulfilled in stable. [ Ansgar Burchardt ] * debian/control: Convert Vcs-* fields to Git. [ Salvatore Bonaccorso ] * Change Vcs-Git to canonical URI (git://anonscm.debian.org) * Change search.cpan.org based URIs to metacpan.org based URIs [ Florian Schlichting ] * Import Upstream version 1.200 * Refresh debian/copyright, converting to machine-readable format (1.0) * Drop obsolete README.source * Convert to source format 3.0 (quilt) * Convert to short-form debian/rules * Refresh debian/control using dh-make-perl * Drop libtest-pod-perl and libtest-pod-coverage-perl from build-dependencies, only needed for release testing * Refresh 10mbox-locking.patch (fuzz) * Update Homepage to metacpan, the old wiki has been nonexistant since 2009 * Update short and long description, adding warning note -- Florian Schlichting Tue, 20 Aug 2013 21:19:51 +0200 libemail-localdelivery-perl (0.217-2) unstable; urgency=low [ gregor herrmann ] * debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser field (source stanza); Homepage field (source stanza). Removed: Homepage pseudo-field (Description); XS-Vcs-Svn fields. * debian/rules: delete /usr/lib/perl5 only if it exists. [ Damyan Ivanov ] * debian/watch: use dist-based URL, better pattern * debian/rules: sync with dh-make-perl templates + clean stamps before distclean + set CFLAGS according to $DEB_BUILD_OPTIONS + use $@ when touching stamps + drop unused dh_link * convert patches to quilt; fix target dependencies * Standards-Version: 3.7.3 (no changes) * debhelper compatibility level 6 * add myself to Uploaders -- Damyan Ivanov Fri, 18 Jan 2008 13:18:20 +0200 libemail-localdelivery-perl (0.217-1) unstable; urgency=low [ gregor herrmann ] * New upstream release. * Adapt patch 10mbox-locking accordingly. [ Niko Tyni ] * Add packaging copyright notice in debian/copyright. -- gregor herrmann Sun, 15 Jul 2007 16:53:49 +0200 libemail-localdelivery-perl (0.215-1) unstable; urgency=low * New upstream release * debian/control: added me to uploaders -- Krzysztof Krzyzaniak (eloy) Sun, 22 Apr 2007 19:22:51 +0200 libemail-localdelivery-perl (0.214-1) unstable; urgency=low * New upstream release. * Change {build,} dependency on libemail-simple-perl to >= 1.998. * Adapt patch 10mbox to new upstream release. -- gregor herrmann Sun, 15 Apr 2007 15:46:02 +0200 libemail-localdelivery-perl (0.21-1) unstable; urgency=low * New upstream release. * Upgrade to Standards-Version 3.7.2. No changes needed. * Update URL to the upstream homepage in the long description. * Add libtest-pod-perl and libtest-pod-coverage-perl to Build-Depends-Indep. -- Niko Tyni Thu, 27 Jul 2006 22:00:39 +0300 libemail-localdelivery-perl (0.09-1) unstable; urgency=low * Initial Release. (Closes: #194548) * debian/patches: + 10mbox-locking.dpatch: Policy-compliant mbox locking (hopefully) -- Niko Tyni Tue, 20 Dec 2005 19:13:01 +0200 debian/source/0000755000000000000000000000000012204736267010477 5ustar debian/source/format0000644000000000000000000000001412204736267011705 0ustar 3.0 (quilt) debian/rules0000755000000000000000000000003612204736646010257 0ustar #!/usr/bin/make -f %: dh $@