Skip to content

Commit 7e68b36

Browse files
andy-shevtorvalds
authored andcommitted
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. ie, 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. So add 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. Link: http://lkml.kernel.org/r/20171212100323.33201-1-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Dave Martin <Dave.Martin@arm.com> Cc: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ee190ca commit 7e68b36

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎scripts/decodecode‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,24 @@ trap cleanup EXIT
2121

2222
T=`mktemp` || die "cannot create temp file"
2323
code=
24+
cont=
2425

2526
while read i ; do
2627

2728
case "$i" in
2829
*Code:*)
2930
code=$i
31+
cont=yes
32+
;;
33+
*)
34+
[ -n "$cont" ] && {
35+
xdump="$(echo $i | grep '^[[:xdigit:]<>[:space:]]\+$')"
36+
if [ -n "$xdump" ]; then
37+
code="$code $xdump"
38+
else
39+
cont=
40+
fi
41+
}
3042
;;
3143
esac
3244

0 commit comments

Comments
 (0)