git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git clone silently aborts if stdout gets a broken pipe
@ 2013-09-18 16:52 Peter Kjellerstedt
  2013-09-18 18:45 ` Jeff King
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Kjellerstedt @ 2013-09-18 16:52 UTC (permalink / raw)
  To: git@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

One of our Perl scripts that does a git clone suddenly 
started to fail when I upgraded to git 1.8.4 from 1.8.3.1.

The failing Perl code used a construct like this:

	Git::command_oneline('clone', $url, $path);

There is no error raised, but the directory specified by 
$path is not created. If I look at the process using strace 
I can see the clone taking place, but then it seems to get 
a broken pipe since the code above only cares about the 
first line from stdout (and with the addition of "Checking 
connectivity..." git clone now outputs two lines to stdout).

If I change the code to:

	my @foo = Git::command('clone', $url, $path);

it works as expected.

I have attached a simple Perl script that shows the problem.
Run it as "clone_test.pl <git url>". With git 1.8.4 it will 
fail for the first two test cases, whereas with older git 
versions it succeeds for all four test cases.

I hope this is enough information for someone to look into 
this regression.

Best regards,
//Peter


[-- Attachment #2: clone_test.pl --]
[-- Type: application/octet-stream, Size: 796 bytes --]

#!/bin/perl

use Git;

my $url = $ARGV[0] || die("You need to specify a Git URL!\n");
my $path = 'clone_test';

system("rm -rf ${path}1");
Git::command_oneline('clone', "$url", "${path}1");
warn("Failed to clone to ${path}1!\n") unless (-d "${path}1");

system("rm -rf ${path}2");
my $foo = Git::command_oneline('clone', $url, "${path}2");
warn("Failed to clone to ${path}2!\n") unless (-d "${path}2");

system("rm -rf ${path}3");
my $foo = Git::command('clone', $url, "${path}3");
warn("Failed to clone to ${path}3!\n") unless (-d "${path}3");

system("rm -rf ${path}4");
my @foo = Git::command('clone', $url, "${path}4");
warn("Failed to clone to ${path}4!\n") unless (-d "${path}4");

system("rm -rf ${path}1");
system("rm -rf ${path}2");
system("rm -rf ${path}3");
system("rm -rf ${path}4");

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-09-19 15:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-18 16:52 git clone silently aborts if stdout gets a broken pipe Peter Kjellerstedt
2013-09-18 18:45 ` Jeff King
2013-09-18 19:04   ` Jeff King
2013-09-18 19:31     ` Junio C Hamano
2013-09-18 20:01       ` Jeff King
2013-09-18 20:05         ` [PATCH 1/2] clone: send diagnostic messages to stderr Jeff King
2013-09-18 20:06         ` [PATCH 2/2] clone: treat "checking connectivity" like other progress Jeff King
2013-09-18 20:35           ` [PATCH 3/2] clone: always set transport options Jeff King
2013-09-19  7:54   ` git clone silently aborts if stdout gets a broken pipe Peter Kjellerstedt
2013-09-19  8:35     ` Jeff King
2013-09-19 15:48       ` Peter Kjellerstedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).