git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 4/4] convert: add "status=delayed" to filter process protocol

From
Torsten Bögershausen <tboegi@web.de>
Date
May 22, 2017, 19:58 UTC
Message-ID
<64b1fda4-9f79-1bd8-ad6d-43196b808d61@web.de>
In-Reply-To
<20170522135001.54506-5-larsxschneider@gmail.com>
On 2017-05-22 15:50, Lars Schneider wrote:
Show 46 quoted lines
> +
> +int async_query_available_blobs(const char *cmd, struct string_list *delayed_paths)
> +{
> +	int err;
> +	char *line;
> +	struct cmd2process *entry;
> +	struct child_process *process;
> +	struct strbuf filter_status = STRBUF_INIT;
> +
> +	entry = find_multi_file_filter_entry(&cmd_process_map, cmd);
> +	if (!entry) {
> +		error("external filter '%s' is not available anymore although "
> +		      "not all paths have been filtered", cmd);
> +		return 0;
> +	}
> +	process = &entry->process;
> +	sigchain_push(SIGPIPE, SIG_IGN);
> +
> +	err = packet_write_fmt_gently(
> +		process->in, "command=list_available_blobs\n");
> +	if (err)
> +		goto done;
> +
> +	err = packet_flush_gently(process->in);
> +	if (err)
> +		goto done;
> +
> +	for (;;) {
> +		const char* pre = "pathname=";
> +		const int pre_len = strlen(pre);
> +		line = packet_read_line(process->out, NULL);
> +		if (!line)
> +			break;
> +		err = strlen(line) <= pre_len || strncmp(line, pre, pre_len);
> +		if (err)
> +			goto done;
> +		string_list_insert(delayed_paths, xstrdup(line+pre_len));
> +	}
> +
> +	read_multi_file_filter_status(process->out, &filter_status);
> +	err = strcmp(filter_status.buf, "success");
> +
> +done:
> +	sigchain_pop(SIGPIPE);
> +
> +	if (err || errno == EPIPE) {

This looks strange, at first glance. Do we set errno to 0 before ? Or is there a trick that EPIPE can only be reached, if it is "our" error ?

Show 15 quoted lines
> +		if (!strcmp(filter_status.buf, "error")) {
> +			/* The filter signaled a problem with the file. */
> +		} else {
> +			/*
> +			 * Something went wrong with the protocol filter.
> +			 * Force shutdown and restart if another blob requires
> +			 * filtering.
> +			 */
> +			error("external filter '%s' failed", cmd);
> +			kill_multi_file_filter(&cmd_process_map, entry);
> +		}
> +	}
> +	return !err;
> +}
> +
Previous: Lars SchneiderNext: Lars Schneider
Message 9 of 15 in “convert: add "status=delayed" to filter process protocol”
  1. 0/4 convert: add "status=delayed" to filter process protocolLars Schneider, May 22, 2017
  2. 2/4 t0021: make debug log file name configurableLars Schneider, May 22, 2017
  3. 1/4 t0021: keep filter log files on comparisonLars Schneider, May 22, 2017
  4. 3/4 t0021: write "OUT" only on successLars Schneider, May 22, 2017
  5. 4/4 convert: add "status=delayed" to filter process protocolLars Schneider, May 22, 2017
  6. Taylor BlauMay 22, 2017
  7. Torsten BögershausenMay 22, 2017
  8. Lars SchneiderMay 22, 2017
  9. Torsten BögershausenMay 22, 2017
  10. Lars SchneiderMay 22, 2017
  11. Junio C HamanoMay 23, 2017
  12. Lars SchneiderMay 23, 2017
  13. Lars SchneiderMay 29, 2017
  14. Junio C HamanoMay 30, 2017
  15. Junio C HamanoMay 30, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.