[PATCH] dim: Handle multiple From: lines in pull request

Rodrigo Vivi rodrigo.vivi at intel.com
Tue Feb 4 21:07:47 UTC 2020


On Tue, Feb 04, 2020 at 09:24:51PM +0100, Daniel Vetter wrote:
> On Tue, Feb 4, 2020 at 9:19 PM Rodrigo Vivi <rodrigo.vivi at intel.com> wrote:
> >
> > On Tue, Feb 04, 2020 at 09:13:53PM +0100, Daniel Vetter wrote:
> > > dim blew up on the pull from Thomas:
> > >
> > > https://patchwork.freedesktop.org/patch/348981/
> > >
> > > Thomas helpfully added an in-body From: line, similar to how git
> > > format-patch does. But our dim parsing choked on the double From: line
> > > that resulted in.
> > >
> > > Assume that if there's a 2nd From: line it's there for a good reason
> > > and pick that one (like git apply-mbox).
> > >
> > > v2: Ditch the debug stuff ... silly me.
> > >
> > > Cc: "Thomas Hellström (VMware)" <thomas_os at shipmail.org>
> > > Cc: Dave Airlie <airlied at gmail.com>
> > > Reported-by: Dave Airlie <airlied at gmail.com>
> > > Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> > > ---
> > >  dim | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/dim b/dim
> > > index 5cf2fdcc40be..1e61fe2f9ed9 100755
> > > --- a/dim
> > > +++ b/dim
> > > @@ -1125,7 +1125,7 @@ function dim_apply_pull
> > >               sed -ne '/^[^>].*[gG]it repository at:$/,/for you to fetch/{p}' |
> > >               sed -ne '3,$p' | sed -ne '0,/^$/p' | tr '\n' ' ')
> > >
> > > -     from_line=$(grep '^From:' $file)
> > > +     from_line=$(grep '^From:' $file | tail -n 1)
> >
> > Wouldn't be better (safer) to grab the first From then the last one?
> 
> The first one is rfc822 encoded noise (in that mail at least)
> 
> =?UTF-8?q?Thomas=20Hellstr=C3=B6m=20=28VMware=29?= <thomas_os at shipmail.org>

ouch

> 
> The 2nd one is (at least in today's world, assuming reasonable MUA as
> sender) uft8:
> 
> From: Thomas Hellström (VMware) <thellstrom at vmware.com>
> 
> So if you want the first one, you need to wire up the rfc822 parser.
> Into a bash script. Jani has done that already in some other place,
> it's glorious.
> 
> Plus picking the 2nd is what git apply-mbox does.

fair enough


Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>


> -Daniel
> 
> >
> > >
> > >       if [[ -z "$pull_branch" ]] ; then
> > >               echoerr "no pull request found"
> > > --
> > > 2.24.1
> > >
> > > _______________________________________________
> > > dim-tools mailing list
> > > dim-tools at lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dim-tools
> 
> 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dim-tools mailing list