0001-build.c-ignore-return-of-1-from-tar-cf.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From 15b081cc8bead80c493ab83369ecb3345a24a3dc Mon Sep 17 00:00:00 2001
  2. From: Paul Eggleton <paul.eggleton@linux.microsoft.com>
  3. Date: Tue, 16 Jun 2020 03:57:25 +0000
  4. Subject: [PATCH] build.c: ignore return of 1 from tar -cf
  5. When running do_package_write_deb, we have trees of hardlinked files
  6. such as the dbg source files in ${PN}-dbg. If something makes another
  7. copy of one of those files (or deletes one), the number of links a file
  8. has changes and tar can notice this, e.g.:
  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. Tar returns an error of 1 when files 'change' and other errors codes
  14. in other error cases. We tweak dpkg-deb here so that it ignores an exit
  15. code of 1 from tar. The files don't really change (and we have locking in
  16. place to avoid that kind of issue).
  17. Upstream-Status: Inappropriate [OE specific]
  18. Original patch by RP 2015/3/27, rebased by Paul Eggleton
  19. Signed-off-by: Paul Eggleton <paul.eggleton@microsoft.com>
  20. ---
  21. dpkg-deb/build.c | 5 ++++-
  22. 1 file changed, 4 insertions(+), 1 deletion(-)
  23. diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
  24. index 8436839cd..6b44a36f7 100644
  25. --- a/dpkg-deb/build.c
  26. +++ b/dpkg-deb/build.c
  27. @@ -434,6 +434,7 @@ tarball_pack(const char *dir, filenames_feed_func *tar_filenames_feeder,
  28. {
  29. int pipe_filenames[2], pipe_tarball[2];
  30. pid_t pid_tar, pid_comp;
  31. + int rc;
  32. /* Fork off a tar. We will feed it a list of filenames on stdin later. */
  33. m_pipe(pipe_filenames);
  34. @@ -486,7 +487,9 @@ tarball_pack(const char *dir, filenames_feed_func *tar_filenames_feeder,
  35. /* All done, clean up wait for tar and <compress> to finish their job. */
  36. close(pipe_filenames[1]);
  37. subproc_reap(pid_comp, _("<compress> from tar -cf"), 0);
  38. - subproc_reap(pid_tar, "tar -cf", 0);
  39. + rc = subproc_reap(pid_tar, "tar -cf", SUBPROC_RETERROR);
  40. + if (rc && rc != 1)
  41. + ohshite(_("subprocess %s returned error exit status %d"), "tar -cf", rc);
  42. }
  43. static time_t