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

Re: [PATCH v1 3/3] convert: add filter.<driver>.useProtocol option

From
Jakub Narębski <jnareb@gmail.com>
Date
Jul 26, 2016, 10:58 UTC
Message-ID
<57974240.5030003@gmail.com>
In-Reply-To
<7D0AD199-F077-4EB2-83A5-58EB603973CA@gmail.com>
W dniu 2016-07-25 o 22:32, Lars Schneider pisze: 
> On 25 Jul 2016, at 01:22, Jakub Narębski <jnareb@gmail.com> wrote:
>> W dniu 2016-07-25 o 00:36, Ramsay Jones pisze:
>>> On 24/07/16 18:16, Lars Schneider wrote:
Show 25 quoted lines
>>>> It was a conscious decision to have the `filter` talk first.
>>>> My reasoning was:
>>>> 
>>>> (1) I want a reliable way to distinguish the existing filter 
>>>> protocol ("single-shot invocation") from the new one ("long 
>>>> running"). I don't think there would be a situation where the 
>>>> existing protocol would talk first. Therefore the users would 
>>>> not accidentally mix them with a possibly half working, 
>>>> undetermined, outcome.
>>> 
>>> If an 'single-shot' filter were incorrectly configured, instead 
>>> of a new one, then the interaction could last a little while - 
>>> since it would result in deadlock! ;-)
>>> 
>>> [If Git talks first instead, configuring a 'single-shot' filter 
>>> _may_ still result in a deadlock - depending on pipe size, etc.]
>> 
>> Would it be possible to do an equivalent of sending empty file to 
>> the filter? If it is misconfigured old-style script, it would exit 
>> after possibly empty output; if not, we would start new-style 
>> interaction.
> 
> I think we would need to close the pipe to communicate "end" to the 
> filter, no? I would prefer to define the protocol explicitly as this 
> is clearly easier.

Well, we could always close stdin of a script, check if it quits, then reopen. Or close stdin, and send commands via file descriptor 4. Or send SIGPIPE. But I don't know if it is a good idea.

> On 25 Jul 2016, at 00:36, Ramsay Jones <ramsay@ramsayjones.plus.com> wrote:
Show 10 quoted lines
>> If an 'single-shot' filter were incorrectly configured, instead of
>> a new one, then the interaction could last a little while - since
>> it would result in deadlock! ;-)
>> 
>> [If Git talks first instead, configuring a 'single-shot' filter
>> _may_ still result in a deadlock - depending on pipe size, etc.]
> 
> Do you think this is an issue that needs to be addressed in the first
> version? If yes, I would probably look into "select" to specify a
> timeout for the filter.

This might be a better idea. Additionally, it would make it possible to detect buggy v2 filter scripts.

>                         However, wouldn't the current "single-shot"
> clean/smudge filter block in the same way if they don't write
> anything?

Hmmm... so deadlocking (waiting for user to press ^C) might be an acceptable solution. It would be good to tell him or her why there was a deadlock (catch SIGINT), that Git was waiting for specific command in a specific filter driver, for a specific file.

On the other hand v2 protocol has an additional problem: users switching to v2, while using old one-shot filters (that worked correctly). So in my opinion you need to ensure two things:

(1) name things in such way that it is easy to see that you need to write filter script specifically for the v2 protocol,

(2) if possible, do not hang but warn the user if he or she wants to use v1 filter (per-file) with v2 protocol (per-command), or at least help diagnose the issue.

>> This should be tested, if we agree that detecting misconfigured 
>> filters is a good thing.
[clarified]
-- 
Jakub Narębski
Previous: Lars SchneiderNext: Lars Schneider
Message 15 of 77 in “Git filter protocol”
  1. 0/3 Git filter protocollarsxschneider@gmail.com, Jul 22, 2016
  2. 1/3 convert: quote filter names in error messageslarsxschneider@gmail.com, Jul 22, 2016
  3. 2/3 convert: modernize testslarsxschneider@gmail.com, Jul 22, 2016
  4. Remi Galan AlfonsoJul 26, 2016
  5. Junio C HamanoJul 26, 2016
  6. 3/3 convert: add filter.<driver>.useProtocol optionlarsxschneider@gmail.com, Jul 22, 2016
  7. Torsten BögershausenJul 22, 2016
  8. Lars SchneiderJul 24, 2016
  9. Ramsay JonesJul 22, 2016
  10. Ramsay JonesJul 22, 2016
  11. Lars SchneiderJul 24, 2016
  12. Ramsay JonesJul 24, 2016
  13. Jakub NarębskiJul 24, 2016
  14. Lars SchneiderJul 25, 2016
  15. Jakub NarębskiJul 26, 2016
  16. Lars SchneiderJul 25, 2016
  17. Jakub NarębskiJul 23, 2016
  18. Eric WongJul 23, 2016
  19. Jeff KingJul 26, 2016
  20. Lars SchneiderJul 24, 2016
  21. Jakub NarębskiJul 24, 2016
  22. Jakub NarębskiJul 24, 2016
  23. Lars SchneiderJul 25, 2016
  24. Jakub NarębskiJul 26, 2016
  25. Lars SchneiderJul 25, 2016
  26. Jakub NarębskiJul 26, 2016
  27. Eric WongJul 23, 2016
  28. Lars SchneiderJul 24, 2016
  29. Eric WongJul 25, 2016
  30. Duy NguyenJul 25, 2016
  31. Junio C HamanoJul 22, 2016
  32. Lars SchneiderJul 24, 2016
  33. Jeff KingJul 26, 2016
  34. 0/5 Git filter protocollarsxschneider@gmail.com, Jul 27, 2016
  35. 2/5 convert: modernize testslarsxschneider@gmail.com, Jul 27, 2016
  36. 3/5 pkt-line: extract and use `set_packet_header` functionlarsxschneider@gmail.com, Jul 27, 2016
  37. Junio C HamanoJul 27, 2016
  38. Lars SchneiderJul 27, 2016
  39. Junio C HamanoJul 27, 2016
  40. 4/5 convert: generate large test files only oncelarsxschneider@gmail.com, Jul 27, 2016
  41. Torsten BögershausenJul 27, 2016
  42. Jeff KingJul 27, 2016
  43. Lars SchneiderJul 27, 2016
  44. 5/5 convert: add filter.<driver>.process optionlarsxschneider@gmail.com, Jul 27, 2016
  45. Jeff KingJul 27, 2016
  46. Lars SchneiderJul 27, 2016
  47. Jeff KingJul 27, 2016
  48. Lars SchneiderJul 28, 2016
  49. Jeff KingJul 28, 2016
  50. Eric WongJul 27, 2016
  51. Lars SchneiderJul 29, 2016
  52. Jakub NarębskiJul 29, 2016
  53. Lars SchneiderJul 29, 2016
  54. Eric WongAug 5, 2016
  55. Lars SchneiderAug 5, 2016
  56. Eric WongAug 5, 2016
  57. Jakub NarębskiJul 27, 2016
  58. Lars SchneiderJul 29, 2016
  59. Junio C HamanoJul 29, 2016
  60. Jakub NarębskiJul 29, 2016
  61. Lars SchneiderJul 29, 2016
  62. Jakub NarębskiJul 30, 2016
  63. Torsten BögershausenJul 28, 2016
  64. 1/5 convert: quote filter names in error messageslarsxschneider@gmail.com, Jul 27, 2016
  65. Jakub NarębskiJul 27, 2016
  66. Lars SchneiderJul 28, 2016
  67. Jakub NarębskiJul 27, 2016
  68. Lars SchneiderJul 28, 2016
  69. Jakub NarębskiJul 28, 2016
  70. Jeff KingJul 28, 2016
  71. Jakub NarębskiJul 29, 2016
  72. Lars SchneiderJul 29, 2016
  73. Jeff KingJul 29, 2016
  74. Lars SchneiderJul 29, 2016
  75. Jeff KingJul 29, 2016
  76. Lars SchneiderJul 29, 2016
  77. Jeff KingJul 29, 2016

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.