On Sun, Mar 09, 2008 at 12:42:37AM -0500, Jeff Johnson wrote:
> /bin/echo on my system is unmodified from
> Fedora 9 coreutils-6.10-4.fc9.i386
Interesting. So, what do you get with a manual run?
/bin/echo --foo --bar
/bin/echo -- --foo --bar
I see all the option information output literally, including the --.
What do you get if you try a "make check" using that perl -e patch
instead of echo? Does it still succeed for you?
> I added the longArg = NULL, am seeing the same failure on test # 9.
Very weird. I don't see how my change could affect a short option's
separated arg. Attached is an even safer version of the change that
ensures that the only time it ever sets longArg to NULL is if the
longArg was set to oe + 1 upon finding an equal sign.
I also tried using valgrind in the test suite:
result=`valgrind $builddir/$prog $*`
and the test-run didn't turn up any errors.
..wayne..
--- popt.c 9 Mar 2008 06:01:05 -0000 1.118
+++ popt.c 9 Mar 2008 14:03:00 -0000
@@ -883,6 +883,8 @@ int poptGetNextOpt(poptContext con)
optStringLen = (size_t)(oe - optString);
if (*oe == '=')
longArg = oe + 1;
+ else
+ oe = NULL;
/* XXX aliases with arg substitution need "--alias=arg" */
if (handleAlias(con, optString, optStringLen, '\0', longArg)) {
@@ -895,13 +897,16 @@ int poptGetNextOpt(poptContext con)
opt = findOption(con->options, optString, optStringLen, '\0',
&cb, &cbData,
singleDash);
- if (!opt && !singleDash)
- return POPT_ERROR_BADOPT;
+ if (!opt) {
+ if (!singleDash)
+ return POPT_ERROR_BADOPT;
+ if (oe)
+ longArg = NULL;
+ }
}
if (!opt) {
con->os->nextCharArg = origOptString + 1;
- longArg = NULL;
} else {
if (con->os == con->optionStack && F_ISSET(opt, STRIP))
{