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