All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] scripts/decodecode: Make it take multiline Code line
@ 2017-12-12 10:03 Andy Shevchenko
  2017-12-12 20:51 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2017-12-12 10:03 UTC (permalink / raw)
  To: Will Deacon, Dave Martin, Philippe Ombredanne, linux-kernel,
	Andrew Morton
  Cc: Andy Shevchenko

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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 scripts/decodecode | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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"
 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
 
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] scripts/decodecode: Make it take multiline Code line
  2017-12-12 10:03 [PATCH v1] scripts/decodecode: Make it take multiline Code line Andy Shevchenko
@ 2017-12-12 20:51 ` Andrew Morton
  2017-12-19 15:05   ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2017-12-12 20:51 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Will Deacon, Dave Martin, Philippe Ombredanne, linux-kernel

On Tue, 12 Dec 2017 12:03:23 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> 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.

That's rather hard to understand.  An example would help?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] scripts/decodecode: Make it take multiline Code line
  2017-12-12 20:51 ` Andrew Morton
@ 2017-12-19 15:05   ` Andy Shevchenko
  2017-12-19 22:54     ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2017-12-19 15:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Will Deacon, Dave Martin, Philippe Ombredanne, linux-kernel

On Tue, 2017-12-12 at 12:51 -0800, Andrew Morton wrote:
> On Tue, 12 Dec 2017 12:03:23 +0200 Andy Shevchenko <andriy.shevchenko@
> linux.intel.com> wrote:
> 
> > 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.
> 
> 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?

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] scripts/decodecode: Make it take multiline Code line
  2017-12-19 15:05   ` Andy Shevchenko
@ 2017-12-19 22:54     ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2017-12-19 22:54 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Will Deacon, Dave Martin, Philippe Ombredanne, linux-kernel

On Tue, 19 Dec 2017 17:05:19 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> > 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.

Oh, OK, yeah, that's irritating.  I thought we fixed it ages ago!

> Should I resend with information above included?

I updated the changelog, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-19 22:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-12 10:03 [PATCH v1] scripts/decodecode: Make it take multiline Code line Andy Shevchenko
2017-12-12 20:51 ` Andrew Morton
2017-12-19 15:05   ` Andy Shevchenko
2017-12-19 22:54     ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.