Bug#200351: dpkg-issue then...
* Falk Hueffner <falk.hueffner@student.uni-tuebingen.de> [030912 13:52]:
> and longjmp must not jump into a function which has been
> terminated after the call to setjmp (which is likely the cause for the
> crash).
Thanks. I guessed that if dpkg does this so explicitly, it would not be
wrong. The following patch resolves the problem for me:
diff -r dpkg-1.10.10.old/debian/changelog dpkg-1.10.10/debian/changelog
0a1,6
> dpkg (1.10.10-0.1) local; urgency=low
>
> * Fix setjmp bug in standard_startup
>
> -- Bernhard R. Link <brlink@debian.org> Fry, 12 Sep 2003 14:09:00 +0200
>
diff -r dpkg-1.10.10.old/dpkg-deb/main.c dpkg-1.10.10/dpkg-deb/main.c
168c168,173
< standard_startup(&ejbuf, argc, &argv, NULL, 0, cmdinfos);
---
> if (setjmp(ejbuf)) { /* expect warning about possible clobbering of argv */
> error_unwind(ehflag_bombout); exit(2);
> }
> push_error_handler(&ejbuf,print_error_fatal,0);
>
> standard_startup(argc, &argv, NULL, 0, cmdinfos);
diff -r dpkg-1.10.10.old/include/dpkg.h.in dpkg-1.10.10/include/dpkg.h.in
170c170
< void standard_startup(jmp_buf *ejbuf, int argc, const char *const **argv, const char *prog, int loadcfg, const struct cmdinfo cmdinfos[]);
---
> void standard_startup(int argc, const char *const **argv, const char *prog, int loadcfg, const struct cmdinfo cmdinfos[]);
diff -r dpkg-1.10.10.old/lib/startup.c dpkg-1.10.10/lib/startup.c
41c41
< void standard_startup(jmp_buf *ejbuf, int argc, const char *const **argv, const char *prog, int loadcfg, const struct cmdinfo cmdinfos[]) {
---
> void standard_startup(int argc, const char *const **argv, const char *prog, int loadcfg, const struct cmdinfo cmdinfos[]) {
47,51d46
< if (setjmp(*ejbuf)) { /* expect warning about possible clobbering of argv */
< error_unwind(ehflag_bombout); exit(2);
< }
< push_error_handler(ejbuf,print_error_fatal,0);
<
diff -r dpkg-1.10.10.old/main/main.c dpkg-1.10.10/main/main.c
551c551,556
< standard_startup(&ejbuf, argc, &argv, DPKG, 1, cmdinfos);
---
> if (setjmp(ejbuf)) { /* expect warning about possible clobbering of argv */
> error_unwind(ehflag_bombout); exit(2);
> }
> push_error_handler(&ejbuf,print_error_fatal,0);
>
> standard_startup(argc, &argv, DPKG, 1, cmdinfos);
diff -r dpkg-1.10.10.old/main/query.c dpkg-1.10.10/main/query.c
540c540,545
< standard_startup(&ejbuf, argc, &argv, NULL, 0, cmdinfos);
---
> if (setjmp(ejbuf)) { /* expect warning about possible clobbering of argv */
> error_unwind(ehflag_bombout); exit(2);
> }
> push_error_handler(&ejbuf,print_error_fatal,0);
>
> standard_startup(argc, &argv, NULL, 0, cmdinfos);
diff -r dpkg-1.10.10.old/split/main.c dpkg-1.10.10/split/main.c
156c156,161
< standard_startup(&ejbuf, argc, &argv, NULL, 0, cmdinfos);
---
> if (setjmp(ejbuf)) { /* expect warning about possible clobbering of argv */
> error_unwind(ehflag_bombout); exit(2);
> }
> push_error_handler(&ejbuf,print_error_fatal,0);
>
> standard_startup(argc, &argv, NULL, 0, cmdinfos);
Reply to: