Re: [PATCH] specify encoding for sed command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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\].



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux