summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2019-06-09 22:09:35 +0100
committerColin Watson <cjwatson@debian.org>2019-06-09 22:10:43 +0100
commitedf60d2bf70b7cc9a651434faa87b732af081808 (patch)
tree23d893f8098ba534db2523aed6d40565e002a61d /debian/patches
parent865a97e05b6aab1619e1c8eeb33ccb8f9a9e48d3 (diff)
parentbbc5ff0a295797174b4ef3928f58969e43f5adfe (diff)
Fix utimensat tests when not using compat code
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/fix-utimensat-test.patch58
-rw-r--r--debian/patches/series1
2 files changed, 59 insertions, 0 deletions
diff --git a/debian/patches/fix-utimensat-test.patch b/debian/patches/fix-utimensat-test.patch
new file mode 100644
index 000000000..799337e64
--- /dev/null
+++ b/debian/patches/fix-utimensat-test.patch
@@ -0,0 +1,58 @@
1From bbc5ff0a295797174b4ef3928f58969e43f5adfe Mon Sep 17 00:00:00 2001
2From: Darren Tucker <dtucker@dtucker.net>
3Date: Fri, 7 Jun 2019 23:47:37 +1000
4Subject: Update utimensat test.
5
6POSIX specifies that when given a symlink, AT_SYMLINK_NOFOLLOW should
7update the symlink and not the destination. The compat code doesn't
8have a way to do this, so where possible it fails instead of following a
9symlink when explicitly asked not to. Instead of checking for an explicit
10failure, check that it does not update the destination, which both the
11real and compat implementations should honour.
12
13Inspired by github pull req #125 from chutzpah at gentoo.org.
14
15Origin: upstream, https://anongit.mindrot.org/openssh.git/commit/?id=182898192d4b720e4faeafd5b39c2cfb3b92aa21
16Last-Update: 2019-06-09
17
18Patch-Name: fix-utimensat-test.patch
19---
20 openbsd-compat/regress/utimensattest.c | 20 +++++++++++++++++---
21 1 file changed, 17 insertions(+), 3 deletions(-)
22
23diff --git a/openbsd-compat/regress/utimensattest.c b/openbsd-compat/regress/utimensattest.c
24index a7bc7634b..b29cef2f1 100644
25--- a/openbsd-compat/regress/utimensattest.c
26+++ b/openbsd-compat/regress/utimensattest.c
27@@ -83,14 +83,28 @@ main(void)
28 fail("mtim.tv_nsec", 45678000, sb.st_mtim.tv_nsec);
29 #endif
30
31+ /*
32+ * POSIX specifies that when given a symlink, AT_SYMLINK_NOFOLLOW
33+ * should update the symlink and not the destination. The compat
34+ * code doesn't have a way to do this, so where possible it fails
35+ * with ENOSYS instead of following a symlink when explicitly asked
36+ * not to. Here we just test that it does not update the destination.
37+ */
38 if (rename(TMPFILE, TMPFILE2) == -1)
39 fail("rename", 0, 0);
40 if (symlink(TMPFILE2, TMPFILE) == -1)
41 fail("symlink", 0, 0);
42+ ts[0].tv_sec = 11223344;
43+ ts[1].tv_sec = 55667788;
44+ (void)utimensat(AT_FDCWD, TMPFILE, ts, AT_SYMLINK_NOFOLLOW);
45+ if (stat(TMPFILE2, &sb) == -1)
46+ fail("stat", 0, 0 );
47+ if (sb.st_atime == 11223344)
48+ fail("utimensat symlink st_atime", 0, 0 );
49+ if (sb.st_mtime == 55667788)
50+ fail("utimensat symlink st_mtime", 0, 0 );
51
52- if (utimensat(AT_FDCWD, TMPFILE, ts, AT_SYMLINK_NOFOLLOW) != -1)
53- fail("utimensat followed symlink", 0, 0);
54-
55+ /* Clean up */
56 if (!(unlink(TMPFILE) == 0 && unlink(TMPFILE2) == 0))
57 fail("unlink", 0, 0);
58 exit(0);
diff --git a/debian/patches/series b/debian/patches/series
index 6304f537a..ba5a5ad4b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -25,3 +25,4 @@ seccomp-s390-flock-ipc.patch
25seccomp-s390-ioctl-ep11-crypto.patch 25seccomp-s390-ioctl-ep11-crypto.patch
26conch-old-privkey-format.patch 26conch-old-privkey-format.patch
27revert-ipqos-defaults.patch 27revert-ipqos-defaults.patch
28fix-utimensat-test.patch