Skip to content

Commit

Permalink
scripts/decodecode: make it take multiline Code line
Browse files Browse the repository at this point in the history
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/[email protected]
Signed-off-by: Andy Shevchenko <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Dave Martin <[email protected]>
Cc: Philippe Ombredanne <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
andy-shev authored and torvalds committed Feb 1, 2018
1 parent ee190ca commit 7e68b36
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/decodecode
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7e68b36

Please sign in to comment.