Whamcloud - gitweb
LU-13855 tests: remove the need for libiberty 02/40802/11
authorAndreas Dilger <adilger@whamcloud.com>
Mon, 30 Nov 2020 20:35:46 +0000 (13:35 -0700)
committerOleg Drokin <green@whamcloud.com>
Sun, 13 Dec 2020 08:23:46 +0000 (08:23 +0000)
The statx.c test program uses a bunch of GNU-specific xstr*
functions that have very little, if any, benefit to the code.
They allocate copies of static format strings, but those
strings are not modified, and are never freed.  Since the
use of xstr* drags in libiberty and associated build issues
on a variety of platforms, instead avoid those functions.

Remove the use of this library completely from the statx.c
test tool, with minimal replacements to keep the build happy.
Remove the corresponding configure checks.

Fixes: 3f7853b31ef6 ("LU-10934 llite: integrate statx() API with Lustre")
Test-Parameters: trivial testlist=sanityn env=ONLY=106 clientdistro=ubuntu2004
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I2c11bac8e2a4b4754ee78caabfa9cbdba98bffff
Reviewed-on: https://review.whamcloud.com/40802
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
config/lustre-build.m4
debian/control
debian/control.main
lustre/tests/Makefile.am
lustre/tests/statx.c

index ad23218..a4abb21 100644 (file)
@@ -440,7 +440,6 @@ AM_CONDITIONAL([RHEL], [test -f /etc/redhat-release])
 AM_CONDITIONAL([SUSE], [test -f /etc/SUSE-brand -o -f /etc/SuSE-release])
 AM_CONDITIONAL([UBUNTU], [test x$UBUNTU_KERNEL = xyes])
 AM_CONDITIONAL([BUILD_LUTF], [test x$enable_lutf = xyes])
-AM_CONDITIONAL([LIBIBERTY_SUBDIR], [test -d /usr/include/libiberty])
 
 LN_CONDITIONALS
 LC_CONDITIONALS
index 7bfa5b7..ead0fdd 100644 (file)
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Brian J. Murrell <brian.murrell@intel.com>
 Uploaders: Brian J. Murrell <brian.murrell@intel.com>
 Standards-Version: 3.8.3
-Build-Depends: module-assistant, libreadline-dev, debhelper (>=9.0.0), dpatch, automake (>=1.7) | automake1.7 | automake1.8 | automake1.9, pkg-config, libtool, libyaml-dev, libselinux-dev, libsnmp-dev, mpi-default-dev, bzip2, quilt, linux-headers-generic | linux-headers | linux-headers-amd64, rsync, libssl-dev, libiberty-dev
+Build-Depends: module-assistant, libreadline-dev, debhelper (>=9.0.0), dpatch, automake (>=1.7) | automake1.7 | automake1.8 | automake1.9, pkg-config, libtool, libyaml-dev, libselinux-dev, libsnmp-dev, mpi-default-dev, bzip2, quilt, linux-headers-generic | linux-headers | linux-headers-amd64, rsync, libssl-dev
 Homepage: https://wiki.whamcloud.com/
 Vcs-Git: git://git.whamcloud.com/fs/lustre-release.git
 
index 7bfa5b7..ead0fdd 100644 (file)
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Brian J. Murrell <brian.murrell@intel.com>
 Uploaders: Brian J. Murrell <brian.murrell@intel.com>
 Standards-Version: 3.8.3
-Build-Depends: module-assistant, libreadline-dev, debhelper (>=9.0.0), dpatch, automake (>=1.7) | automake1.7 | automake1.8 | automake1.9, pkg-config, libtool, libyaml-dev, libselinux-dev, libsnmp-dev, mpi-default-dev, bzip2, quilt, linux-headers-generic | linux-headers | linux-headers-amd64, rsync, libssl-dev, libiberty-dev
+Build-Depends: module-assistant, libreadline-dev, debhelper (>=9.0.0), dpatch, automake (>=1.7) | automake1.7 | automake1.8 | automake1.9, pkg-config, libtool, libyaml-dev, libselinux-dev, libsnmp-dev, mpi-default-dev, bzip2, quilt, linux-headers-generic | linux-headers | linux-headers-amd64, rsync, libssl-dev
 Homepage: https://wiki.whamcloud.com/
 Vcs-Git: git://git.whamcloud.com/fs/lustre-release.git
 
index 4890031..f736fca 100644 (file)
@@ -117,8 +117,5 @@ check_fallocate_LDADD = $(LIBLUSTREAPI)
 if LIBAIO
 aiocp_LDADD= -laio
 endif
-if LIBIBERTY_SUBDIR
-statx_CPPFLAGS := -I/usr/include/libiberty
-endif
-statx_LDADD = $(SELINUX) -liberty
+statx_LDADD = $(SELINUX)
 endif # TESTS
index a3fbbeb..d5c2e88 100644 (file)
@@ -50,7 +50,6 @@
 #include <inttypes.h>
 #include <fcntl.h>
 #include <locale.h>
-#include <libiberty.h>
 #include <linux/lustre/lustre_user.h>
 
 #ifdef HAVE_SELINUX
@@ -86,6 +85,21 @@ ssize_t statx(int dfd, const char *filename, int flags,
 }
 #endif /* HAVE_STATX */
 
+#define xstrdup(str) strdup(str)
+static inline
+char *xasprintf(const char *fmt, const char *old_fmt, const char *str)
+{
+       char *tmp = NULL;
+
+       if (asprintf(&tmp, fmt, old_fmt, str) < 0) {
+               fprintf(stderr, "asprintf allocation failed\n");
+               exit(1);
+       }
+
+       return tmp;
+}
+
+
 /* coreutils/lib/intprops.h */
 #define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED(__typeof__(t))