Bug#893557: thin-provisioning-tools: FTBFS with glibc 2.17

Steve Langasek steve.langasek at canonical.com
Mon Mar 19 21:19:40 UTC 2018


Package: thin-provisioning-tools
Version: 0.7.4-2
Severity: important
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch

Hi Bastian,

In Ubuntu, thin-provisioning-tools 0.7.4-2 fails to build on ppc64el with an
ICE in the compiler while building the test suite.  An strace implies that
this is because your LD_PRELOAD wrapper has interposed open(), but not
openat().

If I extend the wrapper as in the attached patch to cover openat(), the
package now builds.

This build failure is probably not reproducible yet in Debian, but I expect
it will be once Debian moves to glibc 2.17.

I briefly looked at whether your custom LD_PRELOAD wrapper could be replaced
with libeatmydata, but I see that libeatmydata only handles O_SYNC and
O_DSYNC, not O_DIRECT.  Do you think it would make sense to ask libeatmydata
to filter O_DIRECT as well, to reduce the need for maintaining this separate
.so?

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru thin-provisioning-tools-0.7.4/debian/control thin-provisioning-tools-0.7.4/debian/control
--- thin-provisioning-tools-0.7.4/debian/control	2017-11-01 14:50:39.000000000 -0700
+++ thin-provisioning-tools-0.7.4/debian/control	2018-03-19 14:10:28.000000000 -0700
@@ -1,8 +1,7 @@
 Source: thin-provisioning-tools
 Section: admin
 Priority: optional
-Maintainer: Ubuntu Developers <ubuntu-devel-discuss at lists.ubuntu.com>
-XSBC-Original-Maintainer: Debian LVM Team <pkg-lvm-maintainers at lists.alioth.debian.org>
+Maintainer: Debian LVM Team <pkg-lvm-maintainers at lists.alioth.debian.org>
 Uploaders: Bastian Blank <waldi at debian.org>
 Build-Depends:
  debhelper (>= 9),
diff -Nru thin-provisioning-tools-0.7.4/debian/unit-tests/preload.c thin-provisioning-tools-0.7.4/debian/unit-tests/preload.c
--- thin-provisioning-tools-0.7.4/debian/unit-tests/preload.c	2017-11-01 14:50:39.000000000 -0700
+++ thin-provisioning-tools-0.7.4/debian/unit-tests/preload.c	2018-03-19 14:10:17.000000000 -0700
@@ -4,13 +4,17 @@
 #include <stdarg.h>
 #include <stdlib.h>
 
-static int (*orig_open)(const char *pathname, int flags, int mode);
+static int (*orig_open)(const char *pathname, int flags, mode_t mode);
+static int (*orig_openat)(int dirfd, const char *pathname, int flags, mode_t mode);
 
 __attribute__((constructor))
 static void constructor() {
   orig_open = dlsym(RTLD_NEXT, "open");
   if (!orig_open)
     abort();
+  orig_openat = dlsym(RTLD_NEXT, "openat");
+  if (!orig_openat)
+    abort();
 }
 
 int open(const char *file, int oflag, ...) {
@@ -51,3 +55,34 @@
 int __open64_2(const char *file, int oflag) {
   return orig_open(file, (oflag & ~O_DIRECT) | O_LARGEFILE, 0);
 }
+
+int openat(int dirfd, const char *file, int oflag, ...) {
+  int mode = 0;
+
+  oflag &= ~O_DIRECT;
+
+  if (oflag & O_CREAT) {
+    va_list arg;
+    va_start(arg, oflag);
+    mode = va_arg(arg, int);
+    va_end(arg);
+  }
+
+  return orig_openat(dirfd, file, oflag, mode);
+}
+
+int openat64(int dirfd, const char *file, int oflag, ...) {
+  int mode = 0;
+
+  oflag |= O_LARGEFILE;
+  oflag &= ~O_DIRECT;
+
+  if (oflag & O_CREAT) {
+    va_list arg;
+    va_start(arg, oflag);
+    mode = va_arg(arg, int);
+    va_end(arg);
+  }
+
+  return orig_openat(dirfd, file, oflag, mode);
+}


More information about the pkg-lvm-maintainers mailing list