Fri, 03 Aug 2012 20:11:53 +0200
Neutralize buggy code causing OpenPKG to have 'fatal problems' in
spite of correct installation, configuration, and operation. An
administrator suffering from this failure is even unable to
uninstall the flawed software.
michael@428 | 1 | Index: popt.c |
michael@428 | 2 | --- popt.c.orig 2009-04-12 20:14:38.000000000 +0200 |
michael@428 | 3 | +++ popt.c 2010-04-30 21:31:41.000000000 +0200 |
michael@431 | 4 | @@ -519,6 +519,11 @@ |
michael@428 | 5 | } |
michael@428 | 6 | |
michael@428 | 7 | if (con->leftovers != NULL && con->numLeftovers > 0) { |
michael@428 | 8 | +#if defined(OPENPKG) |
michael@428 | 9 | + /* Revert back to the old behaviour of passing to "exec" programs an |
michael@428 | 10 | + extra "--" argument to clearly separate options and arguments. */ |
michael@428 | 11 | + argv[argc++] = "--"; |
michael@428 | 12 | +#endif |
michael@428 | 13 | memcpy(argv + argc, con->leftovers, sizeof(*argv) * con->numLeftovers); |
michael@428 | 14 | argc += con->numLeftovers; |
michael@428 | 15 | } |
michael@431 | 16 | @@ -709,10 +709,19 @@ |
michael@428 | 17 | /*@switchbreak@*/ break; |
michael@428 | 18 | #endif |
michael@428 | 19 | case '!': |
michael@428 | 20 | +#if defined(OPENPKG) |
michael@428 | 21 | + /* allow standard "!#:+" (first argument is expanded multiple times) |
michael@428 | 22 | + and non-standard "!#:*" (all arguments are expanded in sequence) */ |
michael@428 | 23 | + if (!(s[0] == '#' && s[1] == ':' && (s[2] == '+' || s[2] == '*'))) |
michael@428 | 24 | +#else |
michael@428 | 25 | if (!(s[0] == '#' && s[1] == ':' && s[2] == '+')) |
michael@428 | 26 | +#endif |
michael@428 | 27 | /*@switchbreak@*/ break; |
michael@428 | 28 | - /* XXX Make sure that findNextArg deletes only next arg. */ |
michael@428 | 29 | +#if defined(OPENPKG) |
michael@428 | 30 | + if (a == NULL || s[2] == '*') { |
michael@428 | 31 | +#else |
michael@428 | 32 | if (a == NULL) { |
michael@428 | 33 | +#endif |
michael@428 | 34 | if ((a = findNextArg(con, 1U, 1)) == NULL) |
michael@428 | 35 | /*@switchbreak@*/ break; |
michael@428 | 36 | } |
michael@428 | 37 | Index: poptconfig.c |
michael@428 | 38 | --- poptconfig.c.orig 2009-04-12 20:14:38.000000000 +0200 |
michael@428 | 39 | +++ poptconfig.c 2010-04-30 21:32:23.000000000 +0200 |
michael@428 | 40 | @@ -42,7 +42,10 @@ |
michael@428 | 41 | /*@=declundef =exportheader =incondefs =protoparammatch =redecl =type @*/ |
michael@428 | 42 | #endif /* __LCLINT__ */ |
michael@428 | 43 | |
michael@428 | 44 | -#if !defined(__GLIBC__) |
michael@428 | 45 | +#if defined(__NetBSD__) |
michael@428 | 46 | +#include <sys/param.h> |
michael@428 | 47 | +#endif |
michael@428 | 48 | +#if !defined(__GLIBC__) && (!defined(__NetBSD__) || __NetBSD_Version__ < 599001100) |
michael@428 | 49 | /* Return nonzero if PATTERN contains any metacharacters. |
michael@428 | 50 | Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ |
michael@428 | 51 | static int |
michael@428 | 52 | Index: popthelp.c |
michael@428 | 53 | --- popthelp.c.orig 2009-04-12 20:14:38.000000000 +0200 |
michael@428 | 54 | +++ popthelp.c 2010-04-30 21:31:41.000000000 +0200 |
michael@428 | 55 | @@ -15,7 +15,9 @@ |
michael@428 | 56 | #include <sys/ioctl.h> |
michael@428 | 57 | #endif |
michael@428 | 58 | |
michael@428 | 59 | +#if !defined(OPENPKG) |
michael@428 | 60 | #define POPT_WCHAR_HACK |
michael@428 | 61 | +#endif |
michael@428 | 62 | #ifdef POPT_WCHAR_HACK |
michael@428 | 63 | #include <wchar.h> /* for mbsrtowcs */ |
michael@428 | 64 | /*@access mbstate_t @*/ |