Blame SOURCES/0143-tests-introduce-create_and_enter_subdir-and-leave_an.patch

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