Merge lp:~tobi-coldtobi/drizzle/1220852 into lp:drizzle

Proposed by coldtobi
Status: Needs review
Proposed branch: lp:~tobi-coldtobi/drizzle/1220852
Merge into: lp:drizzle
Diff against target: 275 lines (+83/-18)
7 files modified
client/drizzleslap.cc (+5/-4)
drizzled/cached_directory.cc (+4/-0)
drizzled/internal/my_symlink2.cc (+23/-3)
drizzled/message/include.am (+3/-3)
plugin/innobase/os/os0file.cc (+18/-5)
plugin/myisam/mi_open.cc (+1/-0)
plugin/mysql_unix_socket_protocol/protocol.cc (+29/-3)
To merge this branch: bzr merge lp:~tobi-coldtobi/drizzle/1220852
Reviewer Review Type Date Requested Status
Drizzle Trunk Pending
Review via email: mp+184165@code.launchpad.net

Description of the change

Work around PATH_MAX to enable compilation for GNU-hurd

To post a comment you must log in.

Unmerged revisions

2644. By Tobias Frost <email address hidden>

Enable hurd

2643. By Tobias Frost <email address hidden>

Fix build for boost >1.54
boost:system needs to be linked in when using boost::thread
boost::progamm-options does not take char* as pointer, reworked
to use std::string

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/drizzleslap.cc'
2--- client/drizzleslap.cc 2012-12-13 18:45:19 +0000
3+++ client/drizzleslap.cc 2013-09-05 18:35:37 +0000
4@@ -433,7 +433,8 @@
5 */
6 int main(int argc, char **argv)
7 {
8- char *password= NULL;
9+ std::string stpassword;
10+
11 try
12 {
13 po::options_description commandline_options("Options used only in command line");
14@@ -535,7 +536,7 @@
15 po::options_description client_options("Options specific to the client");
16 client_options.add_options()
17 ("host,h",po::value<string>(&host)->default_value("localhost"),"Connect to the host")
18- ("password,P",po::value<char *>(&password),
19+ ("password,P",po::value<std::string >(&stpassword),
20 "Password to use when connecting to server. If password is not given it's asked from the tty")
21 ("port,p",po::value<uint32_t>(), "Port number to use for connection")
22 ("protocol",po::value<string>(&opt_protocol)->default_value("mysql"),
23@@ -643,13 +644,13 @@
24 {
25 if (not opt_password.empty())
26 opt_password.erase();
27- if (password == PASSWORD_SENTINEL)
28+ if (stpassword == PASSWORD_SENTINEL)
29 {
30 opt_password= "";
31 }
32 else
33 {
34- opt_password= password;
35+ opt_password= stpassword;
36 tty_password= false;
37 }
38 }
39
40=== modified file 'drizzled/cached_directory.cc'
41--- drizzled/cached_directory.cc 2011-10-19 19:30:54 +0000
42+++ drizzled/cached_directory.cc 2013-09-05 18:35:37 +0000
43@@ -122,6 +122,10 @@
44 */
45 char space[sizeof(dirent) + PATH_MAX + 1];
46 #endif
47+#ifdef __GNU__
48+ // on hurd you need UCHAR_MAX ...
49+ char space[sizeof(dirent) + UCHAR_MAX + 1];
50+#endif
51 } buffer;
52
53 int retcode;
54
55=== modified file 'drizzled/internal/my_symlink2.cc'
56--- drizzled/internal/my_symlink2.cc 2011-08-08 12:51:19 +0000
57+++ drizzled/internal/my_symlink2.cc 2013-09-05 18:35:37 +0000
58@@ -34,8 +34,11 @@
59 {
60 /* Test if we should create a link */
61 bool create_link= false;
62- char rp_buff[PATH_MAX];
63-
64+#ifndef __GNU__
65+ char rp_buff[PATH_MAX];
66+#else
67+ char *rp_buff = NULL;
68+#endif
69 if (my_disable_symlinks)
70 {
71 /* Create only the file, not the link and file */
72@@ -44,11 +47,28 @@
73 }
74 else if (linkname)
75 {
76+ char abs_linkname[FN_REFLEN];
77+#ifndef __GNU__
78 if (!realpath(linkname,rp_buff))
79 my_load_path(rp_buff, linkname, NULL);
80 rp_buff[FN_REFLEN-1]= '\0';
81- char abs_linkname[FN_REFLEN];
82 strcpy(abs_linkname, rp_buff);
83+#else
84+ // on hurd PATH_MAX isn't but realpath accept NULL and will malloc
85+ rp_buff = realpath(linkname,NULL);
86+ if (!rp_buff) {
87+ char buffer[FN_REFLEN];
88+ my_load_path(buffer, linkname, NULL);
89+ buffer[FN_REFLEN-1]= '\0';
90+ strcpy(abs_linkname,buffer);
91+ } else {
92+ if (strlen(rp_buff) >= FN_REFLEN) {
93+ rp_buff[FN_REFLEN-1]= '\0';
94+ }
95+ strcpy(abs_linkname,rp_buff);
96+ free(rp_buff);
97+ }
98+#endif
99 create_link= strcmp(abs_linkname, filename);
100 }
101
102
103=== modified file 'drizzled/message/include.am'
104--- drizzled/message/include.am 2013-01-29 04:33:23 +0000
105+++ drizzled/message/include.am 2013-09-05 18:35:37 +0000
106@@ -40,7 +40,7 @@
107 drizzled_message_libdrizzledmessage_la_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS} ${NO_WERROR}
108
109 drizzled_message_libdrizzledmessage_la_SOURCES = drizzled/message/statement_transform.cc
110-drizzled_message_libdrizzledmessage_la_LIBADD= ${LTLIBPROTOBUF} $(GCOV_LIBS) drizzled/libcharset.la
111+drizzled_message_libdrizzledmessage_la_LIBADD= ${BOOST_LIBS} ${LTLIBPROTOBUF} $(GCOV_LIBS) drizzled/libcharset.la
112
113 nobase_dist_pkginclude_HEADERS+= \
114 drizzled/message/statement_transform.h
115@@ -89,7 +89,7 @@
116 drizzled_message_schema_writer_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}
117
118 drizzled_message_table_reader_SOURCES = drizzled/message/table_reader.cc
119-drizzled_message_table_reader_LDADD = ${MESSAGE_LDADD}
120+drizzled_message_table_reader_LDADD = ${BOOST_LIBS} ${MESSAGE_LDADD}
121 drizzled_message_table_reader_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}
122
123 drizzled_message_table_raw_reader_SOURCES = drizzled/message/table_raw_reader.cc
124@@ -104,7 +104,7 @@
125 drizzled_message_table_writer_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}
126
127 drizzled_message_transaction_writer_SOURCES = drizzled/message/transaction_writer.cc
128-drizzled_message_transaction_writer_LDADD = ${MESSAGE_LDADD} ${top_builddir}/drizzled/algorithm/libhash.la
129+drizzled_message_transaction_writer_LDADD = ${BOOST_LIBS} ${MESSAGE_LDADD} ${top_builddir}/drizzled/algorithm/libhash.la
130 drizzled_message_transaction_writer_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS} ${NO_WERROR}
131
132 EXTRA_DIST += \
133
134=== modified file 'plugin/innobase/os/os0file.cc'
135--- plugin/innobase/os/os0file.cc 2012-05-22 12:34:05 +0000
136+++ plugin/innobase/os/os0file.cc 2013-09-05 18:35:37 +0000
137@@ -107,7 +107,7 @@
138 There are four io-threads (for ibuf, log, read, write).
139 All synchronous IO requests are serviced by the calling thread using
140 os_file_write/os_file_read. The Asynchronous requests are queued up
141-in an array (there are four such arrays) by the calling thread.
142+in an array (there are four such arrays) by the calling thread.
143 Later these requests are picked up by the io-thread and are serviced
144 synchronously.
145
146@@ -917,11 +917,19 @@
147 int ret;
148 struct stat statinfo;
149 #ifdef HAVE_READDIR_R
150- char dirent_buf[sizeof(struct dirent)
151+#ifndef __GNU__
152+ char dirent_buf[sizeof(struct dirent) /**/
153 + _POSIX_PATH_MAX + 100];
154- /* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
155- the max file name len; but in most standards, the
156- length is NAME_MAX; we add 100 to be even safer */
157+ /* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
158+ the max file name len; but in most standards, the
159+ length is NAME_MAX; we add 100 to be even safer */
160+#else
161+ char dirent_buf[sizeof(struct dirent) /**/
162+ + UCHAR_MAX + 100];
163+ /** On hurd PATH_MAX is not defined. But we can use UCHAR_MAX
164+ * See http://lists.ximian.com/pipermail/mono-bugs/2007-September/061089.html
165+ and e.g. Debian BTS #438952... */
166+#endif
167 #endif
168
169 next_file:
170@@ -951,8 +959,13 @@
171 return(1);
172 }
173
174+#ifndef __GNU__
175 ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1);
176 #else
177+ ut_a(strlen(ent->d_name) < UCHAR_MAX + 100 - 1);
178+#endif
179+
180+#else
181 ent = readdir(dir);
182
183 if (ent == NULL) {
184
185=== modified file 'plugin/myisam/mi_open.cc'
186--- plugin/myisam/mi_open.cc 2013-02-10 01:32:31 +0000
187+++ plugin/myisam/mi_open.cc 2013-09-05 18:35:37 +0000
188@@ -17,6 +17,7 @@
189
190 #include "myisam_priv.h"
191
192+#include <stdlib.h>
193 #include <string.h>
194 #include <algorithm>
195 #include <memory>
196
197=== modified file 'plugin/mysql_unix_socket_protocol/protocol.cc'
198--- plugin/mysql_unix_socket_protocol/protocol.cc 2012-11-11 10:52:33 +0000
199+++ plugin/mysql_unix_socket_protocol/protocol.cc 2013-09-05 18:35:37 +0000
200@@ -33,11 +33,13 @@
201
202 #include <sys/stat.h>
203
204+#include <sys/stat.h>
205+
206 #include <sys/un.h>
207
208 #include <plugin/mysql_unix_socket_protocol/protocol.h>
209
210-#define DRIZZLE_UNIX_SOCKET_PATH "/tmp/mysql.socket"
211+#define DRIZZLE_UNIX_SOCKET_PATH "/var/run/drizzle/mysql.socket"
212
213 namespace po= boost::program_options;
214 namespace fs= boost::filesystem;
215@@ -63,18 +65,32 @@
216
217 extern "C" {
218
219+#ifndef __GNU__
220 char at_exit_socket_file[PATH_MAX]= { 0 };
221-
222+#else
223+ // on hurd, there is no such limit.
224+ char *at_exit_socket_file = 0;
225+#endif
226+
227 static void remove_socket_file(void)
228 {
229+#ifndef __GNU__
230 if (at_exit_socket_file[0])
231+#else
232+ if (at_exit_socket_file && at_exit_socket_file[0])
233+#endif
234 {
235 if (unlink(at_exit_socket_file) == -1)
236 {
237 std::cerr << "Could not remove socket: " << at_exit_socket_file << "(" << strerror(errno) << ")" << std::endl;
238 }
239
240+#ifndef __GNU__
241 at_exit_socket_file[0]= 0;
242+#else
243+ free(at_exit_socket_file);
244+ at_exit_socket_file = 0;
245+#endif
246 }
247 }
248 }
249@@ -92,7 +108,17 @@
250 context.registerVariable(new sys_var_const_string_val("path", fs::system_complete(uds_path).string()));
251 context.registerVariable(new sys_var_bool_ptr_readonly("clobber", &clobber));
252 context.registerVariable(new sys_var_uint32_t_ptr("max-connections", &Protocol::mysql_unix_counters.max_connections));
253+
254+#ifdef __GNU__
255+ {
256+ size_t s= uds_path_string().c_str().length()+1;
257+ if (at_exit_socket_file) free(at_exit_socket_file);
258+ at_exit_socket_file = malloc(s);
259+ snprintf(at_exit_socket_file, s, "%s", uds_path.string().c_str());
260+ }
261+#else
262 snprintf(at_exit_socket_file, sizeof(at_exit_socket_file), "%s", uds_path.string().c_str());
263+#endif
264 atexit(remove_socket_file);
265 }
266 else
267@@ -165,7 +191,7 @@
268
269 chmod(_unix_socket_path.string().c_str(),0777);
270
271- return false;
272+return false;
273 }
274
275 plugin::Client *Protocol::getClient(int fd)

Subscribers

People subscribed via source and target branches

to all changes: