[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#740564: apt-listbugs: auxiliary script send-hook-info.rb fails to work with Ruby 2.0



Control: tags -1 - help


On Sat, 8 Mar 2014 00:28:32 +0100 Christian Hofstaedtler wrote:

> Hi,

Hello Christian!

> 
> * Francesco Poli <invernomuto@paranoici.org> [140305 22:52]:
> > Hello Debian Ruby regulars,
> > could some of you please take a look at bug #740564, hoping it is not
> > too much bother?
[...]
> 
> Having looked at ruby/process.c and ruby/io.c in 1.9.3 and 2.0, I'd
> say the 2.0 behaviour is what always was intended, but it's very
> poorly documented.
> 
> I believe (haven't verified) that you need to explicitly list the
> FDs that you want to pass on to the child in the exec options (see
> Process#spawn redirection); it appears :close_others changed meaning
> a bit to "any non-standard FD that's not in the redirection list"
> (from "any non-standard FD if enabled") and setting it to false no
> longer does anything.

Thank you very much for your excellent explanation!
It indeed seems that the issue was caused by the lack of explicit file
descriptor redirection.

The following patch seems to fix the bug completely:


diff --git a/debian/changelog b/debian/changelog
index 0607829..6e5dee7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,11 @@ apt-listbugs (0.1.13) UNRELEASED; urgency=medium
     is considered a package name or bug number to be ignored.
   * downgraded the dependencies on ruby-xmlparser and ruby-httpclient to
     recommendations
+  * fixed "auxiliary script send-hook-info.rb fails to work with Ruby 2.0":
+    added an explicit file descriptor redirection to the exec call in order
+    to adapt to Ruby 2.0 stricter behavior; thanks a lot to Christian
+    Hofstaedtler for explaining what was wrong and for pointing me to the
+    appropriate documentation! (Closes: #740564)
 
  -- Francesco Poli (wintermute) <invernomuto@paranoici.org>  Sat, 01 Feb 2014 15:43:19 +0100
 
diff --git a/examples/send-hook-info.rb b/examples/send-hook-info.rb
index 6f3dc8b..57b66c3 100755
--- a/examples/send-hook-info.rb
+++ b/examples/send-hook-info.rb
@@ -6,7 +6,7 @@
 #                    "apt-listbugs apt" without the need to invoke APT)
 #
 # Copyright (C) 2013       Google Inc
-# Copyright (C) 2013       Francesco Poli <invernomuto@paranoici.org>
+# Copyright (C) 2013-2014  Francesco Poli <invernomuto@paranoici.org>
 #
 #  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
@@ -52,7 +52,7 @@ puts "APT_HOOK_INFO_FD set to #{ENV['APT_HOOK_INFO_FD']}"
 if Process.fork().nil?
   # the child
   write_fd.close
-  exec command
+  exec command, read_fd=>read_fd
   read_fd.close
   exit 0
 else


I will soon push this commit to the public git repository.

Thanks again for your prompt and kind assistance.
It's really appreciated!   :-)

Bye.

-- 
 http://www.inventati.org/frx/frx-gpg-key-transition-2010.txt
 New GnuPG key, see the transition document!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

Attachment: pgpSw4CmGvk7k.pgp
Description: PGP signature


Reply to: