Debian Bug report logs - #649174
update-inetd: make robust against being run when perl-base and perl-modules are out of sync

version graph

Package: update-inetd; Maintainer for update-inetd is Serafeim Zanikolas <sez@debian.org>; Source for update-inetd is src:update-inetd.

Reported by: Colin Watson <cjwatson@ubuntu.com>

Date: Fri, 18 Nov 2011 14:15:01 UTC

Severity: important

Tags: patch, pending

Found in versions update-inetd/4.40, perl/5.14.2-5

Fixed in version update-inetd/4.41

Done: Serafeim Zanikolas <sez@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, perl@packages.debian.org, Serafeim Zanikolas <sez@debian.org>:
Bug#649174; Package update-inetd. (Fri, 18 Nov 2011 14:15:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Colin Watson <cjwatson@ubuntu.com>:
New Bug report received and forwarded. Copy sent to perl@packages.debian.org, Serafeim Zanikolas <sez@debian.org>. (Fri, 18 Nov 2011 14:15:04 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Colin Watson <cjwatson@ubuntu.com>
To: submit@bugs.debian.org
Subject: update-inetd: make robust against being run when perl-base and perl-modules are out of sync
Date: Fri, 18 Nov 2011 14:14:05 +0000
Package: update-inetd
Version: 4.40
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch precise

There are a few situations where it's possible for update-inetd to be
called in the middle of an upgrade from one Perl major version to the
next: for example, https://bugs.launchpad.net/bugs/862129 turned out to
be a case where the samba postrm was called in such a situation.  If
that happens, then any modules provided by the perl-modules package will
be unavailable.  This includes File::Temp and File::Copy, both of which
are used by update-inetd.

It would be very helpful for update-inetd to work even when only
perl-base is available.  I appreciate that this requires slightly more
complex code, but it would make the whole system more robust during
upgrades.

Here's a suggested patch to implement this.  It implements fallback
versions of the 'tempfile' and 'move' functions if the module versions
are unavailable.  These will be a bit slower since they involve calling
external programs, but at least the complexity is all kept up in the
part of the code that imports modules rather than polluting the main
body of DebianNet.pm.

I've tested this by performing an upgrade from Ubuntu oneiric to precise
(which involves an upgrade from perl 5.12 to 5.14), pausing it
immediately after perl-base is configured, and then running update-inetd
--add and --remove.  Without this patch, it fails with "Can't locate
File/Temp.pm in @INC"; with this patch, it behaves as expected (and
strace output looks sensible as well).

Making this truly robust will probably also involve having perl-base
declare Breaks on versions of update-inetd prior to this patch being
applied.  I've CCed perl@packages.debian.org in case they'd like to
comment on this.

  * Fall back to external 'tempfile' and 'mv' commands in case perl-base and
    perl-modules are out of sync during an upgrade (LP: #862129).

=== modified file 'DebianNet.pm'
--- DebianNet.pm	2011-09-11 19:03:14 +0000
+++ DebianNet.pm	2011-11-18 14:06:39 +0000
@@ -15,8 +15,44 @@ package DebianNet;
 require 5.6.1;
 
 use Debconf::Client::ConfModule ':all';
-use File::Temp qw/ tempfile /;
-use File::Copy qw/ move /;
+
+BEGIN {
+    eval 'use File::Temp qw/ tempfile /';
+    if ($@) {
+        # If perl-base and perl-modules are out of sync, fall back to the
+        # external 'tempfile' command.  In this case we don't bother trying
+        # to mangle the template we're given into something that tempfile
+        # can understand.
+        sub tempfile {
+            open my $tempfile_fh, '-|', 'tempfile'
+                or die "Error running tempfile: $!";
+            chomp (my $tempfile_name = <$tempfile_fh>);
+            unless (length $tempfile_name) {
+                die "tempfile did not return a temporary file name";
+            }
+            unless (close $tempfile_fh) {
+                if ($!) {
+                    die "Error closing tempfile pipe: $!";
+                } else {
+                    die "tempfile returned exit status $?";
+                }
+            }
+            open my $fh, '+<', $tempfile_name
+                or die "Error opening temporary file $tempfile_name: $!";
+            return ($fh, $tempfile_name);
+        }
+    }
+
+    eval 'use File::Copy qw/ move /';
+    if ($@) {
+        # If perl-base and perl-modules are out of sync, fall back to the
+        # external 'mv' command.
+        sub move {
+            my ($from, $to) = @_;
+            return system('mv', $from, $to) == 0;
+        }
+    }
+}
 
 $inetdcf="/etc/inetd.conf";
 $sep = "#<off># ";

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]




Information forwarded to debian-bugs-dist@lists.debian.org, Serafeim Zanikolas <sez@debian.org>:
Bug#649174; Package update-inetd. (Fri, 18 Nov 2011 14:33:12 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dominic Hargreaves <dom@earth.li>:
Extra info received and forwarded to list. Copy sent to Serafeim Zanikolas <sez@debian.org>. (Fri, 18 Nov 2011 14:33:13 GMT) Full text and rfc822 format available.

Message #10 received at 649174@bugs.debian.org (full text, mbox):

From: Dominic Hargreaves <dom@earth.li>
To: Colin Watson <cjwatson@ubuntu.com>, 649174@bugs.debian.org
Cc: submit@bugs.debian.org
Subject: Add breaks on update-inetd when #649174 is fixed
Date: Fri, 18 Nov 2011 14:32:52 +0000
Package: perl-base
Version: 5.14.2-5
Severity: serious
Justification: maintainer

On Fri, Nov 18, 2011 at 02:14:05PM +0000, Colin Watson wrote:
> There are a few situations where it's possible for update-inetd to be
> called in the middle of an upgrade from one Perl major version to the
> next: for example, https://bugs.launchpad.net/bugs/862129 turned out to
> be a case where the samba postrm was called in such a situation.  If
> that happens, then any modules provided by the perl-modules package will
> be unavailable.  This includes File::Temp and File::Copy, both of which
> are used by update-inetd.
> 
> It would be very helpful for update-inetd to work even when only
> perl-base is available.  I appreciate that this requires slightly more
> complex code, but it would make the whole system more robust during
> upgrades.
> 
> Here's a suggested patch to implement this.  It implements fallback
> versions of the 'tempfile' and 'move' functions if the module versions
> are unavailable.  These will be a bit slower since they involve calling
> external programs, but at least the complexity is all kept up in the
> part of the code that imports modules rather than polluting the main
> body of DebianNet.pm.
> 
> I've tested this by performing an upgrade from Ubuntu oneiric to precise
> (which involves an upgrade from perl 5.12 to 5.14), pausing it
> immediately after perl-base is configured, and then running update-inetd
> --add and --remove.  Without this patch, it fails with "Can't locate
> File/Temp.pm in @INC"; with this patch, it behaves as expected (and
> strace output looks sensible as well).
> 
> Making this truly robust will probably also involve having perl-base
> declare Breaks on versions of update-inetd prior to this patch being
> applied.  I've CCed perl@packages.debian.org in case they'd like to
> comment on this.

Only that I think that I ought to hold off on adding more Breaks
for a little while longer, otherwise I risk an explosion in the number
of small updates to perl. I was in two minds about whether to upload
5.14.2-5 straight away or whether to wait..

Cheers,
Dominic.

-- 
Dominic Hargreaves | http://www.larted.org.uk/~dom/
PGP key 5178E2A5 from the.earth.li (keyserver,web,email)




Added indication that bug 649174 blocks 649177 Request was from Dominic Hargreaves <dom@earth.li> to control@bugs.debian.org. (Fri, 18 Nov 2011 14:36:08 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Serafeim Zanikolas <sez@debian.org>:
Bug#649174; Package update-inetd. (Fri, 18 Nov 2011 14:48:10 GMT) Full text and rfc822 format available.

Acknowledgement sent to Colin Watson <cjwatson@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Serafeim Zanikolas <sez@debian.org>. (Fri, 18 Nov 2011 14:48:10 GMT) Full text and rfc822 format available.

Message #17 received at 649174@bugs.debian.org (full text, mbox):

From: Colin Watson <cjwatson@ubuntu.com>
To: Dominic Hargreaves <dom@earth.li>
Cc: 649174@bugs.debian.org, 649177@bugs.debian.org
Subject: Re: Add breaks on update-inetd when #649174 is fixed
Date: Fri, 18 Nov 2011 14:47:17 +0000
On Fri, Nov 18, 2011 at 02:32:52PM +0000, Dominic Hargreaves wrote:
> Package: perl-base
> Version: 5.14.2-5
> Severity: serious
> Justification: maintainer

Thanks.

> On Fri, Nov 18, 2011 at 02:14:05PM +0000, Colin Watson wrote:
> > Making this truly robust will probably also involve having perl-base
> > declare Breaks on versions of update-inetd prior to this patch being
> > applied.  I've CCed perl@packages.debian.org in case they'd like to
> > comment on this.
> 
> Only that I think that I ought to hold off on adding more Breaks
> for a little while longer, otherwise I risk an explosion in the number
> of small updates to perl. I was in two minds about whether to upload
> 5.14.2-5 straight away or whether to wait..

Yep.  I suspect the impact of this is a bit less widespread than the
doc-base one anyway.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]




Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#649174; Package update-inetd. (Mon, 21 Nov 2011 13:15:23 GMT) Full text and rfc822 format available.

Acknowledgement sent to Serafeim Zanikolas <sez@debian.org>:
Extra info received and forwarded to list. (Mon, 21 Nov 2011 13:15:24 GMT) Full text and rfc822 format available.

Message #22 received at 649174@bugs.debian.org (full text, mbox):

From: Serafeim Zanikolas <sez@debian.org>
To: Colin Watson <cjwatson@ubuntu.com>, 649174@bugs.debian.org
Subject: Re: Bug#649174: update-inetd: make robust against being run when perl-base and perl-modules are out of sync
Date: Mon, 21 Nov 2011 14:01:38 +0100
Thanks for the patch Colin. I'll make sure to upload a new update-inetd
release within a few days.

cheers,
sez




Information forwarded to debian-bugs-dist@lists.debian.org, Serafeim Zanikolas <sez@debian.org>:
Bug#649174; Package update-inetd. (Mon, 21 Nov 2011 17:36:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dominic Hargreaves <dom@earth.li>:
Extra info received and forwarded to list. Copy sent to Serafeim Zanikolas <sez@debian.org>. (Mon, 21 Nov 2011 17:36:05 GMT) Full text and rfc822 format available.

Message #27 received at 649174@bugs.debian.org (full text, mbox):

From: Dominic Hargreaves <dom@earth.li>
To: Colin Watson <cjwatson@ubuntu.com>, 649177@bugs.debian.org
Cc: 649174@bugs.debian.org, control@bugs.debian.org, 637809@bugs.debian.org
Subject: Re: Bug#649177: Add breaks on update-inetd when #649174 is fixed
Date: Mon, 21 Nov 2011 17:34:23 +0000
severity 649177 important
severity 649174 important
unblock 637809 by 649177
thanks

On Fri, Nov 18, 2011 at 02:47:17PM +0000, Colin Watson wrote:
> On Fri, Nov 18, 2011 at 02:32:52PM +0000, Dominic Hargreaves wrote:
> > Package: perl-base
> > Version: 5.14.2-5
> > Severity: serious
> > Justification: maintainer
> 
> Thanks.
> 
> > On Fri, Nov 18, 2011 at 02:14:05PM +0000, Colin Watson wrote:
> > > Making this truly robust will probably also involve having perl-base
> > > declare Breaks on versions of update-inetd prior to this patch being
> > > applied.  I've CCed perl@packages.debian.org in case they'd like to
> > > comment on this.
> > 
> > Only that I think that I ought to hold off on adding more Breaks
> > for a little while longer, otherwise I risk an explosion in the number
> > of small updates to perl. I was in two minds about whether to upload
> > 5.14.2-5 straight away or whether to wait..
> 
> Yep.  I suspect the impact of this is a bit less widespread than the
> doc-base one anyway.

Okay. I've tweaked the severities of both bugs related to this
issue, and unblocked the perl transition, to reflect the
not-quite-blocking-perl-transition status.

Serafeim: thanks for your response on this. Depending on how things
progress this week, we might be able to include a Breaks: before
perl transitions to testing.

Cheers,
Dominic.

-- 
Dominic Hargreaves | http://www.larted.org.uk/~dom/
PGP key 5178E2A5 from the.earth.li (keyserver,web,email)




Severity set to 'important' from 'normal' Request was from Dominic Hargreaves <dom@earth.li> to control@bugs.debian.org. (Mon, 21 Nov 2011 17:36:12 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Serafeim Zanikolas <sez@debian.org>:
Bug#649174; Package update-inetd. (Mon, 21 Nov 2011 23:12:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dominic Hargreaves <dom@earth.li>:
Extra info received and forwarded to list. Copy sent to Serafeim Zanikolas <sez@debian.org>. (Mon, 21 Nov 2011 23:12:06 GMT) Full text and rfc822 format available.

Message #34 received at 649174@bugs.debian.org (full text, mbox):

From: Dominic Hargreaves <dom@earth.li>
To: Colin Watson <cjwatson@ubuntu.com>, 649177@bugs.debian.org
Cc: 649174@bugs.debian.org
Subject: Re: Bug#649177: Add breaks on update-inetd when #649174 is fixed
Date: Mon, 21 Nov 2011 23:08:09 +0000
On Mon, Nov 21, 2011 at 05:34:23PM +0000, Dominic Hargreaves wrote:
> severity 649177 important
> severity 649174 important
> unblock 637809 by 649177
> thanks
> 
> On Fri, Nov 18, 2011 at 02:47:17PM +0000, Colin Watson wrote:
> > On Fri, Nov 18, 2011 at 02:32:52PM +0000, Dominic Hargreaves wrote:
> > > Package: perl-base
> > > Version: 5.14.2-5
> > > Severity: serious
> > > Justification: maintainer
> > 
> > Thanks.
> > 
> > > On Fri, Nov 18, 2011 at 02:14:05PM +0000, Colin Watson wrote:
> > > > Making this truly robust will probably also involve having perl-base
> > > > declare Breaks on versions of update-inetd prior to this patch being
> > > > applied.  I've CCed perl@packages.debian.org in case they'd like to
> > > > comment on this.
> > > 
> > > Only that I think that I ought to hold off on adding more Breaks
> > > for a little while longer, otherwise I risk an explosion in the number
> > > of small updates to perl. I was in two minds about whether to upload
> > > 5.14.2-5 straight away or whether to wait..
> > 
> > Yep.  I suspect the impact of this is a bit less widespread than the
> > doc-base one anyway.
> 
> Okay. I've tweaked the severities of both bugs related to this
> issue, and unblocked the perl transition, to reflect the
> not-quite-blocking-perl-transition status.
> 
> Serafeim: thanks for your response on this. Depending on how things
> progress this week, we might be able to include a Breaks: before
> perl transitions to testing.

Transition has now completed; let me know when this does get fixed,
though.

Cheers,
Dominic.

-- 
Dominic Hargreaves | http://www.larted.org.uk/~dom/
PGP key 5178E2A5 from the.earth.li (keyserver,web,email)




Reply sent to Serafeim Zanikolas <sez@debian.org>:
You have taken responsibility. (Tue, 22 Nov 2011 22:51:06 GMT) Full text and rfc822 format available.

Notification sent to Colin Watson <cjwatson@ubuntu.com>:
Bug acknowledged by developer. (Tue, 22 Nov 2011 22:51:06 GMT) Full text and rfc822 format available.

Message #39 received at 649174-close@bugs.debian.org (full text, mbox):

From: Serafeim Zanikolas <sez@debian.org>
To: 649174-close@bugs.debian.org
Subject: Bug#649174: fixed in update-inetd 4.41
Date: Tue, 22 Nov 2011 22:47:44 +0000
Source: update-inetd
Source-Version: 4.41

We believe that the bug you reported is fixed in the latest version of
update-inetd, which is due to be installed in the Debian FTP archive:

update-inetd_4.41.dsc
  to main/u/update-inetd/update-inetd_4.41.dsc
update-inetd_4.41.tar.gz
  to main/u/update-inetd/update-inetd_4.41.tar.gz
update-inetd_4.41_all.deb
  to main/u/update-inetd/update-inetd_4.41_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 649174@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Serafeim Zanikolas <sez@debian.org> (supplier of updated update-inetd package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Tue, 22 Nov 2011 23:15:02 +0100
Source: update-inetd
Binary: update-inetd
Architecture: source all
Version: 4.41
Distribution: unstable
Urgency: low
Maintainer: Serafeim Zanikolas <sez@debian.org>
Changed-By: Serafeim Zanikolas <sez@debian.org>
Description: 
 update-inetd - inetd configuration file updater
Closes: 649174
Changes: 
 update-inetd (4.41) unstable; urgency=low
 .
   * Fall back to external 'tempfile' and 'mv' commands in case perl-base and
     perl-modules are out of sync during an upgrade (Closes: #649174;
     LP: #862129). Thanks to Colin Watson <cjwatson@ubuntu.com> for the bug
     report and patch.
Checksums-Sha1: 
 949213d9694a30c6b6becba163e0b72fc1899626 1635 update-inetd_4.41.dsc
 364033bcc17562cd21d299635a6e7447e2a2f2c1 27068 update-inetd_4.41.tar.gz
 91659c7ae2cba84bb3e98f3aabeb6f670d62774e 21858 update-inetd_4.41_all.deb
Checksums-Sha256: 
 dfd40d6c33c29e5a2160fe59eb6fa4eb139631cf271281eb29d0c1fd27f4e52b 1635 update-inetd_4.41.dsc
 430c56b968b32c9974a87177f48838d1a11f6d82fcc1381c2dfc7ee0cd1d8561 27068 update-inetd_4.41.tar.gz
 48bc2ef4fb5e7cecec5998dc7b998e86f7bf59763a3c8b4d04cb6ee7cb0059fe 21858 update-inetd_4.41_all.deb
Files: 
 84f43c334e0253186a019270259b4068 1635 admin optional update-inetd_4.41.dsc
 3816a1e57e272d67f0593752a4cbb8be 27068 admin optional update-inetd_4.41.tar.gz
 7265213adc8d55923c25329ccc8b673f 21858 admin optional update-inetd_4.41_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJOzCJuAAoJEE+fbVUO1hIqZJgQAJEcaIPofpdFNjV3VjyfTAuC
89JgJE8kLcBLXW4mZW9RvyqOvkkVMCXWV1KgYqgS7hbscWUp4VVRzzWvjvTz7jiS
Q2w5Ut2n5jKpR5oPt/DK2wUfcGlTm5+WVY/IYeUW3PSSJ8UZwECOSu/Q+zKrbwhA
+8pSfswi68JP0/1DOKgdEm2BNQlhMUtRjxjpKyZFF4WzyP4rYY/0l754hegBDcjV
kefGrqihvbOv3YPiFbVpd3rgsmxsUb3zSiVIstPAOz3VtgLz9v4rOkEy8HBYct5w
BrYZLuREqmscgqqrK2dWDBidnh0iCPpwxrzIwuOrDgcQ5wMOOzLQ8Pdr/o69LxbA
l8HeK/lY97DzQXy5Z7IcOHrJKBSX16YTHt+DjZalU1p1YsS41LxGiikY2/uUMHTC
c6jCWt06zpYQbDkV9N9rE2to4/yM4kI0vVk9drrO3w0hebyRs8MdIUfOyvxE7WGN
e6R59YVfe1GNE3x75FfDVczSYvbZCqLvXI5Zp4WC6oUDgbf5jcj6BODbPTrU9bf8
ETAW5lzKXykd3Y/kf+C7cnwqgje+kDAFYr/1nE8zSsUqCNqEnx8tiVMIkR+emfkC
EDB1sZ6SgZdzRnJvwv5RjRPBCSxxDiXfOYq1DjOf58IyC8zZ/ocTFGtyN6c5uPkT
KagaBpw8W5SuvPvygMaj
=k8GS
-----END PGP SIGNATURE-----





Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#649174; Package update-inetd. (Wed, 23 Nov 2011 08:51:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Serafeim Zanikolas <sez@debian.org>:
Extra info received and forwarded to list. (Wed, 23 Nov 2011 08:51:04 GMT) Full text and rfc822 format available.

Message #44 received at 649174@bugs.debian.org (full text, mbox):

From: Serafeim Zanikolas <sez@debian.org>
To: Dominic Hargreaves <dom@earth.li>, 649174@bugs.debian.org
Cc: Colin Watson <cjwatson@ubuntu.com>, 649177@bugs.debian.org
Subject: Re: Bug#649174: Bug#649177: Add breaks on update-inetd when #649174 is fixed
Date: Tue, 22 Nov 2011 23:39:09 +0100
Hi Dominic,

On Mon, Nov 21, 2011 at 11:08:09PM +0000, Dominic Hargreaves wrote [edited]:
> Transition has now completed; let me know when this does get fixed,
> though.

I've just uploaded update-inetd 4.41 with Colin's patch.

cheers,
sez




Added tag(s) pending. Request was from Serafeim Zanikolas <sez@debian.org> to control@bugs.debian.org. (Wed, 23 Nov 2011 08:54:21 GMT) Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 31 Dec 2011 07:38:41 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Apr 24 01:47:26 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.