<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><small><small><small><small>Updated the
patch, please review!<br>
</small></small></small></small></div>
<blockquote cite="mid:547661C7.7050507@Gmail.com" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<small><small><small><small> </small></small></small></small>
<div class="moz-cite-prefix"><small><small><small><small>Ping!<br>
<br>
Attached are an updated patch for ccc-analyzer and a
similar patch for scan-build, please review.<br>
<br>
</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<blockquote cite="mid:54622FB6.30802@Gmail.com" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<small><small><small><small> </small></small></small></small>
<div class="moz-cite-prefix"><small><small><small><small>On
06.11.2014 20:27, Jordan Rose wrote:<br>
</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<blockquote
cite="mid:B62F3D71-2012-4327-9115-4153F880A7AE@apple.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small>I think my point was
"why bother forking at all if we're using open to
run a subprocess?".</small></small></small></small></div>
<small><small><small><small> </small></small></small></small></blockquote>
<small><small><small><small> Ah, got it! Attached is an updated
patch.<br>
<br>
</small></small></small></small>
<blockquote
cite="mid:B62F3D71-2012-4327-9115-4153F880A7AE@apple.com"
type="cite"><small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small><br class="">
</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small>Also, this will fail
if the path contains spaces:</small></small></small></small></div>
<small><small><small><small> </small></small></small></small></blockquote>
<small><small><small><small> Corrected.<br>
<br>
</small></small></small></small>
<blockquote
cite="mid:B62F3D71-2012-4327-9115-4153F880A7AE@apple.com"
type="cite"><small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small><br class="">
</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small>+ my $ExecLine
= join(' ', $Clang, "-###", $mode, @$Args,
"2>&1", "|");</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small>+ open(PS,
$ExecLine);</small></small></small></small></div>
<small><small><small><small> </small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small><br class="">
</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small>Do newer Perls on
newer Windows support the list form of open?</small></small></small></small></div>
<small><small><small><small> </small></small></small></small></blockquote>
<small><small><small><small> No, at least ActivePerl,
StrawberryPerl and Dwimperl.<br>
<br>
Current perl docs state:<br>
'open to <code class="inline">|-</code> and <code
class="inline">-|</code> are unsupported. (Win32, RISC
OS)' (<a moz-do-not-send="true"
href="http://perldoc.perl.org/perlport.html#open">http://perldoc.perl.org/perlport.html#open</a>)<br>
and<br>
'The open(FOO, "|-") and open(BAR, "-|") constructs are
not yet implemented.' (<a moz-do-not-send="true"
href="http://perldoc.perl.org/perlfork.html">http://perldoc.perl.org/perlfork.html</a>)<br>
<br>
</small></small></small></small>
<blockquote
cite="mid:B62F3D71-2012-4327-9115-4153F880A7AE@apple.com"
type="cite"><small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small>Jordan</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small><br class="">
</small></small></small></small></div>
<small><small><small><small> <br class="">
</small></small></small></small>
<div><small><small><small><small> </small></small></small></small>
<blockquote type="cite" class=""><small><small><small><small>
</small></small></small></small>
<div class=""><small><small><small><small>On Nov 5, 2014,
at 11:54 , Anton Yartsev <<a
moz-do-not-send="true"
href="mailto:anton.yartsev@gmail.com" class="">anton.yartsev@gmail.com</a>>
wrote:</small></small></small></small></div>
<small><small><small><small> <br
class="Apple-interchange-newline">
</small></small></small></small>
<div class="">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type" class="">
<small><small><small><small> </small></small></small></small>
<div bgcolor="#FFFFFF" text="#000000" class=""><small><small><small><small>
</small></small></small></small>
<div class="moz-cite-prefix"><small><small><small><small>Ping!<br
class="">
</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<blockquote cite="mid:5452879E.5080509@Gmail.com"
type="cite" class="">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type" class="">
<small><small><small><small> </small></small></small></small>
<div class="moz-cite-prefix"><small><small><small><small>It
seems that fork is the only native perl
mean for creating subprocesses. There is a
number of packages that provide means for
spawning at <a moz-do-not-send="true"
href="http://cpan.org" class="">cpan.org</a>,
but they are not guarantee to be included
at the users perl distribution.</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<blockquote
cite="mid:658A0B49-9795-4D6E-AA12-363D7CD99B02@apple.com"
type="cite" class="">
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1252"
class="">
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small>Looking
at this code, it's weird that we're
doing this as a fork/exec (or not-exec)
at all. Why can't we just spawn a
sub-process?</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small><br
class="">
</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small>Jordan</small></small></small></small></div>
<small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small><br
class="">
</small></small></small></small></div>
<small><small><small><small> <br class="">
</small></small></small></small>
<div class=""><small><small><small><small> </small></small></small></small>
<div class=""><small><small><small><small>On Oct
21, 2014, at 6:47 , Anton Yartsev <<a
moz-do-not-send="true"
href="mailto:anton.yartsev@gmail.com"
class="">anton.yartsev@gmail.com</a>>
wrote:</small></small></small></small></div>
<small><small><small><small> <br
class="Apple-interchange-newline">
</small></small></small></small>
<blockquote type="cite" class="">
<meta http-equiv="content-type"
content="text/html; charset=windows-1252"
class="">
<small><small><small><small> </small></small></small></small>
<div bgcolor="#FFFFFF" text="#000000" class=""><small><small><small><small>
Hi all,<br class="">
<br class="">
Attached is the patch that prevents
ccc/c++-analyzer from hang if
launched with ActivePerl or
Strawberry Perl interpreters.<br
class="">
The patch replaces the code that
creates a pipe from child to parent
to the more portable explicit
writing to parent, this prevent
interpreters from hang.<br class="">
The conditions for hang are: child
should open a pipe to the parent and
parent should read from the child,
otherwise no hang.<br class="">
<br class="">
The problem is possibly caused by
the bug in emulation of 'fork' by
Perl interpreters on Windows. From <a
moz-do-not-send="true"
href="http://perldoc.perl.org/perlfork.html"
class="">perlfork</a>
documentation, BUGS section:<br
class="">
"In certain cases, the OS-level
handles created by the pipe(),
socket(), and accept() operators are
apparently not duplicated accurately
in pseudo-processes. This only
happens in some situations, but
where it does happen, it may result
in deadlocks between the read and
write ends of pipe handles, or
inability to send or receive data
across socket handles."<br class="">
<br class="">
An example from perlfork
documentation also hangs:<br
class="">
<br class="">
# simulate open(FOO, "-|")<br
class="">
sub pipe_from_fork ($) {<br class="">
my $parent = shift;<br class="">
pipe $parent, my $child or die;<br
class="">
my $pid = fork();<br class="">
die "fork() failed: $!" unless
defined $pid;<br class="">
if ($pid) {<br class="">
close $child;<br class="">
}<br class="">
else {<br class="">
close $parent;<br class="">
open(STDOUT, ">&=" .
fileno($child)) or die;<br class="">
}<br class="">
$pid;<br class="">
}<br class="">
<br class="">
if (pipe_from_fork('BAR')) {<br
class="">
# parent<br class="">
while (<BAR>) { print; }<br
class="">
close BAR;<br class="">
}<br class="">
else {<br class="">
# child<br class="">
print "pipe_from_fork\n";<br
class="">
exit(0);<br class="">
}<br class="">
<br class="">
The hang is not reproduced only with
the MSYS Perl.<br class="">
<br class="">
OK to commit?<br class="">
</small></small></small></small>
<pre class="moz-signature" cols="72"><small><small><small><small>--
Anton</small></small></small></small></pre>
<small><small><small><small> </small></small></small></small></div>
<small><small><small><small> <span class=""><ccc-analyzer_fork_open_hang.patch></span></small></small></small></small></blockquote>
<small><small><small><small> </small></small></small></small></div>
<small><small><small><small> <br class="">
</small></small></small></small></blockquote>
<small><small><small><small> <br class="">
<br class="">
</small></small></small></small>
<pre class="moz-signature" cols="72"><small><small><small><small>--
Anton</small></small></small></small></pre>
<small><small><small><small> </small></small></small></small></blockquote>
<small><small><small><small> <br class="">
<br class="">
</small></small></small></small>
<pre class="moz-signature" cols="72"><small><small><small><small>--
Anton</small></small></small></small></pre>
<small><small><small><small> </small></small></small></small></div>
<small><small><small><small> </small></small></small></small></div>
<small><small><small><small> </small></small></small></small></blockquote>
<small><small><small><small> </small></small></small></small></div>
<small><small><small><small> <br class="">
</small></small></small></small></blockquote>
<small><small><small><small> <br>
<br>
</small></small></small></small>
<pre class="moz-signature" cols="72"><small><small><small><small>--
Anton</small></small></small></small></pre>
<small><small><small><small> </small></small></small></small></blockquote>
<small><small><small><small> <br>
<br>
</small></small></small></small>
<pre class="moz-signature" cols="72"><small><small><small><small>--
Anton</small></small></small></small></pre>
<small><small><small><small> </small></small></small></small></blockquote>
<small><small><small><small><br>
<br>
</small></small></small></small>
<pre class="moz-signature" cols="72"><small><small><small><small>--
Anton</small></small></small></small></pre>
</body>
</html>