+Thu Jan 4 01:20:27 CST 2001 Adam Heath <doogie@debian.org>
+
+ * dpkg-deb/build.c, dpkg-deb/extract.c, dpkg-deb/info.c,
+ include/dpkg.h.in, lib/mlib.c, main/archives.c, main/enquiry.c,
+ main/help.c main/processarc.c: Add 'warn' parameter to waitsubproc
+ and checksubprocerr, and also add a return value. This fixes my
+ last checkin, where maintainer_script_alternative would run
+ both the old and new script.
+
Thu Jan 04 05:19:37 CET 2001 peter karlsson <peterk@debian.org>
* po/sv.po: Updated Swedish translation.
internalGzip(0, 1, "9", _("control"));
}
close(p1[0]);
- waitsubproc(c2,"gzip -9c",0);
- waitsubproc(c1,"tar -cf",0);
+ waitsubproc(c2,"gzip -9c",0,0);
+ waitsubproc(c1,"tar -cf",0,0);
if (fstat(gzfd,&controlstab)) ohshite(_("failed to fstat tmpfile (control)"));
/* We have our first file for the ar-archive. Write a header for it to the
* package and insert it.
ohshite(_("failed to write filename to tar pipe (data)"));
}
close(p3[0]);
- waitsubproc(c3,"find",0);
+ waitsubproc(c3,"find",0,0);
for (fi= symlist;fi;fi= fi->next)
if (write(p1[1], fi->fn, strlen(fi->fn)+1) == -1)
/* All done, clean up wait for tar and gzip to finish their job */
close(p1[1]);
free_filist(symlist);
- waitsubproc(c2,"gzip -9c from tar -cf",0);
- waitsubproc(c1,"tar -cf",0);
+ waitsubproc(c2,"gzip -9c from tar -cf",0,0);
+ waitsubproc(c1,"tar -cf",0,0);
/* Okay, we have data.tar.gz as well now, add it to the ar wrapper */
if (!oldformatflag) {
if (fstat(gzfd,&datastab)) ohshite("_(failed to fstat tmpfile (data))");
if (!(c1= m_fork())) {
execlp("sh","sh","-c",buf,(char*)0); ohshite(_("failed to exec sh -c mv foo/* &c"));
}
- waitsubproc(c1,"sh -c mv foo/* &c",0);
+ waitsubproc(c1,"sh -c mv foo/* &c",0,0);
}
static void readfail(FILE *a, const char *filename, const char *what) {
ohshite(_("failed to exec tar"));
}
close(p2[0]);
- waitsubproc(c3,"tar",0);
+ waitsubproc(c3,"tar",0,0);
}
- waitsubproc(c2,"gzip -dc",1);
- if (c1 != -1) waitsubproc(c1,"paste",0);
+ waitsubproc(c2,"gzip -dc",1,0);
+ if (c1 != -1) waitsubproc(c1,"paste",0,0);
if (oldformat && admininfo) {
if (versionnum == 0.931F) {
movecontrolfiles(OLDOLDDEBDIR);
if (!(c1= m_fork())) {
execlp(RM,"rm","-rf",dbuf,(char*)0); ohshite(_("failed to exec rm -rf"));
}
- waitsubproc(c1,"rm -rf",0);
+ waitsubproc(c1,"rm -rf",0,0);
push_cleanup(cu_info_prepare,-1, 0,0, 1, (void*)dbuf);
extracthalf(*debarp, dbuf, "mx", admininfo);
}
void m_dup2(int oldfd, int newfd);
void m_pipe(int fds[2]);
-void checksubprocerr(int status, const char *description, int sigpipeok);
-void waitsubproc(pid_t pid, const char *description, int sigpipeok);
+int checksubprocerr(int status, const char *description, int sigpipeok, int warn);
+int waitsubproc(pid_t pid, const char *description, int sigpipeok, int warn);
#define BUFFER_WRITE_BUF 0
#define BUFFER_WRITE_VBUF 1
ohshite(_("failed to create pipe"));
}
-void checksubprocerr(int status, const char *description, int sigpipeok) {
+int checksubprocerr(int status, const char *description, int sigpipeok, int warn) {
int n;
if (WIFEXITED(status)) {
- n= WEXITSTATUS(status); if (!n) return;
- ohshit(_("subprocess %s returned error exit status %d"),description,n);
+ n= WEXITSTATUS(status); if (!n) return n;
+ if(warn)
+ fprintf(stderr, _("dpkg: warning - %s returned error exit status %d\n"),description,n);
+ else
+ ohshit(_("subprocess %s returned error exit status %d"),description,n);
} else if (WIFSIGNALED(status)) {
- n= WTERMSIG(status); if (!n || (sigpipeok && n==SIGPIPE)) return;
- ohshit(_("subprocess %s killed by signal (%s)%s"),
+ n= WTERMSIG(status); if (!n || (sigpipeok && n==SIGPIPE)) return 0;
+ if (warn)
+ ohshit(_("dpkg: warning - %s killed by signal (%s)%s\n"),
+ description, strsignal(n), WCOREDUMP(status) ? ", core dumped" : "");
+ else
+ ohshit(_("subprocess %s killed by signal (%s)%s"),
description, strsignal(n), WCOREDUMP(status) ? ", core dumped" : "");
} else {
ohshit(_("subprocess %s failed with wait status code %d"),description,status);
}
}
-void waitsubproc(pid_t pid, const char *description, int sigpipeok) {
+int waitsubproc(pid_t pid, const char *description, int sigpipeok, int warn) {
pid_t r;
int status;
while ((r= waitpid(pid,&status,0)) == -1 && errno == EINTR);
if (r != pid) { onerr_abort++; ohshite(_("wait for %s failed"),description); }
- checksubprocerr(status,description,sigpipeok);
+ return checksubprocerr(status,description,sigpipeok, warn);
}
ssize_t buffer_write(buffer_data_t data, void *buf, ssize_t length, char *desc) {
}
if (ferror(pf)) ohshite(_("error reading find's pipe"));
if (fclose(pf)) ohshite(_("error closing find's pipe"));
- waitsubproc(fc,"find",0);
+ waitsubproc(fc,"find",0,0);
if (!nfiles)
ohshit(_("searched, but found no packages (files matching *.deb)"));
}
close(p1[1]);
fd_vbuf_copy(fileno(ccpipe), &vb, -1, _("error reading from CC pipe"));
- waitsubproc(c1,"gcc --print-libgcc-file-name",0);
+ waitsubproc(c1,"gcc --print-libgcc-file-name",0,0);
if (!vb.used) badlgccfn(ccompiler,"",_("empty output"));
varbufaddc(&vb,0);
if (vb.buf[vb.used-2] != '\n') badlgccfn(ccompiler,vb.buf,_("no newline"));
ohshite(_("unable to execute %s"),buf);
}
script_catchsignals(); /* This does a push_cleanup() */
- waitsubproc(c1,buf,0);
+ waitsubproc(c1,buf,0,0);
pop_cleanup(ehflag_normaltidy);
ensure_diversions();
ohshite(_("unable to execute new %s"),buf);
}
script_catchsignals(); /* This does a push_cleanup() */
- waitsubproc(c1,buf,0);
+ waitsubproc(c1,buf,0,0);
pop_cleanup(ehflag_normaltidy);
ensure_diversions();
struct stat stab;
int c1, n, status;
char buf[100];
- pid_t r;
+ int r;
oldscriptpath= pkgadminfile(pkg,scriptname);
arglist= buildarglist(scriptname,
ohshite(_("unable to execute %s"),buf);
}
script_catchsignals(); /* This does a push_cleanup() */
- waitsubproc(c1,buf,0);
+ r= waitsubproc(c1,buf,0,1);
pop_cleanup(ehflag_normaltidy);
+ if (!r) return 1;
ensure_diversions();
}
fprintf(stderr, _("dpkg - trying script from the new package instead ...\n"));
ohshite(_("unable to execute %s"),buf);
}
script_catchsignals(); /* This does a push_cleanup() */
- waitsubproc(c1,buf,0);
+ waitsubproc(c1,buf,0,1);
pop_cleanup(ehflag_normaltidy);
fprintf(stderr, _("dpkg: ... it looks like that went OK.\n"));
ohshite(_("failed to exec rm for cleanup"));
}
debug(dbg_eachfile,"ensure_pathname_nonexisting running rm -rf");
- waitsubproc(c1,"rm cleanup",0);
+ waitsubproc(c1,"rm cleanup",0,0);
}
/* No, it wasn't a part. */
break;
default:
- checksubprocerr(status,SPLITTER,0);
+ checksubprocerr(status,SPLITTER,0,0);
}
}
execlp(BACKEND, BACKEND,"--control",filename,cidir,(char*)0);
ohshite(_("failed to exec dpkg-deb to extract control information"));
}
- waitsubproc(c1,BACKEND " --control",0);
+ waitsubproc(c1,BACKEND " --control",0,0);
strcpy(cidirrest,CONTROLFILE);
parsedb(cidir, pdb_recordavailable|pdb_rejectstatus|pdb_ignorefiles|pdb_weakclassification,
}
fd_null_copy(tc.backendpipe,-1,_("dpkg-deb: zap possible trailing zeros"));
close(tc.backendpipe);
- waitsubproc(c1,BACKEND " --fsys-tarfile",1);
+ waitsubproc(c1,BACKEND " --fsys-tarfile",1,0);
if (oldversionstatus == stat_halfinstalled || oldversionstatus == stat_unpacked) {
/* Packages that were in `installed' and `postinstfailed' have been reduced