Re: [PATCH v4 4/4] convert: add "status=delayed" to filter process protocol
- From
Lars Schneider <larsxschneider@gmail.com>
- Date
- May 22, 2017, 20:37 UTC
- Message-ID
- <04ECEBE5-CAC8-4344-B07A-6B7A7C795C94@gmail.com>
- In-Reply-To
- <64b1fda4-9f79-1bd8-ad6d-43196b808d61@web.de>
Show 54 quoted lines
> On 22 May 2017, at 21:58, Torsten Bögershausen <tboegi@web.de> wrote:
>
> On 2017-05-22 15:50, Lars Schneider wrote:
>> +
>> +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 ?You are right and I'll fix it! Thanks for reminding me! Peff also noticed that some time ago: http://public-inbox.org/git/20170411200520.oivytvlzkdu7bfh5@sigill.intra.peff.net/
Thanks, Lars