bin/pax and gzip behavior
Hi all,
after a restless night, the following question: Why doesn't pax
wait for the compress program e.g. gzip to finish before exiting
itself? I'm not sure wether this a bug or feature, but I suppose
its the former.
I run into it by trying to use tla with the native
tar. It does principally the following:
- create scratch area
- tar+gzip scratch area
- copy tarball to other directory.
What happens now is, tar/pax exits, gzip is still writing the file,
the tla just copys the gzip header. This is reproducible using
"touch test; tar czf test.tar test && ls -l test.tar". In some cases
it will show you a zero byte file. Using the attached patch the bug
seems solved.
Regards,
Joerg
--- ar_io.c.orig Tue Jun 3 01:32:08 2003
+++ ar_io.c Wed Aug 27 02:10:15 2003
@@ -336,15 +336,29 @@
/*
* for a quick extract/list, pax frequently exits before the child
* process is done
+ *
+ * this is safe as long as the archive is not modified by the child
+ * process
*/
if ((act == LIST || act == EXTRACT) && nflag && zpid > 0) {
int status;
kill(zpid, SIGINT);
waitpid(zpid, &status, 0);
+ zpid = -1;
}
(void)close(arfd);
+ /*
+ * if there is still a child, pax should not exit before the child
+ * process is done to ensure data integrity
+ */
+ if (zpid > 0)
+ {
+ int status;
+ waitpid(zpid, &status, 0);
+ }
+
if (vflag && (artyp == ISTAPE)) {
(void)fputs("done.\n", listf);
vfpart = 0;
Received on Wed Aug 27 10:04:25 2003
This archive was generated by hypermail 2.1.8
: Wed Aug 23 2006 - 13:48:44 EDT
|