tags 685354 - moreinfo thanks Hi,
On Tue, Aug 21, 2012 at 09:39:20PM +0200, Julien Cristau wrote: > On Tue, Aug 21, 2012 at 20:51:24 +0200, Ivo De Decker wrote: > > > The version in squeeze added a line to /etc/profile (which is a policy > > violation). The version currently in wheezy removes that line. If this last > > part is removed from the postinst, the line remains in /etc/profile (where > > it > > never should have been). Removing the line in the postinst of the package in > > wheezy is a policy violation. Which is preferable: > > - leaving the line in /etc/profile and having a package in wheezy that has > > no > > policy violations > > - having a package in wheezy that violates policy, but that cleans up the > > changes caused by the policy violation in squeeze > > > The latter, IMO. The attached patch (against the version in wheezy) should do just that. Andreas Tille agreed to do an upload of this new version after pre-approval from the release team (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685631#56). Cheers, Ivo
diff -u sendfile-2.1b.20080616/debian/control sendfile-2.1b.20080616/debian/control --- sendfile-2.1b.20080616/debian/control +++ sendfile-2.1b.20080616/debian/control @@ -9,7 +9,7 @@ Section: net Priority: optional Architecture: any -Depends: ${shlibs:Depends}, openbsd-inetd | inet-superserver, perl | perl5 +Depends: ${shlibs:Depends}, openbsd-inetd | inet-superserver, perl | perl5, update-inetd, libdpkg-perl Suggests: pgp-i Description: Simple Asynchronous File Transfer Sendfile is an asynchronous file transfer service for the Internet, diff -u sendfile-2.1b.20080616/debian/postinst sendfile-2.1b.20080616/debian/postinst --- sendfile-2.1b.20080616/debian/postinst +++ sendfile-2.1b.20080616/debian/postinst @@ -2,20 +2,7 @@ # post install script for the Debian GNU/Linux sendfile package require DebianNet; - -# First modify the services file - -open(SERVICES, "/etc/services"); - @services=<SERVICES>; -close(SERVICES); - -if (! grep(/^saft.*/, @services)) { - push (@services, "saft 487/tcp # simple asynchronous file transfer\n"); - open(SERVICES, ">/etc/services.new"); - print SERVICES @services; - close (SERVICES); - system ("mv -f /etc/services.new /etc/services"); -} +use Dpkg::Version; # Now modify the inetd.conf file @@ -29,30 +16,38 @@ } undef(@inetd); -for $profile (('/etc/profile')) { - open(PROFILE, "$profile"); - @profile=<PROFILE>; - close(PROFILE); - - open(PROFILE, ">$profile"); - printf PROFILE "%s", join ('', grep (!/^.*check-sendfile/, @profile)); - close (PROFILE); +# cleanup edits from versions before 2.1b.20080616-5.2 +# this can be removed after wheezy +if (($ARGV[1] ne "") && + (version_compare($ARGV[1],"2.1b.20080616-5.2") < 0)) { + + # remove line added by old version of sendfile + my $profile = '/etc/profile'; + if (-e $profile) { + open(PROFILE, "$profile"); + @profile=<PROFILE>; + close(PROFILE); + + open(PROFILE, ">$profile"); + printf PROFILE "%s", join ('', grep (!/^.*check-sendfile/, @profile)); + close (PROFILE); + } + + # delete /etc/services with only 1 line created by previous versions of + # sendfile + my $services = "/etc/services"; + if (-e $services) { + open(SERVICES, $services); + my @srv = <SERVICES>; + close(SERVICES); + my $srv = join('',@srv); + my $oldsrv = "saft 487/tcp # simple asynchronous file transfer\n"; + if ($srv eq $oldsrv) { + unlink $services; + } + } } -for $profile (('/etc/csh.login')) { - open(PROFILE, "$profile"); - @profile=<PROFILE>; - close(PROFILE); - - if (grep(/^.*check-sendfile/, @profile)) { - open(PROFILE, ">$profile"); - printf PROFILE "%s", join ('', grep (!/^.*check-sendfile/, @profile)); - close(PROFILE); - } -} - -system "/etc/init.d/netbase reload"; - if ($ARGV[0] eq 'configure') { if (defined $ARGV[1] && $ARGV[1] =~ /2\.1b(-[67]|\.20080311-|\.20080616-1)/) { system "chmod 644 /etc/logrotate.d/sendfile"; diff -u sendfile-2.1b.20080616/debian/postrm sendfile-2.1b.20080616/debian/postrm --- sendfile-2.1b.20080616/debian/postrm +++ sendfile-2.1b.20080616/debian/postrm @@ -3,15 +3,6 @@ set -e -if [ "$1" = "remove" ] -then - for profile in /etc/profile /etc/csh.login - do - grep -v 'check-sendfile' $profile > $profile.new || true - mv -f $profile.new $profile - done -fi - if [ "$1" = "purge" ] then rm -rf /var/log/sendfile >/dev/null diff -u sendfile-2.1b.20080616/debian/changelog sendfile-2.1b.20080616/debian/changelog --- sendfile-2.1b.20080616/debian/changelog +++ sendfile-2.1b.20080616/debian/changelog @@ -1,3 +1,21 @@ +sendfile (2.1b.20080616-5.2) unstable; urgency=low + + * Non-maintainer upload. + * Don't edit /etc/services, /etc/profile and /etc/csh.login + * Cleanup edits to those files from previous versions + Closes: #685631 + + -- Ivo De Decker <ivo.dedec...@ugent.be> Wed, 22 Aug 2012 20:51:51 +0200 + +sendfile (2.1b.20080616-5.1) unstable; urgency=low + + * Non-maintainer upload. + * Remove all files on purge. Thanks for the patch to + Andreas Beckmann <deb...@abeckmann.de> + Closes: #668721 + + -- Andreas Tille <ti...@debian.org> Thu, 09 Aug 2012 15:03:55 +0200 + sendfile (2.1b.20080616-5) unstable; urgency=low * Add new config file /etc/profile.d/sendfile and remove old line from