Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | From e391bdba238d1371fc5b67cdae08b06eb5ada5c2 Mon Sep 17 00:00:00 2001 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> |
| 3 | Date: Wed, 26 Aug 2015 15:48:13 +0300 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 4 | Subject: [PATCH] When running do_package_write_deb, we have trees of |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 5 | hardlinked files such as the dbg source files in ${PN}-dbg. If something |
| 6 | makes another copy of one of those files (or deletes one), the number of |
| 7 | links a file has changes and tar can notice this, e.g.: |
| 8 | |
| 9 | | DEBUG: Executing python function do_package_deb |
| 10 | | dpkg-deb: building package `sed-ptest' in `/media/build1/poky/build/tmp/work/i586-poky-linux/sed/4.2.2-r0/deploy-debs/i586/sed-ptest_4.2.2-r0.3_i386.deb'. |
| 11 | | tar: ./usr/lib/sed/ptest/testsuite/tst-regex2: file changed as we read it |
| 12 | | dpkg-deb: error: subprocess tar -cf returned error exit status 1 |
| 13 | |
| 14 | Tar returns an error of 1 when files 'change' and other errors codes |
| 15 | in other error cases. We tweak dpkg-deb here so that it ignores an exit |
| 16 | code of 1 from tar. The files don't really change (and we have locking in |
| 17 | place to avoid that kind of issue). |
| 18 | |
| 19 | Upstream-Status: Inappropriate |
| 20 | RP 2015/3/27 |
| 21 | --- |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 22 | dpkg-deb/build.c | 12 ++++++++---- |
| 23 | 1 file changed, 8 insertions(+), 4 deletions(-) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 24 | |
| 25 | diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 26 | index 2ddeec6..af363f0 100644 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | --- a/dpkg-deb/build.c |
| 28 | +++ b/dpkg-deb/build.c |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 29 | @@ -452,7 +452,7 @@ static void |
| 30 | tarball_pack(const char *dir, filenames_feed_func *tar_filenames_feeder, |
| 31 | struct compress_params *tar_compress_params, int fd_out) |
| 32 | { |
| 33 | - int pipe_filenames[2], pipe_tarball[2]; |
| 34 | + int pipe_filenames[2], pipe_tarball[2], rc; |
| 35 | pid_t pid_tar, pid_comp; |
| 36 | |
| 37 | /* Fork off a tar. We will feed it a list of filenames on stdin later. */ |
| 38 | @@ -493,7 +493,9 @@ tarball_pack(const char *dir, filenames_feed_func *tar_filenames_feeder, |
| 39 | /* All done, clean up wait for tar and <compress> to finish their job. */ |
| 40 | close(pipe_filenames[1]); |
| 41 | subproc_reap(pid_comp, _("<compress> from tar -cf"), 0); |
| 42 | - subproc_reap(pid_tar, "tar -cf", 0); |
| 43 | + rc = subproc_reap(pid_tar, "tar -cf", SUBPROC_RETERROR); |
| 44 | + if (rc && rc != 1) |
| 45 | + ohshite(_("subprocess %s returned error exit status %d"), "tar -cf", rc); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | @@ -509,7 +511,7 @@ do_build(const char *const *argv) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | char *debar; |
| 51 | char *tfbuf; |
| 52 | int arfd; |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 53 | - int p1[2], gzfd; |
| 54 | + int p1[2], gzfd, rc; |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | pid_t c1, c2; |
| 56 | |
| 57 | /* Decode our arguments. */ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 58 | @@ -590,7 +592,9 @@ do_build(const char *const *argv) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 59 | } |
| 60 | close(p1[0]); |
| 61 | subproc_reap(c2, _("<compress> from tar -cf"), 0); |
| 62 | - subproc_reap(c1, "tar -cf", 0); |
| 63 | + rc = subproc_reap(c1, "tar -cf", SUBPROC_RETERROR); |
| 64 | + if (rc && rc != 1) |
| 65 | + ohshite(_("subprocess %s returned error exit status %d"), "tar -cf", rc); |
| 66 | |
| 67 | if (lseek(gzfd, 0, SEEK_SET)) |
| 68 | ohshite(_("failed to rewind temporary file (%s)"), _("control member")); |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 69 | -- |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 70 | 2.7.0 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 71 | |