On Wed, Feb 09, 2011 at 03:33:54PM -0800, Jamie Heilman wrote:
> root@cucamonga:/etc/grub.d# grub-setup --directory=/boot/grub 
> --device-map=/boot/grub/device.map /dev/md/d0
> Invalid device `/dev/md/d0'.
> Segmentation fault
> 
> I think that was supposed to show usage ... not segfault.

I've tracked this down to a bug in Gnulib.  It's reproducible using the
attached test file in a scratch project with the argp module.

I suggest the following patch:

>From 5171cd55e535fef406e8f170f648723655933e53 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwat...@debian.org>
Date: Thu, 10 Feb 2011 00:31:44 +0000
Subject: [PATCH] argp: Fix argp_help segfault with help filter

* lib/argp-parse.c (__argp_input): Test state->pstate as well as state.
---
 lib/argp-parse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/argp-parse.c b/lib/argp-parse.c
index c884b89..44ce7d1 100644
--- a/lib/argp-parse.c
+++ b/lib/argp-parse.c
@@ -935,7 +935,7 @@ weak_alias (__argp_parse, argp_parse)
 void *
 __argp_input (const struct argp *argp, const struct argp_state *state)
 {
-  if (state)
+  if (state && state->pstate)
     {
       struct group *group;
       struct parser *parser = state->pstate;
-- 
1.7.2.3

Thanks,

-- 
Colin Watson                                       [cjwat...@debian.org]

Reply via email to