mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Hubert Feurstein <h.feurstein@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: pull request complete support
Date: Fri, 10 Jun 2011 03:25:02 +0200	[thread overview]
Message-ID: <20110610012502.GM17584@game.jcrosoft.org> (raw)
In-Reply-To: <BANLkTikwVwFUzZFRUJCS72SxmNSjw-KRtw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]

On 00:46 Fri 10 Jun     , Hubert Feurstein wrote:
> Hi Jean-Christophe,
> 
> I've tested it in the sandbox and get an access violation when I type
> "dev<TAB>". Here is the backtrace:
> 
> #0  0x0040dd1b in strlen (s=0x0) at lib/string.c:228
> #1  0x00404652 in device_param_complete (begin=0 '\000',
> dev=0xb763fa94, sl=0xbfffefe0, instr=0x0) at common/complete.c:115
> #2  0x00404a24 in env_param_complete (sl=0xbfffefe0, instr=0x426160
> "dev", eval=0) at common/complete.c:209
> #3  0x00404c59 in complete (instr=0x426160 "dev", outstr=0xbffff064)
> at common/complete.c:282
> #4  0x00415687 in readline (prompt=0x426ac0 "barebox:/ ", buf=0x426160
> "dev", len=1024) at lib/readline.c:209
> #5  0x00401363 in get_user_input (i=0xbffff1c8) at common/hush.c:414
> #6  0x004014c2 in file_get (i=0xbffff1c8) at common/hush.c:463
> #7  0x00402e4f in parse_stream (dest=0xbffff154, ctx=0xbffff198,
> input=0xbffff1c8, end_trigger=10) at common/hush.c:1278
> #8  0x00402fd2 in parse_stream_outer (ctx=0xbffff198, inp=0xbffff1c8,
> flag=2) at common/hush.c:1428
> #9  0x00403770 in run_shell () at common/hush.c:1647
> #10 0x00407d6a in start_barebox () at common/startup.c:167
> #11 0x0041f082 in main ()

try with this patch

Best Regards,
J.

[-- Attachment #2: p.patch --]
[-- Type: text/x-diff, Size: 740 bytes --]

diff --git a/common/complete.c b/common/complete.c
index 586a7eb..f9c05b4 100644
--- a/common/complete.c
+++ b/common/complete.c
@@ -88,6 +88,9 @@ int device_complete(struct string_list *sl, char *instr)
 	char cmd[128];
 	int len, len2;
 
+	if (!instr)
+		instr = "";
+
 	len = strlen(instr);
 
 	for_each_device(dev) {
@@ -112,6 +115,9 @@ static int device_param_complete(char begin, struct device_d *dev,
 	char *tmp = cmd;
 	int len, len2;
 
+	if (!instr)
+		instr = "";
+
 	len = strlen(instr);
 	if (begin) {
 		tmp[0] = begin;
@@ -156,6 +162,9 @@ static int env_param_complete(struct string_list *sl, char *instr, int eval)
 	int len, len2;
 	char end = '=';
 
+	if (!instr)
+		instr = "";
+
 	if (eval) {
 		cmd[0] = '$';
 		tmp++;

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-06-10  1:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09 14:50 Jean-Christophe PLAGNIOL-VILLARD
2011-06-09 14:55 ` [PATCH 1/6] complete: add var and device param " Jean-Christophe PLAGNIOL-VILLARD
2011-06-10  1:29   ` [PATCH v2] " Jean-Christophe PLAGNIOL-VILLARD
2011-06-10  6:53     ` Sascha Hauer
2011-06-10  7:03       ` Jean-Christophe PLAGNIOL-VILLARD
2011-06-10  8:00         ` Sascha Hauer
2011-06-09 14:55 ` [PATCH 2/6] complete: add generic command complete framework Jean-Christophe PLAGNIOL-VILLARD
2011-06-09 14:55 ` [PATCH 3/6] complete: add device name complete support for devinfo Jean-Christophe PLAGNIOL-VILLARD
2011-06-09 14:55 ` [PATCH 4/6] complete: add help complete support Jean-Christophe PLAGNIOL-VILLARD
2011-06-09 14:55 ` [PATCH 5/6] complete: add empty " Jean-Christophe PLAGNIOL-VILLARD
2011-06-09 14:55 ` [PATCH 6/6] complete: add eth interface " Jean-Christophe PLAGNIOL-VILLARD
2011-06-09 22:46 ` pull request " Hubert Feurstein
2011-06-10  1:25   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-06-10  1:30 ` Jean-Christophe PLAGNIOL-VILLARD

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=20110610012502.GM17584@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=h.feurstein@gmail.com \
    /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