scripts/decodecode: Make it take multiline Code line
PATCH 1/1 scripts/decodecode: Make it take multiline Code line
In case of running scripts/decodecode without any parameters in order to give a copy'n'pasted Code line from, for example, email it would parse only first line of it, while in emails it's split to few.
So, add a logic to join this split back if and only if the following lines have hex digits, or spaces, or '<', or '>' characters. It will be quite unlikely to have a broken input in well formed Oops or dmesg, thus a simple regex is being used.
--- scripts/decodecode | 12 ++++++++++++ 1 file changed, 12 insertions(+)
scripts/decodecode +12 -0
@@ -21,12 +21,24 @@ trap cleanup EXIT T=`mktemp` || die "cannot create temp file" code= +cont= while read i ; do case "$i" in *Code:*) code=$i + cont=yes + ;; +*) + [ -n "$cont" ] && { + xdump="$(echo $i | grep '^[[:xdigit:]<>[:space:]]\+$')" + if [ -n "$xdump" ]; then + code="$code $xdump" + else + cont= + fi + } ;; esac
Signature · 1 line
2.15.0
Quoted 8 lines · On Tue, 12 Dec 2017 12:03:23 +0200 Andy Shevchenko…
In case of running
scripts/decodecodewithout any parameters in order to give a copy'n'pasted Code line from, for example, email it would parse only first line of it, while in emails it's split to few.So, add a logic to join this split back if and only if the following lines have hex digits, or spaces, or '<', or '>' characters. It will be quite unlikely to have a broken input in well formed Oops or dmesg, thus a simple regex is being used.
That's rather hard to understand. An example would help?
Quoted 17 lines · Andrew Morton
Quoted 6 lines · On Tue, 12 Dec 2017 12:03:23 +0200 Andy Shevchenko <andriy.shevchenko@…
In case of running
scripts/decodecodewithout any parameters in order to give a
copy'n'pasted Code line from, for example, email it would parse only first line
of it, while in emails it's split to few.Quoted 7 lines
So, add a logic to join this split back if and only if the following lines have
hex digits, or spaces, or '<', or '>' characters. It will be quite unlikely to
have a broken input in well formed Oops or dmesg, thus a simple regex is being
used.
Quoted 1 line
That's rather hard to understand. An example would help?
When you have a file out of oops the Code line looks like
Code: hh hh ... <hh> ... hh\n
When copy'n'paste from, for example, email where sender or some middle MTA split it, the line looks like:
Code: hh hh ... hh\n
hh ... <hh> ... hh\n
hh hh ... hh\n
The Code line followed by another oops line usually contains characters out of hex digit + space + < + > set. That's what second paragraph describes.
Should I resend with information above included?
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Quoted 9 lines · On Tue, 19 Dec 2017 17:05:19 +0200 Andy Shevchenko…
Quoted 1 line
That's rather hard to understand. An example would help?
When you have a file out of oops the Code line looks like
Code: hh hh ... <hh> ... hh\nWhen copy'n'paste from, for example, email where sender or some middle MTA split it, the line looks like:
Quoted 7 lines
Code: hh hh ... hh\nhh ... <hh> ... hh\n
hh hh ... hh\nThe Code line followed by another oops line usually contains characters out of hex digit + space + < + > set. That's what second paragraph describes.
Oh, OK, yeah, that's irritating. I thought we fixed it ages ago!
Quoted 1 line
Should I resend with information above included?
I updated the changelog, thanks.