Pádraig Brady <[EMAIL PROTECTED]> wrote:
> Steven Schubiger wrote:
>> Attached is a patch that enhances seq's diagnostics. If you agree
>> that this is the right way to go, I'll amend other files (ChangeLog,
>> etc.) as needed.
>
> Seems sensible. This is what I get on a reasonably recent tree:
>
> $ ./seq -f% 1
> ./seq: memory exhausted
Oh! That's a bug in the latest code.
Actually that's due to a misinterpreted asprintf failure.
> Note however that on gutsy I get the expected:
>
> $ seq -f% 1
> seq: invalid format string: `%'
> Try `seq --help' for more information.
Here's one way to fix it:
diff --git a/src/seq.c b/src/seq.c
index 261a44b..b073fd1 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -1,5 +1,5 @@
/* seq - print sequence of numbers to standard output.
- Copyright (C) 1994-2007 Free Software Foundation, Inc.
+ Copyright (C) 1994-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -209,7 +209,7 @@ long_double_format (char const *fmt, struct layout *layout)
length_modifier_offset = i;
has_L = (fmt[i] == 'L');
i += has_L;
- if (! strchr ("efgaEFGA", fmt[i]))
+ if (fmt[i] == '\0' || ! strchr ("efgaEFGA", fmt[i]))
return NULL;
for (i++; ! (fmt[i] == '%' && fmt[i + 1] != '%'); i += (fmt[i] == '%') + 1)
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils