Issue #3013 has been updated by Ricky Zhou.
Markus Roberts wrote:
> Re: select. That's interesting. I'll compare with the test I did and see if
> I can figure out why the difference.
One thing that might bite people is that once the write end is closed, select
will keep returning true, since a read can technically happen without blocking.
> As for setting SIGPIPE to IGNORE I suppose that's a reasonable option; it
> would handle the case of daemons that ignored the issue completely in a
> reasonable way, without affecting those that wanted to deal with it
> themselves. No idea at all (or at least none I like in the least) for how to
> test it though.
I tested using the following C program:
<pre>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
int rc;
pid_t pid;
pid = fork();
if (pid == 0) {
sleep(5);
printf("Writing to stderr...\n");
rc = fprintf(stderr, "Evil text!\n");
printf("Return code: %d\n", rc);
for (;;);
}
printf("Daemonized (badly), pid %d\n", pid);
return 0;
}
</pre>
and this test script:
<pre>
#!/usr/bin/ruby
require 'puppet'
require 'puppet/util'
puts Puppet::Util.execute(
['/path/to/daemontest'],
:failonfail => true,
:combine => true,
:squelch => false
)
</pre>
When I removed the trap SIGPIPE line, doevil would die after 5 seconds. With
the trap line, the test program survived the broken pipe (and kept running
indefinitely). Writing a nice, reproducible test for this would take a bit
more thinking though :-)
----------------------------------------
Bug #3013: util.rb:execute broken on Ruby <1.8.3
http://projects.reductivelabs.com/issues/3013
Author: Ricky Zhou
Status: Ready for Testing
Priority: Urgent
Assigned to: Markus Roberts
Category: exec
Target version: 0.25.3
Affected version: 0.25.2
Keywords:
Branch: http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/3013
Apparently the patch in ticket #2731 introduced one more issue by using
readpartial, which isn't available until ruby 1.8.3 (RHEL4 at least is
affected). I'm not sure how this is normally handled in ruby, but if the
readpartial function is not available, the code should fall back to sysread
(along with some code for handling EINTR).
Anybody with better ruby knowledge know how this should be done?
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://reductivelabs.com/redmine/my/account
-- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
