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

Re: [PATCH] specify encoding for sed command

From
MCMatt Coleman <cat.moleman@gmail.com>
Date
Apr 10, 2018, 07:18 UTC
Message-ID
<DB5A1CE2-7844-4CB6-A03E-6AAC4EC13D66@gmail.com>
In-Reply-To
<87605616vr.fsf@evledraar.gmail.com>
> 1) What platform OS / version / sed version is this on?
I'm experiencing this on macOS Sierra (10.12.6). The issue occurs with the OS's native sed, which is FreeBSD sed so the version number is kind of ambiguous.
The error goes away if I set LANG=C or LC_ALL=C or change it to use GNU sed (installed via homebrew as gsed).
> 2) What's the output from "set" that's causing this error? Do we have an
>   isolated test case for that?

On my system, it's caused by whatever powerline is doing to Bash's PS1 variable: $ set | grep ^PS1= | sed 's/foo/bar/' sed: RE error: illegal byte sequence

I'm not sure exactly which character is bad here: $ xxd <<<$PS1 00000000: 5c5b 1b5b 303b 3338 3b32 3b32 3535 3b32 \[.[0;38;2;255;2 00000010: 3535 3b32 3535 3b34 383b 323b 303b 3133 55;255;48;2;0;13 00000020: 353b 3137 353b 316d 5c5d c2a0 6d61 7474 5;175;1m\]..matt 00000030: c2a0 5c5b 1b5b 303b 3338 3b32 3b30 3b31 ..\[.[0;38;2;0;1 00000040: 3335 3b31 3735 3b34 383b 323b 3838 3b38 35;175;48;2;88;8 00000050: 383b 3838 3b32 326d 5c5d ee82 b0c2 a05c 8;88;22m\].....\ 00000060: 5b1b 5b30 3b33 383b 323b 3230 383b 3230 [.[0;38;2;208;20 00000070: 383b 3230 383b 3438 3b32 3b38 383b 3838 8;208;48;2;88;88 00000080: 3b38 383b 316d 5c5d 7ec2 a05c 5b1b 5b30 ;88;1m\]~..\[.[0 00000090: 3b33 383b 323b 3133 383b 3133 383b 3133 ;38;2;138;138;13 000000a0: 383b 3438 3b32 3b38 383b 3838 3b38 383b 8;48;2;88;88;88; 000000b0: 3232 6d5c 5dee 82b1 c2a0 5c5b 1b5b 303b 22m\].....\[.[0; 000000c0: 3338 3b32 3b32 3038 3b32 3038 3b32 3038 38;2;208;208;208 000000d0: 3b34 383b 323b 3838 3b38 383b 3838 3b31 ;48;2;88;88;88;1 000000e0: 6d5c 5dc2 a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 m\]............. 000000f0: a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 ................ 00000100: a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 ................ 00000110: a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 ................ 00000120: a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 ................ 00000130: a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 a0c2 a05c ...............\ 00000140: 5b1b 5b30 3b33 383b 323b 3438 3b34 383b [.[0;38;2;48;48; 00000150: 3438 3b34 383b 323b 3838 3b38 383b 3838 48;48;2;88;88;88 00000160: 3b32 326d 5c5d c2a0 ee82 b25c 5b1b 5b30 ;22m\].....\[.[0 00000170: 3b33 383b 323b 3135 383b 3135 383b 3135 ;38;2;158;158;15 00000180: 383b 3438 3b32 3b34 383b 3438 3b34 386d 8;48;2;48;48;48m 00000190: 5c5d c2a0 3230 3138 2d30 342d 3130 5c5b \]..2018-04-10\[ 000001a0: 1b5b 303b 3338 3b32 3b39 383b 3938 3b39 .[0;38;2;98;98;9 000001b0: 383b 3438 3b32 3b34 383b 3438 3b34 383b 8;48;2;48;48;48; 000001c0: 3232 6d5c 5dc2 a0ee 82b3 5c5b 1b5b 303b 22m\].....\[.[0; 000001d0: 3338 3b32 3b32 3038 3b32 3038 3b32 3038 38;2;208;208;208 000001e0: 3b34 383b 323b 3438 3b34 383b 3438 3b31 ;48;2;48;48;48;1 000001f0: 6d5c 5dc2 a030 333a 3136 c2a0 5c5b 1b5b m\]..03:16..\[.[ 00000200: 306d 5c5d 205c 5b1b 5b30 3b33 383b 323b 0m\] \[.[0;38;2; 00000210: 3135 383b 3135 383b 3135 383b 3438 3b32 158;158;158;48;2 00000220: 3b34 383b 3438 3b34 386d 5c5d c2a0 c2a0 ;48;48;48m\].... 00000230: 5c5b 1b5b 303b 3338 3b32 3b34 383b 3438 \[.[0;38;2;48;48 00000240: 3b34 383b 3439 3b32 326d 5c5d ee82 b0c2 ;48;49;22m\].... 00000250: a05c 5b1b 5b30 6d5c 5d0a .\[.[0m\].

Previous: SZEDER GáborNext: Matt Coleman
Message 5 of 38 in “specify encoding for sed command”
  1. specify encoding for sed commandStephon Harris, Apr 5, 2018
  2. Ævar Arnfjörð BjarmasonApr 5, 2018
  3. Eric SunshineApr 5, 2018
  4. SZEDER GáborApr 5, 2018
  5. Matt ColemanApr 10, 2018
  6. Matt ColemanApr 11, 2018
  7. Matthew ColemanApr 12, 2018
  8. SZEDER GáborApr 13, 2018
  9. Matthew ColemanApr 13, 2018
  10. completion: reduce overhead of clearing cached --optionsSZEDER Gábor, Apr 13, 2018
  11. Jakub NarebskiApr 13, 2018
  12. SZEDER GáborApr 13, 2018
  13. Jakub NarebskiApr 14, 2018
  14. Jacob KellerApr 16, 2018
  15. Matthew ColemanApr 16, 2018
  16. Junio C HamanoApr 16, 2018
  17. SZEDER GáborApr 16, 2018
  18. Jakub NarębskiApr 16, 2018
  19. Junio C HamanoApr 16, 2018
  20. completion: reduce overhead of clearing cached --optionsSZEDER Gábor, Apr 17, 2018
  21. Junio C HamanoApr 17, 2018
  22. Matthew ColemanMay 7, 2018
  23. Todd ZullingerMay 8, 2018
  24. Junio C HamanoMay 8, 2018
  25. Jonathan NiederJun 7, 2018
  26. Dave BorowitzJun 7, 2018
  27. Rick van HattemJun 7, 2018
  28. SZEDER GáborJun 8, 2018
  29. Jonathan NiederJun 8, 2018
  30. SZEDER GáborJun 8, 2018
  31. Jonathan NiederJun 8, 2018
  32. SZEDER GáborJun 8, 2018
  33. Junio C HamanoJun 11, 2018
  34. completion: correct zsh detection when run from git-completion.zsh (Re: [PATCH v2] completion: reduce overhead of clearing cached --options)Jonathan Nieder, Jun 11, 2018
  35. SZEDER GáborJun 12, 2018
  36. SZEDER GáborJun 12, 2018
  37. Rick van HattemJun 12, 2018
  38. Junio C HamanoApr 8, 2018

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.