strace/SOURCES/0143-tests-introduce-create...

1271 lines
44 KiB
Diff

From 8f4f1f846588e9016b546889466b8bfb92b8c116 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Thu, 1 Apr 2021 08:00:00 +0000
Subject: [PATCH 143/149] tests: introduce create_and_enter_subdir and
leave_and_remove_subdir
Introduce the pair of functions that is going to be used to make sure
the current workdir of the tracee is different from the current workdir
of the tracer.
Use the new interface in a few tests where the difference is going to be
relevant with --secontext option.
* tests/subdir.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add subdir.c.
* tests/tests.h (create_and_enter_subdir, leave_and_remove_subdir):
New function prototypes.
* tests/access.c (main): Use create_and_enter_subdir and
leave_and_remove_subdir.
* tests/chmod.c (main): Likewise.
* tests/execve.c (main): Likewise.
* tests/fchmod.c (main): Likewise.
* tests/fchmodat.c (main): Likewise.
* tests/fchownat.c (main): Likewise.
* tests/linkat.c (main): Likewise.
* tests/open.c (main): Likewise.
* tests/openat.c (main): Likewise.
Conflicts:
tests/execve.c
---
tests/Makefile.am | 1 +
tests/access.c | 10 +++++++++-
tests/chmod.c | 9 ++++++++-
tests/execve.c | 12 ++++++++++--
tests/fchmod.c | 8 ++++++++
tests/fchmodat.c | 9 ++++++++-
tests/fchownat.c | 8 ++++++++
tests/linkat.c | 10 +++++++++-
tests/open.c | 8 ++++++++
tests/openat.c | 10 +++++++++-
tests/subdir.c | 40 ++++++++++++++++++++++++++++++++++++++++
tests/tests.h | 12 ++++++++++++
12 files changed, 130 insertions(+), 7 deletions(-)
create mode 100644 tests/subdir.c
Index: strace-5.7/tests/Makefile.am
===================================================================
--- strace-5.7.orig/tests/Makefile.am 2021-08-24 19:42:08.850580847 +0200
+++ strace-5.7/tests/Makefile.am 2021-08-24 19:42:16.041519983 +0200
@@ -58,6 +58,7 @@
skip_unavailable.c \
sprintrc.c \
status.c \
+ subdir.c \
tail_alloc.c \
test_netlink.h \
test_nlattr.h \
Index: strace-5.7/tests/access.c
===================================================================
--- strace-5.7.orig/tests/access.c 2021-08-24 19:42:08.851580838 +0200
+++ strace-5.7/tests/access.c 2021-08-24 19:42:16.041519983 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019 The strace developers.
+ * Copyright (c) 2016-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -16,6 +16,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("access_subdir");
+
static const char sample[] = "access_sample";
long rc = syscall(__NR_access, sample, F_OK);
@@ -26,6 +32,8 @@
printf("access(\"%s\", R_OK|W_OK|X_OK) = %ld %s (%m)\n",
sample, rc, errno2name());
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests/chmod.c
===================================================================
--- strace-5.7.orig/tests/chmod.c 2021-08-24 19:42:08.851580838 +0200
+++ strace-5.7/tests/chmod.c 2021-08-24 19:42:16.042519974 +0200
@@ -15,11 +15,16 @@
# include <fcntl.h>
# include <stdio.h>
# include <unistd.h>
-# include <errno.h>
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("chmod_subdir");
+
static const char fname[] = "chmod_test_file";
if (open(fname, O_CREAT|O_RDONLY, 0400) < 0)
@@ -37,6 +42,8 @@
rc = syscall(__NR_chmod, fname, 004);
printf("chmod(\"%s\", 004) = %s\n", fname, sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests/execve.c
===================================================================
--- strace-5.7.orig/tests/execve.c 2021-08-24 19:42:08.851580838 +0200
+++ strace-5.7/tests/execve.c 2021-08-24 19:42:16.042519974 +0200
@@ -1,8 +1,8 @@
/*
* This file is part of execve strace test.
*
- * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
- * Copyright (c) 2015-2018 The strace developers.
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@strace.io>
+ * Copyright (c) 2015-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -34,6 +34,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("execve_subdir");
+
char ** const tail_argv = tail_memdup(argv, sizeof(argv));
char ** const tail_envp = tail_memdup(envp, sizeof(envp));
@@ -167,5 +173,7 @@
printf("execve(\"%s\", %p, NULL) = -1 ENOENT (%m)\n",
Q_FILENAME, efault);
+ leave_and_remove_subdir();
+
return 0;
}
Index: strace-5.7/tests/fchmod.c
===================================================================
--- strace-5.7.orig/tests/fchmod.c 2021-08-24 19:42:08.851580838 +0200
+++ strace-5.7/tests/fchmod.c 2021-08-24 19:42:16.042519974 +0200
@@ -21,6 +21,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("fchmod_subdir");
+
static const char sample[] = "fchmod_sample_file";
(void) unlink(sample);
int fd = open(sample, O_CREAT|O_RDONLY, 0400);
@@ -70,6 +76,8 @@
# endif
sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests/fchmodat.c
===================================================================
--- strace-5.7.orig/tests/fchmodat.c 2021-08-24 19:42:08.851580838 +0200
+++ strace-5.7/tests/fchmodat.c 2021-08-24 19:42:16.043519966 +0200
@@ -14,13 +14,18 @@
#ifdef __NR_fchmodat
# include <fcntl.h>
-# include <sys/stat.h>
# include <stdio.h>
# include <unistd.h>
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("fchmodat_subdir");
+
static const char sample[] = "fchmodat_sample";
if (open(sample, O_RDONLY | O_CREAT, 0400) < 0)
@@ -41,6 +46,8 @@
printf("fchmodat(AT_FDCWD, \"%s\", 004) = %s\n",
sample, sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests/fchownat.c
===================================================================
--- strace-5.7.orig/tests/fchownat.c 2021-08-24 19:42:08.852580830 +0200
+++ strace-5.7/tests/fchownat.c 2021-08-24 19:42:16.043519966 +0200
@@ -20,6 +20,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("fchownat_subdir");
+
static const char sample[] = "fchownat_sample";
uid_t uid = geteuid();
uid_t gid = getegid();
@@ -39,6 +45,8 @@
printf("fchownat(AT_FDCWD, \"%s\", -1, -1, AT_SYMLINK_NOFOLLOW) = %s\n",
sample, sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests/linkat.c
===================================================================
--- strace-5.7.orig/tests/linkat.c 2021-08-24 19:42:08.852580830 +0200
+++ strace-5.7/tests/linkat.c 2021-08-24 19:42:16.043519966 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019 The strace developers.
+ * Copyright (c) 2016-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -16,6 +16,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("linkat_subdir");
+
static const char sample_1[] = "linkat_sample_old";
static const char sample_2[] = "linkat_sample_new";
const long fd_old = (long) 0xdeadbeefffffffffULL;
@@ -33,6 +39,8 @@
"|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|AT_RECURSIVE|0xffff60ff",
rc, errno2name());
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests/open.c
===================================================================
--- strace-5.7.orig/tests/open.c 2021-08-24 19:42:08.852580830 +0200
+++ strace-5.7/tests/open.c 2021-08-24 19:42:16.044519958 +0200
@@ -18,6 +18,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("open_subdir");
+
static const char sample[] = "open.sample";
long fd = syscall(__NR_open, sample, O_RDONLY|O_CREAT, 0400);
@@ -43,6 +49,8 @@
sample, sprintrc(fd));
# endif /* O_TMPFILE */
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests/openat.c
===================================================================
--- strace-5.7.orig/tests/openat.c 2021-08-24 19:42:08.852580830 +0200
+++ strace-5.7/tests/openat.c 2021-08-24 19:42:16.044519958 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016 Katerina Koukiou <k.koukiou@gmail.com>
- * Copyright (c) 2016-2019 The strace developers.
+ * Copyright (c) 2016-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -39,6 +39,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("openat_subdir");
+
long fd = syscall(__NR_openat, -100, sample, O_RDONLY|O_CREAT, 0400);
printf("openat(AT_FDCWD, \"%s\", O_RDONLY|O_CREAT, 0400) = %s\n",
sample, sprintrc(fd));
@@ -101,6 +107,8 @@
test_mode_flag(modes[m].val, modes[m].str,
flags[f].val, flags[f].str);
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests/subdir.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.7/tests/subdir.c 2021-08-24 19:42:16.044519958 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2021 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "tests.h"
+
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+static const char *subdir;
+static DIR *dirp;
+
+void
+create_and_enter_subdir(const char *name)
+{
+ dirp = opendir(".");
+ if (!dirp)
+ perror_msg_and_fail("opendir: %s", ".");
+ (void) mkdir(name, 0700);
+ if (chdir(name))
+ perror_msg_and_fail("chdir: %s", name);
+ subdir = name;
+}
+
+void
+leave_and_remove_subdir(void)
+{
+ if (fchdir(dirfd(dirp)))
+ perror_msg_and_fail("fchdir: %d", dirfd(dirp));
+ if (closedir(dirp))
+ perror_msg_and_fail("closedir");
+ dirp = 0;
+ if (rmdir(subdir))
+ perror_msg_and_fail("rmdir: %s", subdir);
+ subdir = 0;
+}
Index: strace-5.7/tests/tests.h
===================================================================
--- strace-5.7.orig/tests/tests.h 2021-08-24 19:42:08.852580830 +0200
+++ strace-5.7/tests/tests.h 2021-08-24 19:42:16.045519949 +0200
@@ -161,6 +161,18 @@
char *get_fd_path(int fd) ATTRIBUTE_MALLOC;
/*
+ * Create the specified directory and chdir into it,
+ * die on chdir failure.
+ */
+void create_and_enter_subdir(const char *subdir);
+
+/*
+ * Leave from the directory entered by create_and_enter_subdir,
+ * remove that directory, die on failure.
+ */
+void leave_and_remove_subdir(void);
+
+/*
* Obtain an exclusive lock on dirname(path_name)/lock_name file
* using open and flock.
*/
Index: strace-5.7/tests-m32/Makefile.am
===================================================================
--- strace-5.7.orig/tests-m32/Makefile.am 2021-08-24 19:42:08.853580821 +0200
+++ strace-5.7/tests-m32/Makefile.am 2021-08-24 19:42:16.045519949 +0200
@@ -58,6 +58,7 @@
skip_unavailable.c \
sprintrc.c \
status.c \
+ subdir.c \
tail_alloc.c \
test_netlink.h \
test_nlattr.h \
Index: strace-5.7/tests-m32/access.c
===================================================================
--- strace-5.7.orig/tests-m32/access.c 2021-08-24 19:42:08.853580821 +0200
+++ strace-5.7/tests-m32/access.c 2021-08-24 19:42:16.045519949 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019 The strace developers.
+ * Copyright (c) 2016-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -16,6 +16,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("access_subdir");
+
static const char sample[] = "access_sample";
long rc = syscall(__NR_access, sample, F_OK);
@@ -26,6 +32,8 @@
printf("access(\"%s\", R_OK|W_OK|X_OK) = %ld %s (%m)\n",
sample, rc, errno2name());
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-m32/chmod.c
===================================================================
--- strace-5.7.orig/tests-m32/chmod.c 2021-08-24 19:42:08.853580821 +0200
+++ strace-5.7/tests-m32/chmod.c 2021-08-24 19:42:16.046519941 +0200
@@ -15,11 +15,16 @@
# include <fcntl.h>
# include <stdio.h>
# include <unistd.h>
-# include <errno.h>
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("chmod_subdir");
+
static const char fname[] = "chmod_test_file";
if (open(fname, O_CREAT|O_RDONLY, 0400) < 0)
@@ -37,6 +42,8 @@
rc = syscall(__NR_chmod, fname, 004);
printf("chmod(\"%s\", 004) = %s\n", fname, sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-m32/execve.c
===================================================================
--- strace-5.7.orig/tests-m32/execve.c 2021-08-24 19:42:08.853580821 +0200
+++ strace-5.7/tests-m32/execve.c 2021-08-24 19:42:16.046519941 +0200
@@ -1,8 +1,8 @@
/*
* This file is part of execve strace test.
*
- * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
- * Copyright (c) 2015-2018 The strace developers.
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@strace.io>
+ * Copyright (c) 2015-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -34,6 +34,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("execve_subdir");
+
char ** const tail_argv = tail_memdup(argv, sizeof(argv));
char ** const tail_envp = tail_memdup(envp, sizeof(envp));
@@ -167,5 +173,7 @@
printf("execve(\"%s\", %p, NULL) = -1 ENOENT (%m)\n",
Q_FILENAME, efault);
+ leave_and_remove_subdir();
+
return 0;
}
Index: strace-5.7/tests-m32/fchmod.c
===================================================================
--- strace-5.7.orig/tests-m32/fchmod.c 2021-08-24 19:42:08.853580821 +0200
+++ strace-5.7/tests-m32/fchmod.c 2021-08-24 19:42:16.046519941 +0200
@@ -21,6 +21,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("fchmod_subdir");
+
static const char sample[] = "fchmod_sample_file";
(void) unlink(sample);
int fd = open(sample, O_CREAT|O_RDONLY, 0400);
@@ -70,6 +76,8 @@
# endif
sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-m32/fchmodat.c
===================================================================
--- strace-5.7.orig/tests-m32/fchmodat.c 2021-08-24 19:42:08.854580813 +0200
+++ strace-5.7/tests-m32/fchmodat.c 2021-08-24 19:42:16.046519941 +0200
@@ -14,13 +14,18 @@
#ifdef __NR_fchmodat
# include <fcntl.h>
-# include <sys/stat.h>
# include <stdio.h>
# include <unistd.h>
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("fchmodat_subdir");
+
static const char sample[] = "fchmodat_sample";
if (open(sample, O_RDONLY | O_CREAT, 0400) < 0)
@@ -41,6 +46,8 @@
printf("fchmodat(AT_FDCWD, \"%s\", 004) = %s\n",
sample, sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-m32/fchownat.c
===================================================================
--- strace-5.7.orig/tests-m32/fchownat.c 2021-08-24 19:42:08.854580813 +0200
+++ strace-5.7/tests-m32/fchownat.c 2021-08-24 19:42:16.047519932 +0200
@@ -20,6 +20,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("fchownat_subdir");
+
static const char sample[] = "fchownat_sample";
uid_t uid = geteuid();
uid_t gid = getegid();
@@ -39,6 +45,8 @@
printf("fchownat(AT_FDCWD, \"%s\", -1, -1, AT_SYMLINK_NOFOLLOW) = %s\n",
sample, sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-m32/linkat.c
===================================================================
--- strace-5.7.orig/tests-m32/linkat.c 2021-08-24 19:42:08.854580813 +0200
+++ strace-5.7/tests-m32/linkat.c 2021-08-24 19:42:16.047519932 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019 The strace developers.
+ * Copyright (c) 2016-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -16,6 +16,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("linkat_subdir");
+
static const char sample_1[] = "linkat_sample_old";
static const char sample_2[] = "linkat_sample_new";
const long fd_old = (long) 0xdeadbeefffffffffULL;
@@ -33,6 +39,8 @@
"|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|AT_RECURSIVE|0xffff60ff",
rc, errno2name());
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-m32/open.c
===================================================================
--- strace-5.7.orig/tests-m32/open.c 2021-08-24 19:42:08.854580813 +0200
+++ strace-5.7/tests-m32/open.c 2021-08-24 19:42:16.047519932 +0200
@@ -18,6 +18,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("open_subdir");
+
static const char sample[] = "open.sample";
long fd = syscall(__NR_open, sample, O_RDONLY|O_CREAT, 0400);
@@ -43,6 +49,8 @@
sample, sprintrc(fd));
# endif /* O_TMPFILE */
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-m32/openat.c
===================================================================
--- strace-5.7.orig/tests-m32/openat.c 2021-08-24 19:42:08.854580813 +0200
+++ strace-5.7/tests-m32/openat.c 2021-08-24 19:42:16.047519932 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016 Katerina Koukiou <k.koukiou@gmail.com>
- * Copyright (c) 2016-2019 The strace developers.
+ * Copyright (c) 2016-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -39,6 +39,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("openat_subdir");
+
long fd = syscall(__NR_openat, -100, sample, O_RDONLY|O_CREAT, 0400);
printf("openat(AT_FDCWD, \"%s\", O_RDONLY|O_CREAT, 0400) = %s\n",
sample, sprintrc(fd));
@@ -101,6 +107,8 @@
test_mode_flag(modes[m].val, modes[m].str,
flags[f].val, flags[f].str);
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-m32/subdir.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.7/tests-m32/subdir.c 2021-08-24 19:42:16.048519924 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2021 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "tests.h"
+
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+static const char *subdir;
+static DIR *dirp;
+
+void
+create_and_enter_subdir(const char *name)
+{
+ dirp = opendir(".");
+ if (!dirp)
+ perror_msg_and_fail("opendir: %s", ".");
+ (void) mkdir(name, 0700);
+ if (chdir(name))
+ perror_msg_and_fail("chdir: %s", name);
+ subdir = name;
+}
+
+void
+leave_and_remove_subdir(void)
+{
+ if (fchdir(dirfd(dirp)))
+ perror_msg_and_fail("fchdir: %d", dirfd(dirp));
+ if (closedir(dirp))
+ perror_msg_and_fail("closedir");
+ dirp = 0;
+ if (rmdir(subdir))
+ perror_msg_and_fail("rmdir: %s", subdir);
+ subdir = 0;
+}
Index: strace-5.7/tests-m32/tests.h
===================================================================
--- strace-5.7.orig/tests-m32/tests.h 2021-08-24 19:42:08.855580804 +0200
+++ strace-5.7/tests-m32/tests.h 2021-08-24 19:42:16.048519924 +0200
@@ -161,6 +161,18 @@
char *get_fd_path(int fd) ATTRIBUTE_MALLOC;
/*
+ * Create the specified directory and chdir into it,
+ * die on chdir failure.
+ */
+void create_and_enter_subdir(const char *subdir);
+
+/*
+ * Leave from the directory entered by create_and_enter_subdir,
+ * remove that directory, die on failure.
+ */
+void leave_and_remove_subdir(void);
+
+/*
* Obtain an exclusive lock on dirname(path_name)/lock_name file
* using open and flock.
*/
Index: strace-5.7/tests-mx32/Makefile.am
===================================================================
--- strace-5.7.orig/tests-mx32/Makefile.am 2021-08-24 19:42:08.855580804 +0200
+++ strace-5.7/tests-mx32/Makefile.am 2021-08-24 19:42:16.048519924 +0200
@@ -58,6 +58,7 @@
skip_unavailable.c \
sprintrc.c \
status.c \
+ subdir.c \
tail_alloc.c \
test_netlink.h \
test_nlattr.h \
Index: strace-5.7/tests-mx32/access.c
===================================================================
--- strace-5.7.orig/tests-mx32/access.c 2021-08-24 19:42:08.855580804 +0200
+++ strace-5.7/tests-mx32/access.c 2021-08-24 19:42:16.048519924 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019 The strace developers.
+ * Copyright (c) 2016-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -16,6 +16,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("access_subdir");
+
static const char sample[] = "access_sample";
long rc = syscall(__NR_access, sample, F_OK);
@@ -26,6 +32,8 @@
printf("access(\"%s\", R_OK|W_OK|X_OK) = %ld %s (%m)\n",
sample, rc, errno2name());
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-mx32/chmod.c
===================================================================
--- strace-5.7.orig/tests-mx32/chmod.c 2021-08-24 19:42:08.855580804 +0200
+++ strace-5.7/tests-mx32/chmod.c 2021-08-24 19:42:16.049519915 +0200
@@ -15,11 +15,16 @@
# include <fcntl.h>
# include <stdio.h>
# include <unistd.h>
-# include <errno.h>
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("chmod_subdir");
+
static const char fname[] = "chmod_test_file";
if (open(fname, O_CREAT|O_RDONLY, 0400) < 0)
@@ -37,6 +42,8 @@
rc = syscall(__NR_chmod, fname, 004);
printf("chmod(\"%s\", 004) = %s\n", fname, sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-mx32/execve.c
===================================================================
--- strace-5.7.orig/tests-mx32/execve.c 2021-08-24 19:42:08.855580804 +0200
+++ strace-5.7/tests-mx32/execve.c 2021-08-24 19:42:16.049519915 +0200
@@ -1,8 +1,8 @@
/*
* This file is part of execve strace test.
*
- * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
- * Copyright (c) 2015-2018 The strace developers.
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@strace.io>
+ * Copyright (c) 2015-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -34,6 +34,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("execve_subdir");
+
char ** const tail_argv = tail_memdup(argv, sizeof(argv));
char ** const tail_envp = tail_memdup(envp, sizeof(envp));
@@ -167,5 +173,7 @@
printf("execve(\"%s\", %p, NULL) = -1 ENOENT (%m)\n",
Q_FILENAME, efault);
+ leave_and_remove_subdir();
+
return 0;
}
Index: strace-5.7/tests-mx32/fchmod.c
===================================================================
--- strace-5.7.orig/tests-mx32/fchmod.c 2021-08-24 19:42:08.856580796 +0200
+++ strace-5.7/tests-mx32/fchmod.c 2021-08-24 19:42:16.049519915 +0200
@@ -21,6 +21,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("fchmod_subdir");
+
static const char sample[] = "fchmod_sample_file";
(void) unlink(sample);
int fd = open(sample, O_CREAT|O_RDONLY, 0400);
@@ -70,6 +76,8 @@
# endif
sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-mx32/fchmodat.c
===================================================================
--- strace-5.7.orig/tests-mx32/fchmodat.c 2021-08-24 19:42:08.856580796 +0200
+++ strace-5.7/tests-mx32/fchmodat.c 2021-08-24 19:42:16.049519915 +0200
@@ -14,13 +14,18 @@
#ifdef __NR_fchmodat
# include <fcntl.h>
-# include <sys/stat.h>
# include <stdio.h>
# include <unistd.h>
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("fchmodat_subdir");
+
static const char sample[] = "fchmodat_sample";
if (open(sample, O_RDONLY | O_CREAT, 0400) < 0)
@@ -41,6 +46,8 @@
printf("fchmodat(AT_FDCWD, \"%s\", 004) = %s\n",
sample, sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-mx32/fchownat.c
===================================================================
--- strace-5.7.orig/tests-mx32/fchownat.c 2021-08-24 19:42:08.856580796 +0200
+++ strace-5.7/tests-mx32/fchownat.c 2021-08-24 19:42:16.050519907 +0200
@@ -20,6 +20,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("fchownat_subdir");
+
static const char sample[] = "fchownat_sample";
uid_t uid = geteuid();
uid_t gid = getegid();
@@ -39,6 +45,8 @@
printf("fchownat(AT_FDCWD, \"%s\", -1, -1, AT_SYMLINK_NOFOLLOW) = %s\n",
sample, sprintrc(rc));
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-mx32/linkat.c
===================================================================
--- strace-5.7.orig/tests-mx32/linkat.c 2021-08-24 19:42:08.856580796 +0200
+++ strace-5.7/tests-mx32/linkat.c 2021-08-24 19:42:16.050519907 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019 The strace developers.
+ * Copyright (c) 2016-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -16,6 +16,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("linkat_subdir");
+
static const char sample_1[] = "linkat_sample_old";
static const char sample_2[] = "linkat_sample_new";
const long fd_old = (long) 0xdeadbeefffffffffULL;
@@ -33,6 +39,8 @@
"|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|AT_RECURSIVE|0xffff60ff",
rc, errno2name());
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-mx32/open.c
===================================================================
--- strace-5.7.orig/tests-mx32/open.c 2021-08-24 19:42:08.856580796 +0200
+++ strace-5.7/tests-mx32/open.c 2021-08-24 19:42:16.050519907 +0200
@@ -18,6 +18,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("open_subdir");
+
static const char sample[] = "open.sample";
long fd = syscall(__NR_open, sample, O_RDONLY|O_CREAT, 0400);
@@ -43,6 +49,8 @@
sample, sprintrc(fd));
# endif /* O_TMPFILE */
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-mx32/openat.c
===================================================================
--- strace-5.7.orig/tests-mx32/openat.c 2021-08-24 19:42:08.856580796 +0200
+++ strace-5.7/tests-mx32/openat.c 2021-08-24 19:42:16.050519907 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016 Katerina Koukiou <k.koukiou@gmail.com>
- * Copyright (c) 2016-2019 The strace developers.
+ * Copyright (c) 2016-2021 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later
@@ -39,6 +39,12 @@
int
main(void)
{
+ /*
+ * Make sure the current workdir of the tracee
+ * is different from the current workdir of the tracer.
+ */
+ create_and_enter_subdir("openat_subdir");
+
long fd = syscall(__NR_openat, -100, sample, O_RDONLY|O_CREAT, 0400);
printf("openat(AT_FDCWD, \"%s\", O_RDONLY|O_CREAT, 0400) = %s\n",
sample, sprintrc(fd));
@@ -101,6 +107,8 @@
test_mode_flag(modes[m].val, modes[m].str,
flags[f].val, flags[f].str);
+ leave_and_remove_subdir();
+
puts("+++ exited with 0 +++");
return 0;
}
Index: strace-5.7/tests-mx32/subdir.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.7/tests-mx32/subdir.c 2021-08-24 19:42:16.050519907 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2021 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "tests.h"
+
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+static const char *subdir;
+static DIR *dirp;
+
+void
+create_and_enter_subdir(const char *name)
+{
+ dirp = opendir(".");
+ if (!dirp)
+ perror_msg_and_fail("opendir: %s", ".");
+ (void) mkdir(name, 0700);
+ if (chdir(name))
+ perror_msg_and_fail("chdir: %s", name);
+ subdir = name;
+}
+
+void
+leave_and_remove_subdir(void)
+{
+ if (fchdir(dirfd(dirp)))
+ perror_msg_and_fail("fchdir: %d", dirfd(dirp));
+ if (closedir(dirp))
+ perror_msg_and_fail("closedir");
+ dirp = 0;
+ if (rmdir(subdir))
+ perror_msg_and_fail("rmdir: %s", subdir);
+ subdir = 0;
+}
Index: strace-5.7/tests-mx32/tests.h
===================================================================
--- strace-5.7.orig/tests-mx32/tests.h 2021-08-24 19:42:08.857580787 +0200
+++ strace-5.7/tests-mx32/tests.h 2021-08-24 19:42:16.051519898 +0200
@@ -161,6 +161,18 @@
char *get_fd_path(int fd) ATTRIBUTE_MALLOC;
/*
+ * Create the specified directory and chdir into it,
+ * die on chdir failure.
+ */
+void create_and_enter_subdir(const char *subdir);
+
+/*
+ * Leave from the directory entered by create_and_enter_subdir,
+ * remove that directory, die on failure.
+ */
+void leave_and_remove_subdir(void);
+
+/*
* Obtain an exclusive lock on dirname(path_name)/lock_name file
* using open and flock.
*/
Index: strace-5.7/tests/Makefile.in
===================================================================
--- strace-5.7.orig/tests/Makefile.in 2021-08-24 19:42:08.862580745 +0200
+++ strace-5.7/tests/Makefile.in 2021-08-24 19:42:54.720192609 +0200
@@ -574,7 +574,7 @@
libtests_a-signal2name.$(OBJEXT) \
libtests_a-skip_unavailable.$(OBJEXT) \
libtests_a-sprintrc.$(OBJEXT) libtests_a-status.$(OBJEXT) \
- libtests_a-tail_alloc.$(OBJEXT) \
+ libtests_a-subdir.$(OBJEXT) libtests_a-tail_alloc.$(OBJEXT) \
libtests_a-test_printpath.$(OBJEXT) \
libtests_a-test_printstrn.$(OBJEXT) \
libtests_a-test_ucopy.$(OBJEXT) libtests_a-tprintf.$(OBJEXT) \
@@ -5430,6 +5430,7 @@
skip_unavailable.c \
sprintrc.c \
status.c \
+ subdir.c \
tail_alloc.c \
test_netlink.h \
test_nlattr.h \
@@ -10433,6 +10434,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-skip_unavailable.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-sprintrc.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-status.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-subdir.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-tail_alloc.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-test_printpath.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-test_printstrn.Po@am__quote@ # am--include-marker
@@ -11353,6 +11355,20 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-status.obj `if test -f 'status.c'; then $(CYGPATH_W) 'status.c'; else $(CYGPATH_W) '$(srcdir)/status.c'; fi`
+libtests_a-subdir.o: subdir.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-subdir.o -MD -MP -MF $(DEPDIR)/libtests_a-subdir.Tpo -c -o libtests_a-subdir.o `test -f 'subdir.c' || echo '$(srcdir)/'`subdir.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-subdir.Tpo $(DEPDIR)/libtests_a-subdir.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='subdir.c' object='libtests_a-subdir.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-subdir.o `test -f 'subdir.c' || echo '$(srcdir)/'`subdir.c
+
+libtests_a-subdir.obj: subdir.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-subdir.obj -MD -MP -MF $(DEPDIR)/libtests_a-subdir.Tpo -c -o libtests_a-subdir.obj `if test -f 'subdir.c'; then $(CYGPATH_W) 'subdir.c'; else $(CYGPATH_W) '$(srcdir)/subdir.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-subdir.Tpo $(DEPDIR)/libtests_a-subdir.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='subdir.c' object='libtests_a-subdir.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-subdir.obj `if test -f 'subdir.c'; then $(CYGPATH_W) 'subdir.c'; else $(CYGPATH_W) '$(srcdir)/subdir.c'; fi`
+
libtests_a-tail_alloc.o: tail_alloc.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-tail_alloc.o -MD -MP -MF $(DEPDIR)/libtests_a-tail_alloc.Tpo -c -o libtests_a-tail_alloc.o `test -f 'tail_alloc.c' || echo '$(srcdir)/'`tail_alloc.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-tail_alloc.Tpo $(DEPDIR)/libtests_a-tail_alloc.Po
Index: strace-5.7/tests-m32/Makefile.in
===================================================================
--- strace-5.7.orig/tests-m32/Makefile.in 2021-08-24 19:42:08.866580711 +0200
+++ strace-5.7/tests-m32/Makefile.in 2021-08-24 19:43:13.669032228 +0200
@@ -574,7 +574,7 @@
libtests_a-signal2name.$(OBJEXT) \
libtests_a-skip_unavailable.$(OBJEXT) \
libtests_a-sprintrc.$(OBJEXT) libtests_a-status.$(OBJEXT) \
- libtests_a-tail_alloc.$(OBJEXT) \
+ libtests_a-subdir.$(OBJEXT) libtests_a-tail_alloc.$(OBJEXT) \
libtests_a-test_printpath.$(OBJEXT) \
libtests_a-test_printstrn.$(OBJEXT) \
libtests_a-test_ucopy.$(OBJEXT) libtests_a-tprintf.$(OBJEXT) \
@@ -5430,6 +5430,7 @@
skip_unavailable.c \
sprintrc.c \
status.c \
+ subdir.c \
tail_alloc.c \
test_netlink.h \
test_nlattr.h \
@@ -10433,6 +10434,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-skip_unavailable.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-sprintrc.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-status.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-subdir.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-tail_alloc.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-test_printpath.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-test_printstrn.Po@am__quote@ # am--include-marker
@@ -11353,6 +11355,20 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-status.obj `if test -f 'status.c'; then $(CYGPATH_W) 'status.c'; else $(CYGPATH_W) '$(srcdir)/status.c'; fi`
+libtests_a-subdir.o: subdir.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-subdir.o -MD -MP -MF $(DEPDIR)/libtests_a-subdir.Tpo -c -o libtests_a-subdir.o `test -f 'subdir.c' || echo '$(srcdir)/'`subdir.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-subdir.Tpo $(DEPDIR)/libtests_a-subdir.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='subdir.c' object='libtests_a-subdir.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-subdir.o `test -f 'subdir.c' || echo '$(srcdir)/'`subdir.c
+
+libtests_a-subdir.obj: subdir.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-subdir.obj -MD -MP -MF $(DEPDIR)/libtests_a-subdir.Tpo -c -o libtests_a-subdir.obj `if test -f 'subdir.c'; then $(CYGPATH_W) 'subdir.c'; else $(CYGPATH_W) '$(srcdir)/subdir.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-subdir.Tpo $(DEPDIR)/libtests_a-subdir.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='subdir.c' object='libtests_a-subdir.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-subdir.obj `if test -f 'subdir.c'; then $(CYGPATH_W) 'subdir.c'; else $(CYGPATH_W) '$(srcdir)/subdir.c'; fi`
+
libtests_a-tail_alloc.o: tail_alloc.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-tail_alloc.o -MD -MP -MF $(DEPDIR)/libtests_a-tail_alloc.Tpo -c -o libtests_a-tail_alloc.o `test -f 'tail_alloc.c' || echo '$(srcdir)/'`tail_alloc.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-tail_alloc.Tpo $(DEPDIR)/libtests_a-tail_alloc.Po
Index: strace-5.7/tests-mx32/Makefile.in
===================================================================
--- strace-5.7.orig/tests-mx32/Makefile.in 2021-08-24 19:42:08.870580677 +0200
+++ strace-5.7/tests-mx32/Makefile.in 2021-08-24 19:43:32.469873099 +0200
@@ -574,7 +574,7 @@
libtests_a-signal2name.$(OBJEXT) \
libtests_a-skip_unavailable.$(OBJEXT) \
libtests_a-sprintrc.$(OBJEXT) libtests_a-status.$(OBJEXT) \
- libtests_a-tail_alloc.$(OBJEXT) \
+ libtests_a-subdir.$(OBJEXT) libtests_a-tail_alloc.$(OBJEXT) \
libtests_a-test_printpath.$(OBJEXT) \
libtests_a-test_printstrn.$(OBJEXT) \
libtests_a-test_ucopy.$(OBJEXT) libtests_a-tprintf.$(OBJEXT) \
@@ -5430,6 +5430,7 @@
skip_unavailable.c \
sprintrc.c \
status.c \
+ subdir.c \
tail_alloc.c \
test_netlink.h \
test_nlattr.h \
@@ -10433,6 +10434,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-skip_unavailable.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-sprintrc.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-status.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-subdir.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-tail_alloc.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-test_printpath.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-test_printstrn.Po@am__quote@ # am--include-marker
@@ -11353,6 +11355,20 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-status.obj `if test -f 'status.c'; then $(CYGPATH_W) 'status.c'; else $(CYGPATH_W) '$(srcdir)/status.c'; fi`
+libtests_a-subdir.o: subdir.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-subdir.o -MD -MP -MF $(DEPDIR)/libtests_a-subdir.Tpo -c -o libtests_a-subdir.o `test -f 'subdir.c' || echo '$(srcdir)/'`subdir.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-subdir.Tpo $(DEPDIR)/libtests_a-subdir.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='subdir.c' object='libtests_a-subdir.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-subdir.o `test -f 'subdir.c' || echo '$(srcdir)/'`subdir.c
+
+libtests_a-subdir.obj: subdir.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-subdir.obj -MD -MP -MF $(DEPDIR)/libtests_a-subdir.Tpo -c -o libtests_a-subdir.obj `if test -f 'subdir.c'; then $(CYGPATH_W) 'subdir.c'; else $(CYGPATH_W) '$(srcdir)/subdir.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-subdir.Tpo $(DEPDIR)/libtests_a-subdir.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='subdir.c' object='libtests_a-subdir.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-subdir.obj `if test -f 'subdir.c'; then $(CYGPATH_W) 'subdir.c'; else $(CYGPATH_W) '$(srcdir)/subdir.c'; fi`
+
libtests_a-tail_alloc.o: tail_alloc.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-tail_alloc.o -MD -MP -MF $(DEPDIR)/libtests_a-tail_alloc.Tpo -c -o libtests_a-tail_alloc.o `test -f 'tail_alloc.c' || echo '$(srcdir)/'`tail_alloc.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-tail_alloc.Tpo $(DEPDIR)/libtests_a-tail_alloc.Po