aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-core/swupd-server
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-03-30 15:53:39 +0200
committerJoshua Lock <joshua.g.lock@intel.com>2016-03-30 21:36:58 +0100
commitb8858968fe846dba40a86e7e61ffe209c4a45334 (patch)
tree6858ea7ad03458f887ec287b77c7d5945190fe70 /recipes-core/swupd-server
parent40e43db58f41779d368abf71e5dcd5e26a5a9149 (diff)
downloadmeta-swupd-b8858968fe846dba40a86e7e61ffe209c4a45334.tar.gz
meta-swupd-b8858968fe846dba40a86e7e61ffe209c4a45334.tar.bz2
meta-swupd-b8858968fe846dba40a86e7e61ffe209c4a45334.zip
swupd-server: work around pseudo xattr hardlink bug
swupd-server relies on hardlinks to create a temporary directory with the original file for the external tar command. Creating hardlinks under pseudo leads to copies which (incorrectly) do not share the original file's xattrs. To work around this bug, we explicitly copy the xattrs. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Diffstat (limited to 'recipes-core/swupd-server')
-rw-r--r--recipes-core/swupd-server/swupd-server/fullfiles.c-work-around-pseudo-bug.patch66
-rw-r--r--recipes-core/swupd-server/swupd-server_2.53.bb1
2 files changed, 67 insertions, 0 deletions
diff --git a/recipes-core/swupd-server/swupd-server/fullfiles.c-work-around-pseudo-bug.patch b/recipes-core/swupd-server/swupd-server/fullfiles.c-work-around-pseudo-bug.patch
new file mode 100644
index 0000000..aa03054
--- /dev/null
+++ b/recipes-core/swupd-server/swupd-server/fullfiles.c-work-around-pseudo-bug.patch
@@ -0,0 +1,66 @@
+From 939a50bf2fec9463fb721fa9188f98e991dfddc9 Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Wed, 30 Mar 2016 13:14:42 +0200
+Subject: [PATCH] fullfiles.c: work around pseudo bug
+
+Hard-linking the actual file looses the xattrs due to a pseudo bug.
+We work around that here by explicitly copying the xattrs.
+
+Upstream-Status: Inappropriate [workaround]
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+---
+ src/fullfiles.c | 30 ++++++++++++++++++++++++++++++
+ 1 file changed, 30 insertions(+)
+
+diff --git a/src/fullfiles.c b/src/fullfiles.c
+index fa78293..949d8f0 100644
+--- a/src/fullfiles.c
++++ b/src/fullfiles.c
+@@ -29,6 +29,7 @@
+ #include <assert.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <sys/xattr.h>
+ #include <stdint.h>
+ #include <errno.h>
+ #include <libgen.h>
+@@ -144,6 +145,35 @@ static void create_fullfile(struct file *file)
+ }
+ }
+
++ /* step 1a: work around pseudo bug https://bugzilla.yoctoproject.org/show_bug.cgi?id=9317:
++ pseudo fails to share xattrs between files sharing the same inode. We have to copy
++ all xattrs explicitly. */
++ {
++ /* Intentionally simplistic code with static buffer sizes.
++ Pseudo bug fix is scheduled for the near future. */
++ char list[1024];
++ char *name;
++ ssize_t listsize;
++ listsize = llistxattr(origin, list, sizeof(list));
++ if (listsize < 0) {
++ fprintf(stderr, "Copying xattrs: llistxattr(%s): %s\n", origin, strerror(errno));
++ assert(0);
++ }
++ for (name = list; name < list + listsize; name += strlen(name) + 1) {
++ char value[2048];
++ ssize_t valuesize;
++ valuesize = lgetxattr(origin, name, value, sizeof(value));
++ if (valuesize < 0) {
++ fprintf(stderr, "Copying xattrs: lgetxattr(%s): %s\n", origin, strerror(errno));
++ assert(0);
++ }
++ if (lsetxattr(tempfile, name, value, valuesize, 0)) {
++ fprintf(stderr, "Copying xattrs: lsetxattr(%s, %s): %s\n", tempfile, name, strerror(errno));
++ assert(0);
++ }
++ }
++ }
++
+ /* step 2a: tar it with each compression type */
+ // lzma
+ string_or_die(&tarcommand, "tar --directory=%s " TAR_PERM_ATTR_ARGS " -Jcf %s/%i/files/%s.tar.xz %s",
+--
+2.1.4
+
diff --git a/recipes-core/swupd-server/swupd-server_2.53.bb b/recipes-core/swupd-server/swupd-server_2.53.bb
index 321fadc..3f8a4e2 100644
--- a/recipes-core/swupd-server/swupd-server_2.53.bb
+++ b/recipes-core/swupd-server/swupd-server_2.53.bb
@@ -16,6 +16,7 @@ SRC_URI = "\
file://0007-Clean-up-tar-options-drop-a-for-the-extract-mode.patch \
file://0008-Clean-up-tar-commands-always-put-files-after-options.patch \
file://0009-Add-compatibility-with-libarchive-s-bsdtar-command.patch \
+ file://fullfiles.c-work-around-pseudo-bug.patch \
"
SRC_URI[md5sum] = "14f25677b5a4f0b33785910b03860939"