diff options
author | Colin Watson <cjwatson@debian.org> | 2017-01-03 12:23:17 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2017-01-03 12:24:02 +0000 |
commit | ba96642edeb90c3a6ded02d367741b26ccd21afc (patch) | |
tree | c6e82b5059fb9f091db9af05e25bca642e08670f /debian | |
parent | 211eea7b947be4e9644f8f0f9169357f1f7b2296 (diff) | |
parent | cc50ca70e3b438577c33a85147e2a68666deaad9 (diff) |
Create mux socket for regression tests in a temporary directory.
Diffstat (limited to 'debian')
-rw-r--r-- | debian/.git-dpm | 4 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | debian/patches/regress-mktemp.patch | 167 | ||||
-rw-r--r-- | debian/patches/series | 1 |
4 files changed, 176 insertions, 2 deletions
diff --git a/debian/.git-dpm b/debian/.git-dpm index 1f8d45838..d413019d4 100644 --- a/debian/.git-dpm +++ b/debian/.git-dpm | |||
@@ -1,6 +1,6 @@ | |||
1 | # see git-dpm(1) from git-dpm package | 1 | # see git-dpm(1) from git-dpm package |
2 | d225c4fe44ad94a30a5033e58594f2bebaa674f2 | 2 | cc50ca70e3b438577c33a85147e2a68666deaad9 |
3 | d225c4fe44ad94a30a5033e58594f2bebaa674f2 | 3 | cc50ca70e3b438577c33a85147e2a68666deaad9 |
4 | 971a7653746a6972b907dfe0ce139c06e4a6f482 | 4 | 971a7653746a6972b907dfe0ce139c06e4a6f482 |
5 | 971a7653746a6972b907dfe0ce139c06e4a6f482 | 5 | 971a7653746a6972b907dfe0ce139c06e4a6f482 |
6 | openssh_7.4p1.orig.tar.gz | 6 | openssh_7.4p1.orig.tar.gz |
diff --git a/debian/changelog b/debian/changelog index 424aae990..872eeb404 100644 --- a/debian/changelog +++ b/debian/changelog | |||
@@ -1,3 +1,9 @@ | |||
1 | openssh (1:7.4p1-5) UNRELEASED; urgency=medium | ||
2 | |||
3 | * Create mux socket for regression tests in a temporary directory. | ||
4 | |||
5 | -- Colin Watson <cjwatson@debian.org> Tue, 03 Jan 2017 12:23:34 +0000 | ||
6 | |||
1 | openssh (1:7.4p1-4) unstable; urgency=medium | 7 | openssh (1:7.4p1-4) unstable; urgency=medium |
2 | 8 | ||
3 | * Run regression tests inside annotate-output to try to diagnose timeout | 9 | * Run regression tests inside annotate-output to try to diagnose timeout |
diff --git a/debian/patches/regress-mktemp.patch b/debian/patches/regress-mktemp.patch new file mode 100644 index 000000000..2d9b436f5 --- /dev/null +++ b/debian/patches/regress-mktemp.patch | |||
@@ -0,0 +1,167 @@ | |||
1 | From cc50ca70e3b438577c33a85147e2a68666deaad9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Colin Watson <cjwatson@debian.org> | ||
3 | Date: Tue, 3 Jan 2017 12:09:42 +0000 | ||
4 | Subject: Create mux socket for regress in temp directory | ||
5 | |||
6 | In some setups, creating the socket under OBJ may result in a path that | ||
7 | is too long for a Unix domain socket. Add a helper to let us portably | ||
8 | create a temporary directory instead. | ||
9 | |||
10 | Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=2660 | ||
11 | Last-Update: 2017-01-03 | ||
12 | |||
13 | Patch-Name: regress-mktemp.patch | ||
14 | --- | ||
15 | Makefile.in | 5 +++++ | ||
16 | regress/forwarding.sh | 3 ++- | ||
17 | regress/mkdtemp.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
18 | regress/multiplex.sh | 3 ++- | ||
19 | regress/test-exec.sh | 11 ++++++++++ | ||
20 | 5 files changed, 79 insertions(+), 2 deletions(-) | ||
21 | create mode 100644 regress/mkdtemp.c | ||
22 | |||
23 | diff --git a/Makefile.in b/Makefile.in | ||
24 | index a6eb81ec..a00347e2 100644 | ||
25 | --- a/Makefile.in | ||
26 | +++ b/Makefile.in | ||
27 | @@ -459,6 +459,10 @@ regress/check-perm$(EXEEXT): $(srcdir)/regress/check-perm.c $(REGRESSLIBS) | ||
28 | $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/check-perm.c \ | ||
29 | $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) | ||
30 | |||
31 | +regress/mkdtemp$(EXEEXT): $(srcdir)/regress/mkdtemp.c $(REGRESSLIBS) | ||
32 | + $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/mkdtemp.c \ | ||
33 | + $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) | ||
34 | + | ||
35 | UNITTESTS_TEST_HELPER_OBJS=\ | ||
36 | regress/unittests/test_helper/test_helper.o \ | ||
37 | regress/unittests/test_helper/fuzz.o | ||
38 | @@ -557,6 +561,7 @@ regress-binaries: regress/modpipe$(EXEEXT) \ | ||
39 | regress/setuid-allowed$(EXEEXT) \ | ||
40 | regress/netcat$(EXEEXT) \ | ||
41 | regress/check-perm$(EXEEXT) \ | ||
42 | + regress/mkdtemp$(EXEEXT) \ | ||
43 | regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \ | ||
44 | regress/unittests/sshkey/test_sshkey$(EXEEXT) \ | ||
45 | regress/unittests/bitmap/test_bitmap$(EXEEXT) \ | ||
46 | diff --git a/regress/forwarding.sh b/regress/forwarding.sh | ||
47 | index a1a4b13f..592de7bc 100644 | ||
48 | --- a/regress/forwarding.sh | ||
49 | +++ b/regress/forwarding.sh | ||
50 | @@ -10,7 +10,8 @@ start_sshd | ||
51 | base=33 | ||
52 | last=$PORT | ||
53 | fwd="" | ||
54 | -CTL=$OBJ/ctl-sock | ||
55 | +make_tmpdir | ||
56 | +CTL=$TMP/ctl-sock | ||
57 | |||
58 | for j in 0 1 2; do | ||
59 | for i in 0 1 2; do | ||
60 | diff --git a/regress/mkdtemp.c b/regress/mkdtemp.c | ||
61 | new file mode 100644 | ||
62 | index 00000000..8c7d2e21 | ||
63 | --- /dev/null | ||
64 | +++ b/regress/mkdtemp.c | ||
65 | @@ -0,0 +1,59 @@ | ||
66 | +/* | ||
67 | + * Copyright (c) 2017 Colin Watson <cjwatson@debian.org> | ||
68 | + * | ||
69 | + * Permission to use, copy, modify, and distribute this software for any | ||
70 | + * purpose with or without fee is hereby granted, provided that the above | ||
71 | + * copyright notice and this permission notice appear in all copies. | ||
72 | + * | ||
73 | + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
74 | + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
75 | + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
76 | + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
77 | + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
78 | + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
79 | + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
80 | + */ | ||
81 | + | ||
82 | +/* Roughly equivalent to "mktemp -d -t TEMPLATE", but portable. */ | ||
83 | + | ||
84 | +#include "includes.h" | ||
85 | + | ||
86 | +#include <limits.h> | ||
87 | +#include <stdio.h> | ||
88 | +#include <stdlib.h> | ||
89 | + | ||
90 | +#include "log.h" | ||
91 | + | ||
92 | +static void | ||
93 | +usage(void) | ||
94 | +{ | ||
95 | + fprintf(stderr, "mkdtemp template\n"); | ||
96 | + exit(1); | ||
97 | +} | ||
98 | + | ||
99 | +int | ||
100 | +main(int argc, char **argv) | ||
101 | +{ | ||
102 | + const char *base; | ||
103 | + const char *tmpdir; | ||
104 | + char template[PATH_MAX]; | ||
105 | + int r; | ||
106 | + char *dir; | ||
107 | + | ||
108 | + if (argc != 2) | ||
109 | + usage(); | ||
110 | + base = argv[1]; | ||
111 | + | ||
112 | + if ((tmpdir = getenv("TMPDIR")) == NULL) | ||
113 | + tmpdir = "/tmp"; | ||
114 | + r = snprintf(template, sizeof(template), "%s/%s", tmpdir, base); | ||
115 | + if (r < 0 || (size_t)r >= sizeof(template)) | ||
116 | + fatal("template string too long"); | ||
117 | + dir = mkdtemp(template); | ||
118 | + if (dir == NULL) { | ||
119 | + perror("mkdtemp"); | ||
120 | + exit(1); | ||
121 | + } | ||
122 | + puts(dir); | ||
123 | + return 0; | ||
124 | +} | ||
125 | diff --git a/regress/multiplex.sh b/regress/multiplex.sh | ||
126 | index acb9234d..0ac4065e 100644 | ||
127 | --- a/regress/multiplex.sh | ||
128 | +++ b/regress/multiplex.sh | ||
129 | @@ -1,7 +1,8 @@ | ||
130 | # $OpenBSD: multiplex.sh,v 1.27 2014/12/22 06:14:29 djm Exp $ | ||
131 | # Placed in the Public Domain. | ||
132 | |||
133 | -CTL=/tmp/openssh.regress.ctl-sock.$$ | ||
134 | +make_tmpdir | ||
135 | +CTL=$TMP/ctl-sock | ||
136 | |||
137 | tid="connection multiplexing" | ||
138 | |||
139 | diff --git a/regress/test-exec.sh b/regress/test-exec.sh | ||
140 | index bfa48803..13a8e18f 100644 | ||
141 | --- a/regress/test-exec.sh | ||
142 | +++ b/regress/test-exec.sh | ||
143 | @@ -317,6 +317,14 @@ stop_sshd () | ||
144 | fi | ||
145 | } | ||
146 | |||
147 | +TMP= | ||
148 | + | ||
149 | +make_tmpdir () | ||
150 | +{ | ||
151 | + TMP="$($OBJ/mkdtemp openssh-regress-XXXXXXXXXXXX)" || \ | ||
152 | + fatal "failed to create temporary directory" | ||
153 | +} | ||
154 | + | ||
155 | # helper | ||
156 | cleanup () | ||
157 | { | ||
158 | @@ -327,6 +335,9 @@ cleanup () | ||
159 | kill $SSH_PID | ||
160 | fi | ||
161 | fi | ||
162 | + if [ "x$TMP" != "x" ]; then | ||
163 | + rm -rf "$TMP" | ||
164 | + fi | ||
165 | stop_sshd | ||
166 | } | ||
167 | |||
diff --git a/debian/patches/series b/debian/patches/series index 61090cc88..a743bec00 100644 --- a/debian/patches/series +++ b/debian/patches/series | |||
@@ -26,3 +26,4 @@ systemd-readiness.patch | |||
26 | debian-config.patch | 26 | debian-config.patch |
27 | regress-integrity-robust.patch | 27 | regress-integrity-robust.patch |
28 | regress-forwarding-race.patch | 28 | regress-forwarding-race.patch |
29 | regress-mktemp.patch | ||