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

Re: [PATCH 3/3] sequencer: reencode to utf-8 before arrange rebase's todo list

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 31, 2019, 10:38 UTC
Message-ID
<nycvar.QRO.7.76.6.1910311134011.46@tvgsbejvaqbjf.bet>
In-Reply-To
<20191031092618.29073-4-congdanhqx@gmail.com>
Hi,
On Thu, 31 Oct 2019, Doan Tran Cong Danh wrote:
Show 25 quoted lines
> On musl libc, ISO-2022-JP encoder is too eager to switch back to
> 1 byte encoding, musl's iconv always switch back after every combining
> character. Comparing glibc and musl's output for this command
> $ sed q t/t3900/ISO-2022-JP.txt| iconv -f ISO-2022-JP -t utf-8 |
> 	iconv -f utf-8 -t ISO-2022-JP | xxd
>
> glibc:
> 00000000: 1b24 4224 4f24 6c24 5224 5b24 551b 2842  .$B$O$l$R$[$U.(B
> 00000010: 0a                                       .
>
> musl:
> 00000000: 1b24 4224 4f1b 2842 1b24 4224 6c1b 2842  .$B$O.(B.$B$l.(B
> 00000010: 1b24 4224 521b 2842 1b24 4224 5b1b 2842  .$B$R.(B.$B$[.(B
> 00000020: 1b24 4224 551b 2842 0a                   .$B$U.(B.
>
> Although musl iconv's output isn't optimal, it's still correct.
>
> From commit 7d509878b8, ("pretty.c: format string with truncate respects
> logOutputEncoding", 2014-05-21), we're encoding the message to utf-8
> first, then format it and convert the message to the actual output
> encoding on git commit --squash.
>
> Thus, t3900 is failing on Linux with musl libc.
>
> Reencode to utf-8 before arranging rebase's todo list.

Since the re-encoded commit messages are only used for figuring out the relationships between the `fixup!`/`squash!` commits and their targets, but are not used in any of the lines that are written out, this change looks good to me.

In fact, all three patches look good to me.

Thanks for unbreaking Git with musl! Johannes

Show 40 quoted lines
>
> Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
> ---
>
> Notes:
>     The todo list shown to user has already been reencoded by sequencer_make_script,
>     without this patch it looks like this:
>
>     $ head -3 .git/rebase-merge/git-rebase-todo | xxd
>     00000000: 7069 636b 2065 6633 3961 3033 201b 2442  pick ef39a03 .$B
>     00000010: 244f 1b28 421b 2442 246c 1b28 421b 2442  $O.(B.$B$l.(B.$B
>     00000020: 2452 1b28 421b 2442 245b 1b28 421b 2442  $R.(B.$B$[.(B.$B
>     00000030: 2455 1b28 420a 7069 636b 2062 3832 3931  $U.(B.pick b8291
>     00000040: 3336 2073 7175 6173 6821 201b 2442 244f  36 squash! .$B$O
>     00000050: 1b28 421b 2442 246c 1b28 421b 2442 2452  .(B.$B$l.(B.$B$R
>     00000060: 1b28 421b 2442 245b 1b28 421b 2442 2455  .(B.$B$[.(B.$B$U
>     00000070: 1b28 420a 7069 636b 2062 3532 3132 6437  .(B.pick b5212d7
>     00000080: 2069 6e74 6572 6d65 6469 6174 6520 636f   intermediate co
>     00000090: 6d6d 6974 0a                             mmit.
>
>  sequencer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index 9d5964fd81..69430fe23f 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -5169,7 +5169,7 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
>  		*commit_todo_item_at(&commit_todo, item->commit) = item;
>
>  		parse_commit(item->commit);
> -		commit_buffer = get_commit_buffer(item->commit, NULL);
> +		commit_buffer = logmsg_reencode(item->commit, NULL, "UTF-8");
>  		find_commit_subject(commit_buffer, &subject);
>  		format_subject(&buf, subject, " ");
>  		subject = subjects[i] = strbuf_detach(&buf, &subject_len);
> --
> 2.24.0.rc1.3.g89530838a3.dirty
>
>
Previous: Doan Tran Cong DanhNext: Jeff King
Message 11 of 89 in “Linux with musl libc improvement”
  1. 0/3 Linux with musl libc improvementDoan Tran Cong Danh, Oct 31, 2019
  2. 1/3 t0028: eliminate non-standard usage of printfDoan Tran Cong Danh, Oct 31, 2019
  3. Jeff KingOct 31, 2019
  4. Danh DoanNov 1, 2019
  5. brian m. carlsonOct 31, 2019
  6. 2/3 configure.ac: define ICONV_OMITS_BOM if necessaryDoan Tran Cong Danh, Oct 31, 2019
  7. Jeff KingOct 31, 2019
  8. brian m. carlsonOct 31, 2019
  9. Danh DoanNov 1, 2019
  10. 3/3 sequencer: reencode to utf-8 before arrange rebase's todo listDoan Tran Cong Danh, Oct 31, 2019
  11. Johannes SchindelinOct 31, 2019
  12. Jeff KingOct 31, 2019
  13. Danh DoanNov 1, 2019
  14. 0/3 Linux with musl libc improvementDoan Tran Cong Danh, Nov 1, 2019
  15. 1/3 t0028: eliminate non-standard usage of printfDoan Tran Cong Danh, Nov 1, 2019
  16. Jeff KingNov 1, 2019
  17. 2/3 configure.ac: define ICONV_OMITS_BOM if necessaryDoan Tran Cong Danh, Nov 1, 2019
  18. Jeff KingNov 1, 2019
  19. Danh DoanNov 2, 2019
  20. 3/3 sequencer: reencode to utf-8 before arrange rebase's todo listDoan Tran Cong Danh, Nov 1, 2019
  21. Jeff KingNov 1, 2019
  22. Danh DoanNov 2, 2019
  23. Danh DoanNov 2, 2019
  24. Jeff KingNov 5, 2019
  25. Junio C HamanoNov 6, 2019
  26. Jeff KingNov 6, 2019
  27. Danh DoanNov 6, 2019
  28. Jeff KingNov 7, 2019
  29. 0/8 Correct internal working and output encodingDoan Tran Cong Danh, Nov 6, 2019
  30. 1/8 t0028: eliminate non-standard usage of printfDoan Tran Cong Danh, Nov 6, 2019
  31. 2/8 configure.ac: define ICONV_OMITS_BOM if necessaryDoan Tran Cong Danh, Nov 6, 2019
  32. 3/8 t3900: demonstrate git-rebase problem with multi encodingDoan Tran Cong Danh, Nov 6, 2019
  33. 4/8 sequencer: reencode to utf-8 before arrange rebase's todo listDoan Tran Cong Danh, Nov 6, 2019
  34. 5/8 sequencer: reencode revert/cherry-pick's todo listDoan Tran Cong Danh, Nov 6, 2019
  35. 6/8 sequencer: reencode squashing commit's messageDoan Tran Cong Danh, Nov 6, 2019
  36. 7/8 sequencer: reencode old merge-commit messageDoan Tran Cong Danh, Nov 6, 2019
  37. Eric SunshineNov 6, 2019
  38. 8/8 sequencer: reencode commit message for am/rebase --show-current-patchDoan Tran Cong Danh, Nov 6, 2019
  39. 0/8 Correct internal working and output encodingDoan Tran Cong Danh, Nov 7, 2019
  40. 1/8 t0028: eliminate non-standard usage of printfDoan Tran Cong Danh, Nov 7, 2019
  41. 2/8 configure.ac: define ICONV_OMITS_BOM if necessaryDoan Tran Cong Danh, Nov 7, 2019
  42. Junio C HamanoNov 7, 2019
  43. 3/8 t3900: demonstrate git-rebase problem with multi encodingDoan Tran Cong Danh, Nov 7, 2019
  44. Jeff KingNov 7, 2019
  45. Danh DoanNov 7, 2019
  46. Jeff KingNov 7, 2019
  47. Danh DoanNov 7, 2019
  48. Jeff KingNov 11, 2019
  49. 4/8 sequencer: reencode to utf-8 before arrange rebase's todo listDoan Tran Cong Danh, Nov 7, 2019
  50. Jeff KingNov 7, 2019
  51. 6/8 sequencer: reencode squashing commit's messageDoan Tran Cong Danh, Nov 7, 2019
  52. Jeff KingNov 7, 2019
  53. 5/8 sequencer: reencode revert/cherry-pick's todo listDoan Tran Cong Danh, Nov 7, 2019
  54. Jeff KingNov 7, 2019
  55. 7/8 sequencer: reencode old merge-commit messageDoan Tran Cong Danh, Nov 7, 2019
  56. 8/8 sequencer: reencode commit message for am/rebase --show-current-patchDoan Tran Cong Danh, Nov 7, 2019
  57. Jeff KingNov 7, 2019
  58. Danh DoanNov 7, 2019
  59. Jeff KingNov 7, 2019
  60. Danh DoanNov 7, 2019
  61. 0/9 Improve odd encoding integrationDoan Tran Cong Danh, Nov 8, 2019
  62. 1/9 t0028: eliminate non-standard usage of printfDoan Tran Cong Danh, Nov 8, 2019
  63. 2/9 configure.ac: define ICONV_OMITS_BOM if necessaryDoan Tran Cong Danh, Nov 8, 2019
  64. 4/9 sequencer: reencode to utf-8 before arrange rebase's todo listDoan Tran Cong Danh, Nov 8, 2019
  65. 3/9 t3900: demonstrate git-rebase problem with multi encodingDoan Tran Cong Danh, Nov 8, 2019
  66. 5/9 sequencer: reencode revert/cherry-pick's todo listDoan Tran Cong Danh, Nov 8, 2019
  67. 6/9 sequencer: reencode squashing commit's messageDoan Tran Cong Danh, Nov 8, 2019
  68. 7/9 sequencer: reencode old merge-commit messageDoan Tran Cong Danh, Nov 8, 2019
  69. 8/9 sequencer: reencode commit message for am/rebase --show-current-patchDoan Tran Cong Danh, Nov 8, 2019
  70. 9/9 sequencer: fallback to sane label in making rebase todo listDoan Tran Cong Danh, Nov 8, 2019
  71. Junio C HamanoNov 11, 2019
  72. Junio C HamanoNov 11, 2019
  73. Danh DoanNov 11, 2019
  74. Junio C HamanoNov 11, 2019
  75. 0/9 sequencer: handle other encoding betterDoan Tran Cong Danh, Nov 11, 2019
  76. 1/9 t0028: eliminate non-standard usage of printfDoan Tran Cong Danh, Nov 11, 2019
  77. 2/9 configure.ac: define ICONV_OMITS_BOM if necessaryDoan Tran Cong Danh, Nov 11, 2019
  78. 3/9 t3900: demonstrate git-rebase problem with multi encodingDoan Tran Cong Danh, Nov 11, 2019
  79. 4/9 sequencer: reencode to utf-8 before arrange rebase's todo listDoan Tran Cong Danh, Nov 11, 2019
  80. 5/9 sequencer: reencode revert/cherry-pick's todo listDoan Tran Cong Danh, Nov 11, 2019
  81. 6/9 sequencer: reencode squashing commit's messageDoan Tran Cong Danh, Nov 11, 2019
  82. 8/9 sequencer: reencode commit message for am/rebase --show-current-patchDoan Tran Cong Danh, Nov 11, 2019
  83. 7/9 sequencer: reencode old merge-commit messageDoan Tran Cong Danh, Nov 11, 2019
  84. 9/9 sequencer: fallback to sane label in making rebase todo listDoan Tran Cong Danh, Nov 11, 2019
  85. Jeff KingNov 11, 2019
  86. Phillip WoodNov 11, 2019
  87. Johannes SchindelinNov 11, 2019
  88. Junio C HamanoNov 12, 2019
  89. Jeff KingNov 11, 2019

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.