On 8/12/19 4:30 PM, Dmitry Bogatov wrote:
> [2019-08-11 18:08] Jesse Smith <jsm...@resonatingmedia.com>
>>> No. When you output raw escape sequences on terminal, they will be
>>> interpreted by terminal, so `head', `tail' and `grep' output will be
>> readable and colored. Pager `less' with -R option also interpret escape
>> symbols.
>>
>> I wasn't speaking theoretically.
> No offence intended. Sorry if I sounded harsh.

No offence taken. I can understand why you'd expect the output to look
normal.
>
>> I tried it and the "head", "cat" and "tail" commands mangle the lines
>> of the log file when escape sequences are not escaped. Output from
>> "less" is clean though and looks correct.
> Interesting. Can you please send text that shows this behaviour?
>
Certainly. Attached is a file with the last 20 lines of the
/var/boot/log file on a test machine. When I view the log with "less"
the output looks normal. When I run the file through "head" "tail" or
"cat" the "[ ok" part of the message line appears at the beginning of
the text. This happens in both the text console and in a virtual
terminal window.

This output was achieved by turning off escape character filtering in
bootlogd. The contents of the file are just written out raw, as the data
comes into bootlogd.

- Jesse

Sat Aug 10 20:32:12 2019: nm-dispatcher: req:2 'connectivity-change': new 
request (2 scripts)
Sat Aug 10 20:32:12 2019: nm-dispatcher: req:2 'connectivity-change': start 
running ordered scripts...
Sat Aug 10 20:32:15 2019: [....] Starting SMB/CIFS daemon: 
smbd[?25l[?1c7[ ok 8[?25h[?0c.
Sat Aug 10 20:32:15 2019: Applying power save settings...done.
Sat Aug 10 20:32:15 2019: Setting battery charge thresholds...done.
Sat Aug 10 20:32:15 2019: Radio device states restored.
Sat Aug 10 20:32:15 2019: nm-dispatcher: req:3 'up' [eth0]: new request (2 
scripts)
Sat Aug 10 20:32:15 2019: nm-dispatcher: req:3 'up' [eth0]: start running 
ordered scripts...
Sat Aug 10 20:32:16 2019: ModemManager[2258]: <info>  Couldn't check support 
for device at '/sys/devices/pci0000:00/0000:00:03.0': not supported by any 
plugin
Sat Aug 10 20:32:16 2019: 
Sat Aug 10 20:32:18 2019: [....] Starting VirtualBox AdditionsVBoxService 
5.2.24_Debian r128122 (verbosity: 0) linux.amd64 (Jan 24 2019 21:06:36) release 
log
Sat Aug 10 20:32:18 2019: 00:00:00.000361 main     Log opened 
2019-08-10T23:32:18.177888000Z
Sat Aug 10 20:32:18 2019: 00:00:00.000582 main     OS Product: Linux
Sat Aug 10 20:32:18 2019: 00:00:00.000627 main     OS Release: 4.13.0-1-amd64
Sat Aug 10 20:32:18 2019: 00:00:00.000665 main     OS Version: #1 SMP Debian 
4.13.13-1mx17 (2017-11-18)
Sat Aug 10 20:32:18 2019: 00:00:00.000704 main     Executable: 
/usr/sbin/VBoxService
Sat Aug 10 20:32:18 2019: 00:00:00.000706 main     Process ID: 2615
Sat Aug 10 20:32:18 2019: 00:00:00.000707 main     Package type: 
LINUX_64BITS_GENERIC (OSE)
Sat Aug 10 20:32:18 2019: 00:00:00.007391 main     5.2.24_Debian r128122 
started. Verbose level = 0
Sat Aug 10 20:32:18 2019: [?25l[?1c7[ ok 8[?25h[?0c.

Reply via email to