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
=== modified file 'client/drizzleslap.cc'
--- client/drizzleslap.cc 2012-12-13 18:45:19 +0000
+++ client/drizzleslap.cc 2013-09-05 18:35:37 +0000
@@ -433,7 +433,8 @@
433 */433 */
434int main(int argc, char **argv)434int main(int argc, char **argv)
435{435{
436 char *password= NULL;436 std::string stpassword;
437
437 try438 try
438 {439 {
439 po::options_description commandline_options("Options used only in command line");440 po::options_description commandline_options("Options used only in command line");
@@ -535,7 +536,7 @@
535 po::options_description client_options("Options specific to the client");536 po::options_description client_options("Options specific to the client");
536 client_options.add_options()537 client_options.add_options()
537 ("host,h",po::value<string>(&host)->default_value("localhost"),"Connect to the host")538 ("host,h",po::value<string>(&host)->default_value("localhost"),"Connect to the host")
538 ("password,P",po::value<char *>(&password),539 ("password,P",po::value<std::string >(&stpassword),
539 "Password to use when connecting to server. If password is not given it's asked from the tty")540 "Password to use when connecting to server. If password is not given it's asked from the tty")
540 ("port,p",po::value<uint32_t>(), "Port number to use for connection")541 ("port,p",po::value<uint32_t>(), "Port number to use for connection")
541 ("protocol",po::value<string>(&opt_protocol)->default_value("mysql"),542 ("protocol",po::value<string>(&opt_protocol)->default_value("mysql"),
@@ -643,13 +644,13 @@
643 {644 {
644 if (not opt_password.empty())645 if (not opt_password.empty())
645 opt_password.erase();646 opt_password.erase();
646 if (password == PASSWORD_SENTINEL)647 if (stpassword == PASSWORD_SENTINEL)
647 {648 {
648 opt_password= "";649 opt_password= "";
649 }650 }
650 else651 else
651 {652 {
652 opt_password= password;653 opt_password= stpassword;
653 tty_password= false;654 tty_password= false;
654 }655 }
655 }656 }
656657
=== modified file 'drizzled/cached_directory.cc'
--- drizzled/cached_directory.cc 2011-10-19 19:30:54 +0000
+++ drizzled/cached_directory.cc 2013-09-05 18:35:37 +0000
@@ -122,6 +122,10 @@
122 */122 */
123 char space[sizeof(dirent) + PATH_MAX + 1];123 char space[sizeof(dirent) + PATH_MAX + 1];
124#endif124#endif
125#ifdef __GNU__
126 // on hurd you need UCHAR_MAX ...
127 char space[sizeof(dirent) + UCHAR_MAX + 1];
128#endif
125 } buffer;129 } buffer;
126130
127 int retcode;131 int retcode;
128132
=== modified file 'drizzled/internal/my_symlink2.cc'
--- drizzled/internal/my_symlink2.cc 2011-08-08 12:51:19 +0000
+++ drizzled/internal/my_symlink2.cc 2013-09-05 18:35:37 +0000
@@ -34,8 +34,11 @@
34{34{
35 /* Test if we should create a link */35 /* Test if we should create a link */
36 bool create_link= false;36 bool create_link= false;
37 char rp_buff[PATH_MAX];37#ifndef __GNU__
3838 char rp_buff[PATH_MAX];
39#else
40 char *rp_buff = NULL;
41#endif
39 if (my_disable_symlinks)42 if (my_disable_symlinks)
40 {43 {
41 /* Create only the file, not the link and file */44 /* Create only the file, not the link and file */
@@ -44,11 +47,28 @@
44 }47 }
45 else if (linkname)48 else if (linkname)
46 {49 {
50 char abs_linkname[FN_REFLEN];
51#ifndef __GNU__
47 if (!realpath(linkname,rp_buff))52 if (!realpath(linkname,rp_buff))
48 my_load_path(rp_buff, linkname, NULL);53 my_load_path(rp_buff, linkname, NULL);
49 rp_buff[FN_REFLEN-1]= '\0';54 rp_buff[FN_REFLEN-1]= '\0';
50 char abs_linkname[FN_REFLEN];
51 strcpy(abs_linkname, rp_buff);55 strcpy(abs_linkname, rp_buff);
56#else
57 // on hurd PATH_MAX isn't but realpath accept NULL and will malloc
58 rp_buff = realpath(linkname,NULL);
59 if (!rp_buff) {
60 char buffer[FN_REFLEN];
61 my_load_path(buffer, linkname, NULL);
62 buffer[FN_REFLEN-1]= '\0';
63 strcpy(abs_linkname,buffer);
64 } else {
65 if (strlen(rp_buff) >= FN_REFLEN) {
66 rp_buff[FN_REFLEN-1]= '\0';
67 }
68 strcpy(abs_linkname,rp_buff);
69 free(rp_buff);
70 }
71#endif
52 create_link= strcmp(abs_linkname, filename);72 create_link= strcmp(abs_linkname, filename);
53 }73 }
5474
5575
=== modified file 'drizzled/message/include.am'
--- drizzled/message/include.am 2013-01-29 04:33:23 +0000
+++ drizzled/message/include.am 2013-09-05 18:35:37 +0000
@@ -40,7 +40,7 @@
40drizzled_message_libdrizzledmessage_la_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS} ${NO_WERROR}40drizzled_message_libdrizzledmessage_la_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS} ${NO_WERROR}
4141
42drizzled_message_libdrizzledmessage_la_SOURCES = drizzled/message/statement_transform.cc42drizzled_message_libdrizzledmessage_la_SOURCES = drizzled/message/statement_transform.cc
43drizzled_message_libdrizzledmessage_la_LIBADD= ${LTLIBPROTOBUF} $(GCOV_LIBS) drizzled/libcharset.la43drizzled_message_libdrizzledmessage_la_LIBADD= ${BOOST_LIBS} ${LTLIBPROTOBUF} $(GCOV_LIBS) drizzled/libcharset.la
4444
45nobase_dist_pkginclude_HEADERS+= \45nobase_dist_pkginclude_HEADERS+= \
46 drizzled/message/statement_transform.h46 drizzled/message/statement_transform.h
@@ -89,7 +89,7 @@
89drizzled_message_schema_writer_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}89drizzled_message_schema_writer_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}
9090
91drizzled_message_table_reader_SOURCES = drizzled/message/table_reader.cc91drizzled_message_table_reader_SOURCES = drizzled/message/table_reader.cc
92drizzled_message_table_reader_LDADD = ${MESSAGE_LDADD}92drizzled_message_table_reader_LDADD = ${BOOST_LIBS} ${MESSAGE_LDADD}
93drizzled_message_table_reader_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}93drizzled_message_table_reader_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}
9494
95drizzled_message_table_raw_reader_SOURCES = drizzled/message/table_raw_reader.cc95drizzled_message_table_raw_reader_SOURCES = drizzled/message/table_raw_reader.cc
@@ -104,7 +104,7 @@
104drizzled_message_table_writer_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}104drizzled_message_table_writer_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}
105105
106drizzled_message_transaction_writer_SOURCES = drizzled/message/transaction_writer.cc106drizzled_message_transaction_writer_SOURCES = drizzled/message/transaction_writer.cc
107drizzled_message_transaction_writer_LDADD = ${MESSAGE_LDADD} ${top_builddir}/drizzled/algorithm/libhash.la107drizzled_message_transaction_writer_LDADD = ${BOOST_LIBS} ${MESSAGE_LDADD} ${top_builddir}/drizzled/algorithm/libhash.la
108drizzled_message_transaction_writer_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS} ${NO_WERROR}108drizzled_message_transaction_writer_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS} ${NO_WERROR}
109109
110EXTRA_DIST += \110EXTRA_DIST += \
111111
=== modified file 'plugin/innobase/os/os0file.cc'
--- plugin/innobase/os/os0file.cc 2012-05-22 12:34:05 +0000
+++ plugin/innobase/os/os0file.cc 2013-09-05 18:35:37 +0000
@@ -107,7 +107,7 @@
107There are four io-threads (for ibuf, log, read, write).107There are four io-threads (for ibuf, log, read, write).
108All synchronous IO requests are serviced by the calling thread using108All synchronous IO requests are serviced by the calling thread using
109os_file_write/os_file_read. The Asynchronous requests are queued up109os_file_write/os_file_read. The Asynchronous requests are queued up
110in an array (there are four such arrays) by the calling thread. 110in an array (there are four such arrays) by the calling thread.
111Later these requests are picked up by the io-thread and are serviced111Later these requests are picked up by the io-thread and are serviced
112synchronously.112synchronously.
113113
@@ -917,11 +917,19 @@
917 int ret;917 int ret;
918 struct stat statinfo;918 struct stat statinfo;
919#ifdef HAVE_READDIR_R919#ifdef HAVE_READDIR_R
920 char dirent_buf[sizeof(struct dirent)920#ifndef __GNU__
921 char dirent_buf[sizeof(struct dirent) /**/
921 + _POSIX_PATH_MAX + 100];922 + _POSIX_PATH_MAX + 100];
922 /* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as923 /* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
923 the max file name len; but in most standards, the924 the max file name len; but in most standards, the
924 length is NAME_MAX; we add 100 to be even safer */925 length is NAME_MAX; we add 100 to be even safer */
926#else
927 char dirent_buf[sizeof(struct dirent) /**/
928 + UCHAR_MAX + 100];
929 /** On hurd PATH_MAX is not defined. But we can use UCHAR_MAX
930 * See http://lists.ximian.com/pipermail/mono-bugs/2007-September/061089.html
931 and e.g. Debian BTS #438952... */
932#endif
925#endif933#endif
926934
927next_file:935next_file:
@@ -951,8 +959,13 @@
951 return(1);959 return(1);
952 }960 }
953961
962#ifndef __GNU__
954 ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1);963 ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1);
955#else964#else
965 ut_a(strlen(ent->d_name) < UCHAR_MAX + 100 - 1);
966#endif
967
968#else
956 ent = readdir(dir);969 ent = readdir(dir);
957970
958 if (ent == NULL) {971 if (ent == NULL) {
959972
=== modified file 'plugin/myisam/mi_open.cc'
--- plugin/myisam/mi_open.cc 2013-02-10 01:32:31 +0000
+++ plugin/myisam/mi_open.cc 2013-09-05 18:35:37 +0000
@@ -17,6 +17,7 @@
1717
18#include "myisam_priv.h"18#include "myisam_priv.h"
1919
20#include <stdlib.h>
20#include <string.h>21#include <string.h>
21#include <algorithm>22#include <algorithm>
22#include <memory>23#include <memory>
2324
=== modified file 'plugin/mysql_unix_socket_protocol/protocol.cc'
--- plugin/mysql_unix_socket_protocol/protocol.cc 2012-11-11 10:52:33 +0000
+++ plugin/mysql_unix_socket_protocol/protocol.cc 2013-09-05 18:35:37 +0000
@@ -33,11 +33,13 @@
3333
34#include <sys/stat.h>34#include <sys/stat.h>
3535
36#include <sys/stat.h>
37
36#include <sys/un.h>38#include <sys/un.h>
3739
38#include <plugin/mysql_unix_socket_protocol/protocol.h>40#include <plugin/mysql_unix_socket_protocol/protocol.h>
3941
40#define DRIZZLE_UNIX_SOCKET_PATH "/tmp/mysql.socket"42#define DRIZZLE_UNIX_SOCKET_PATH "/var/run/drizzle/mysql.socket"
4143
42namespace po= boost::program_options;44namespace po= boost::program_options;
43namespace fs= boost::filesystem;45namespace fs= boost::filesystem;
@@ -63,18 +65,32 @@
6365
64extern "C" {66extern "C" {
6567
68#ifndef __GNU__
66 char at_exit_socket_file[PATH_MAX]= { 0 };69 char at_exit_socket_file[PATH_MAX]= { 0 };
6770#else
71 // on hurd, there is no such limit.
72 char *at_exit_socket_file = 0;
73#endif
74
68 static void remove_socket_file(void)75 static void remove_socket_file(void)
69 {76 {
77#ifndef __GNU__
70 if (at_exit_socket_file[0])78 if (at_exit_socket_file[0])
79#else
80 if (at_exit_socket_file && at_exit_socket_file[0])
81#endif
71 {82 {
72 if (unlink(at_exit_socket_file) == -1)83 if (unlink(at_exit_socket_file) == -1)
73 {84 {
74 std::cerr << "Could not remove socket: " << at_exit_socket_file << "(" << strerror(errno) << ")" << std::endl;85 std::cerr << "Could not remove socket: " << at_exit_socket_file << "(" << strerror(errno) << ")" << std::endl;
75 }86 }
7687
88#ifndef __GNU__
77 at_exit_socket_file[0]= 0;89 at_exit_socket_file[0]= 0;
90#else
91 free(at_exit_socket_file);
92 at_exit_socket_file = 0;
93#endif
78 }94 }
79 }95 }
80}96}
@@ -92,7 +108,17 @@
92 context.registerVariable(new sys_var_const_string_val("path", fs::system_complete(uds_path).string()));108 context.registerVariable(new sys_var_const_string_val("path", fs::system_complete(uds_path).string()));
93 context.registerVariable(new sys_var_bool_ptr_readonly("clobber", &clobber));109 context.registerVariable(new sys_var_bool_ptr_readonly("clobber", &clobber));
94 context.registerVariable(new sys_var_uint32_t_ptr("max-connections", &Protocol::mysql_unix_counters.max_connections));110 context.registerVariable(new sys_var_uint32_t_ptr("max-connections", &Protocol::mysql_unix_counters.max_connections));
111
112#ifdef __GNU__
113 {
114 size_t s= uds_path_string().c_str().length()+1;
115 if (at_exit_socket_file) free(at_exit_socket_file);
116 at_exit_socket_file = malloc(s);
117 snprintf(at_exit_socket_file, s, "%s", uds_path.string().c_str());
118 }
119#else
95 snprintf(at_exit_socket_file, sizeof(at_exit_socket_file), "%s", uds_path.string().c_str());120 snprintf(at_exit_socket_file, sizeof(at_exit_socket_file), "%s", uds_path.string().c_str());
121#endif
96 atexit(remove_socket_file);122 atexit(remove_socket_file);
97 }123 }
98 else124 else
@@ -165,7 +191,7 @@
165191
166 chmod(_unix_socket_path.string().c_str(),0777);192 chmod(_unix_socket_path.string().c_str(),0777);
167193
168 return false;194return false;
169}195}
170196
171plugin::Client *Protocol::getClient(int fd)197plugin::Client *Protocol::getClient(int fd)

Subscribers

People subscribed via source and target branches

to all changes: