monotone

monotone Commit Details

Date:2013-03-14 21:02:17 (6 years 3 months ago)
Author:Markus Wanner
Branch:org.debian.monotone
Commit:56c0dcfe71f83c11c72abe8960a5f6dc7d63314a
Parents: 7a039fb5cf03277e86838e2ef382f79b71a5ff80
Message:Fix compilation on hurd, back-porting an upstream fix in

patches/05-hurd-compilation-fix.diff. Closes: #624779.
Changes:
Apatches/05-hurd-compilation-fix.diff (full)
Mchangelog (1 diff)
Mpatches/series (1 diff)

File differences

changelog
1
1
22
3
4
5
36
47
58
6
9
710
811
912
monotone (1.0-7) UNRELEASED; urgency=low
monotone (1.0-7) experimental; urgency=low
* Team upload.
* Fix compilation on hurd, back-porting an upstream fix in
patches/05-hurd-compilation-fix.diff. Closes: #624779.
* Add Brazilian Portuguese translation by Adriano Rafael Gomes.
Closes: #693378.
-- Markus Wanner <markus@bluegap.ch> Fri, 08 Mar 2013 21:44:48 +0100
-- Markus Wanner <markus@bluegap.ch> Thu, 14 Mar 2013 21:00:46 +0100
monotone (1.0-6) unstable; urgency=low
patches/05-hurd-compilation-fix.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Description: fix compilation on hurd-i386
Do not rely on MAXPATHLEN to be defined. Instead iteratively call getcwd()
with an increasing buffer size until the current path fits.
Bug-Debian: http://bugs.debian.org/624779
Origin: upstream, backport of 64e690fd0e14f6a0ad816d8fd55044f36d8559d5,
d23dbf2ce78cd11fc1a1dc85cd78cc28ab2df8ca and
c14cb021dafa331f859634a14087f6f81d870aed
============================================================
--- a/src/netxx/serverbase.cxx
+++ b/src/netxx/serverbase.cxx
@@ -44,6 +44,9 @@
#include "probeinfo.h"
#include "socket.h"
+// Monotone specific, for get_current_working_dir()
+#include <src/platform.hh>
+
// standard includes
#include <map>
#include <vector>
@@ -167,14 +170,16 @@
if (saun->sun_path[0] == '/') {
files_.push_back(saun->sun_path);
} else {
- char buffer[MAXPATHLEN];
-
- if (getcwd(buffer, sizeof(buffer))) {
- std::string fullpath = buffer; fullpath += '/'; fullpath += saun->sun_path;
-files_.push_back(fullpath);
- } else {
-files_.push_back(saun->sun_path);
- }
+ /*
+ * the original (netxx) code here relied on MAXPATHLEN,
+ * which isn't defined on hurd. As netxx seems to only
+ * live on within monotone, we can as well make it
+ * inter-dependent. And the unix/fs.cc variant certainly
+ * gets more test mileage than anything special here.
+ */
+ std::string fullpath = get_current_working_dir();
+ fullpath += '/'; fullpath += saun->sun_path;
+ files_.push_back(fullpath);
}
}
#endif
--- a/src/unix/fs.cc
+++ b/src/unix/fs.cc
@@ -41,14 +41,26 @@
string
get_current_working_dir()
{
- char buffer[4096];
- if (!getcwd(buffer, 4096))
+ std::vector<char> cwd_buf;
+ size_t cwd_sz = 4096;
+
+ // This funny loop prevents having to specify a MAXPATHLEN or similar, but
+ // uses a dynamic approach, repeatedly calling getcwd() until our buffer
+ // is big enough for the current path to fit. Think of it as a portable
+ // replacement for get_current_dir_name(), which is GNU-only.
+ do
{
- const int err = errno;
- E(false, origin::system,
- F("cannot get working directory: %s") % os_strerror(err));
+ cwd_buf.resize(cwd_sz);
+ if (getcwd(&cwd_buf[0], cwd_sz))
+ return string(&cwd_buf[0]);
+
+ cwd_sz += 4096;
}
- return string(buffer);
+ while (errno == ERANGE);
+
+ const int err = errno;
+ E(false, origin::system,
+ F("cannot get working directory: %s") % os_strerror(err));
}
void
patches/series
33
44
55
6
67
78
02-file_handle.diff
03-url_escaping.diff
04-botan-1.10-adaption.diff
05-hurd-compilation-fix.diff
10-mtn-ignore-syntax-error-test.diff
90-stacktrace-on-crash.diff

Archive Download the corresponding diff file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status