path: root/scripts/decodecode
diff options
authorAndy Shevchenko <>2018-01-31 16:14:10 -0800
committerLinus Torvalds <>2018-01-31 17:18:34 -0800
commit7e68b36145788e2e52824200edf15a6e59ea8a45 (patch)
tree1717c8c2374cc3157a4dbdb77691431e1cc0282f /scripts/decodecode
parentee190ca6516bc8257e3d36187ca6f0f71a9ec477 (diff)
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: Signed-off-by: Andy Shevchenko <> Cc: Will Deacon <> Cc: Dave Martin <> Cc: Philippe Ombredanne <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'scripts/decodecode')
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/decodecode b/scripts/decodecode
index 5ea071099330..9cef558528aa 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -21,12 +21,24 @@ trap cleanup EXIT
T=`mktemp` || die "cannot create temp file"
while read i ; do
case "$i" in
+ cont=yes
+ ;;
+ [ -n "$cont" ] && {
+ xdump="$(echo $i | grep '^[[:xdigit:]<>[:space:]]\+$')"
+ if [ -n "$xdump" ]; then
+ code="$code $xdump"
+ else
+ cont=
+ fi
+ }