From: Sascha Hauer <s.hauer@pengutronix.de>
To: Alexander Aring <alex.aring@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [BUG] readline history
Date: Mon, 1 Sep 2014 14:25:16 +0200 [thread overview]
Message-ID: <20140901122516.GX5352@pengutronix.de> (raw)
In-Reply-To: <20140901084455.GA8561@omega>
On Mon, Sep 01, 2014 at 10:44:57AM +0200, Alexander Aring wrote:
> Hi Sascha,
>
> On Mon, Sep 01, 2014 at 10:30:33AM +0200, Sascha Hauer wrote:
> > Hi Teresa,
> >
> > On Thu, Aug 28, 2014 at 09:50:05AM +0200, Teresa Gamez wrote:
> > > Hello Sascha,
> > >
> > > I noticed a bug on the latest master.
> > > When no history is present and I hit the arrow up key, I get:
> > >
> > > unable to handle NULL pointer dereference at address 0x00000001
> > > pc : [<9fe243ba>] lr : [<9fe268cf>]
> > > sp : 9ffff9d0 ip : 00000016 fp : 00000002
> > > r10: 00000001 r9 : 9fe549dc r8 : 9fe65d08
> > > r7 : 00000400 r6 : 00000001 r5 : 00000000 r4 : 9fe66258
> > > r3 : 00000000 r2 : 00000000 r1 : 00000001 r0 : 9fe66258
> > > Flags: nZCv IRQs off FIQs on Mode SVC_32
> > > [<9fe243ba>] (strcpy+0xa/0xe) from [<9fe268cf>] (readline+0x363/0x4e0)
> > > [<9fe268cf>] (readline+0x363/0x4e0) from [<9fe05469>] (file_get
> > > +0x49/0x110)
> > >
> > > I could bisect it to this commit:
> > >
> > >
> > > ada160a34a1ec8421d5bb7b9dd746294668a5130 is the first bad commit
> > > commit ada160a34a1ec8421d5bb7b9dd746294668a5130
> > > Author: Sascha Hauer <s.hauer@pengutronix.de>
> > > Date: Tue Jul 29 11:54:26 2014 +0200
> >
> > Damned. While working on that patch I had exactly this problem and
> > thought I tested this case. Apparantly I didn't :(
> >
> > The following should fix this:
> >
> > Sascha
> >
> > From 7fd0d972f71610c25276ca387164b1fd71fb74be Mon Sep 17 00:00:00 2001
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> > Date: Mon, 1 Sep 2014 10:21:44 +0200
> > Subject: [PATCH] readline: Fix history prev when history is empty
> >
> > We cannot use list_entry() on an empty list. Without history
> > we have to return an empty line. This fixes a crash when the
> > cursor up button is pressed and no command has been entered
> > previously. Broken since:
> >
> > commit ada160a34a1ec8421d5bb7b9dd746294668a5130
> > Author: Sascha Hauer <s.hauer@pengutronix.de>
> > Date: Tue Jul 29 11:54:26 2014 +0200
> >
> > readline: reimplement history functions
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > Reported-by: Teresa Gamez <t.gamez@phytec.de>
> > ---
> > lib/readline.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/lib/readline.c b/lib/readline.c
> > index b70bca8..e855abd 100644
> > --- a/lib/readline.c
> > +++ b/lib/readline.c
> > @@ -68,6 +68,9 @@ static const char *hist_prev(void)
> > struct history *history;
> >
> > if (history_current->prev == &history_list) {
> > + if (list_empty(&history_list))
> > + return "";
> > +
>
> what's about to ring the terminal bell when this happen?
I added a getcmd_cbeep() to add the beep.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2014-09-01 12:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 7:50 Teresa Gamez
2014-08-28 8:35 ` Alexander Aring
2014-08-28 9:25 ` Alexander Aring
2014-08-28 10:08 ` Alexander Aring
2014-09-01 8:30 ` Sascha Hauer
2014-09-01 8:44 ` Alexander Aring
2014-09-01 12:25 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140901122516.GX5352@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=alex.aring@gmail.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox