Re: [PATCH 4/4] Replace fork_with_pipe in bundle with run_command

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 4/4] Replace fork_with_pipe in bundle with run_command

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:59

"Shawn O. Pearce" [off-list ref] writes:
quoted hunk
Now that the run_command family supports all of the redirection
modes needed by builtin-bundle, we can use those functions rather
than the underlying POSIX primitives.  This should help to make the
bundle command slightly more portable to other systems, like Windows.

Signed-off-by: Shawn O. Pearce <redacted>
...
@@ -263,9 +202,10 @@ static int create_bundle(struct bundle_header *header, const char *path,
 	int bundle_fd = -1;
 	const char **argv_boundary = xmalloc((argc + 4) * sizeof(const char *));
 	const char **argv_pack = xmalloc(5 * sizeof(const char *));
-	int pid, in, out, i, status, ref_count = 0;
+	int i, status, ref_count = 0;
 	char buffer[1024];
 	struct rev_info revs;
+	struct child_process rls;
 
 	bundle_fd = (!strcmp(path, "-") ? 1 :
 			open(path, O_CREAT | O_EXCL | O_WRONLY, 0666));
...
 			write_or_die(bundle_fd, buffer, i);
@@ -303,11 +245,8 @@ static int create_bundle(struct bundle_header *header, const char *path,
 			object->flags |= SHOWN;
 		}
 	}
-	while ((i = waitpid(pid, &status, 0)) < 0)
-		if (errno != EINTR)
-			return error("rev-list died");
-	if (!WIFEXITED(status) || WEXITSTATUS(status))
-		return error("rev-list died %d", WEXITSTATUS(status));
+	if (finish_command(&rls))
+		return error("rev-list died");
...
+	if (finish_command(&rls))
 		return error ("pack-objects died");
 
 	return status;
As the variable 'status' is not used anymore, I think this should return 0.

Re: [PATCH 4/4] Replace fork_with_pipe in bundle with run_command

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:42:59

Junio C Hamano [off-list ref] wrote:
"Shawn O. Pearce" [off-list ref] writes:
quoted
 	return status;
As the variable 'status' is not used anymore, I think this should return 0.
Indeed.  I replaced that patch with another (same subject) in my
latest series.  Because leaving that 'status' variable in caused
a failure in the test suite when trying to create a bundle.

  fixed:  http://article.gmane.org/gmane.comp.version-control.git/42087
  borked: http://article.gmane.org/gmane.comp.version-control.git/42056

You quoted the borked one.  Please drop it and apply the fixed one.

-- 
Shawn.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help