[MacPorts] #41077: mod_jk fails with "source and destination buffer overlap" on Maverick
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick ----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: High | Milestone: Component: ports | Version: 2.2.1 Keywords: | Port: mod_jk ----------------------+-------------------------------- Apple appears to have made strcpy() enforce that the src and dest buffers may not overlap. This makes mod_jk fail. There is a patch upstreams alread. [https://issues.apache.org/bugzilla/show_bug.cgi?id=55696] This patch to the macport just uses the referred patch. Also, set JAVA_HOME using /usr/libexec/java_home for convenience. {{{ --- Portfile.orig 2013-10-30 12:40:54.000000000 +0100 +++ Portfile 2013-10-30 12:43:02.000000000 +0100 @@ -4,6 +4,7 @@ name mod_jk version 1.2.27 +revision 1 categories www java license Apache-2 BSD @@ -39,7 +40,7 @@ if { [llength [array get env "JAVA_HOME"]] > 0 } { set javahome $env(JAVA_HOME) } else { - set javahome "" + set javahome [exec /usr/libexec/java_home] } if { ![file isdirectory ${javahome}] } { if { ${os.platform} == "darwin" } { @@ -72,6 +73,7 @@ } } +patchfiles-append jk_map.c.patch if {[variant_isset universal]} { patchfiles-append configure_universal.patch post-configure { --- /dev/null 2013-10-30 12:43:06.000000000 +0100 +++ files/jk_map.c.patch 2013-10-30 12:42:02.000000000 +0100 @@ -0,0 +1,62 @@ +Index: common/jk_map.c +=================================================================== +--- common/jk_map.c (revision 1535519) ++++ common/jk_map.c (working copy) +@@ -183,33 +183,37 @@ + + int jk_map_get_int(jk_map_t *m, const char *name, int def) + { +- char buf[100]; + const char *rc; +- size_t len; + int int_res; +- int multit = 1; + +- sprintf(buf, "%d", def); +- rc = jk_map_get_string(m, name, buf); ++ rc = jk_map_get_string(m, name, NULL); + +- len = strlen(rc); +- if (len) { +- char *lastchar = &buf[0] + len - 1; +- strcpy(buf, rc); +- if ('m' == *lastchar || 'M' == *lastchar) { +- *lastchar = '\0'; +- multit = 1024 * 1024; ++ if(NULL == rc) { ++ int_res = def; ++ } else { ++ size_t len = strlen(rc); ++ int multit = 1; ++ ++ if (len) { ++ char buf[100]; ++ char *lastchar; ++ strncpy(buf, rc, 100); ++ lastchar = buf + len - 1; ++ if ('m' == *lastchar || 'M' == *lastchar) { ++ *lastchar = '\0'; ++ multit = 1024 * 1024; ++ } ++ else if ('k' == *lastchar || 'K' == *lastchar) { ++ *lastchar = '\0'; ++ multit = 1024; ++ } ++ int_res = multit * atoi(buf); + } +- else if ('k' == *lastchar || 'K' == *lastchar) { +- *lastchar = '\0'; +- multit = 1024; +- } +- int_res = atoi(buf); ++ else ++ int_res = def; + } +- else +- int_res = def; + +- return int_res * multit; ++ return int_res; + } + + double jk_map_get_double(jk_map_t *m, const char *name, double def) }}} -- Ticket URL: <https://trac.macports.org/ticket/41077> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Changes (by ryandesign@…): * keywords: => mavericks haspatch * priority: High => Normal -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:1> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by robertoschwald@…): Why was the priority changed to normal? This is a full stopper for all apache2 with mod_jk installations. apache2 crashes with the mentioned error after upgrade outdated.. -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:2> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by robertoschwald@…): Patch works here. Thanks for that. -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:3> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by robertoschwald@…): I just saw that there is no maintainer for the port. I would like to take over maintenance so we have a fix asap. -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:4> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by larryv@…): Replying to [comment:2 robertoschwald@…]:
Why was the priority changed to normal? This is a full stopper for all apache2 with mod_jk installations. apache2 crashes with the mentioned error after upgrade outdated..
We generally reserve High priority for security issues. -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:5> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by raimue@…): The statement {{{ set javahome [exec /usr/libexec/java_home] }}} looks wrong to me. What if there is no Java SDK installed on the system? Won't this lead to an error here? Could it be a shim that pops up the automatic installation dialog? Or is it guaranteed that his binary always exists on all versions of Mac OS X? Not sure what to make of this. Furthermore, the whole detection seems to be required for the +jni variant, which probably links against the Java runtime specified with `${javahome}`. But what happens if I change the system default Java runtime? I am aware this issue existed before this change, just writing down what I see as I am looking at the port. Upstream raised [https://issues.apache.org/bugzilla/show_bug.cgi?id=55696#c11 some concerns] about the use of strncpy(3) in the patch. I agree with them and would recommend to use strlcpy(3), which would most probably not be portable to Linux/glibc, but works fine on various *BSD versions and OS X. Updated patch attached. -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:6> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by girgen@…): The strlcpy patch looks great to me, absolutely an improvement. java_home is only required by +jni, so the line javahome check should only be run in case of variant +jni. Patch applied. -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:7> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by larryv@…): Replying to [comment:6 raimue@…]:
The statement {{{ set javahome [exec /usr/libexec/java_home] }}} looks wrong to me. What if there is no Java SDK installed on the system? Won't this lead to an error here? Could it be a shim that pops up the automatic installation dialog?
In that case, [https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPa... this command] will just print some default path, which is probably not the behavior we want. To error out if no JDK is installed, we should use: {{{ /usr/libexec/java_home --failfast }}} -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:8> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by robertoschwald@…): Upstream fixed the bug: https://issues.apache.org/bugzilla/show_bug.cgi?id=55696 Fixed with mod_jk 1.2.40 which will be released, soon. -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:11> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by girgen@…): Replying to [comment:11 robertoschwald@…]:
Upstream fixed the bug: https://issues.apache.org/bugzilla/show_bug.cgi?id=55696
Fixed with mod_jk 1.2.40 which will be released, soon.
OK, 1.2.40 is released. I've attached a patch [mod_jk.3.diff] that updates the port. JNI stuff is removed from mod_jk since 1.2.29 [ish], so I removed the stuff about JAVA_HOME completely. There is no dependency on java anymore, only tomcat requires that. Also, since the port is orphan, I add myself as maintainer. It would be the first macport I'd maintain, my experience in this field lies mainly with FreeBSD ports, but since we use Mac for development, I have a personal and professional interest in the mod_jk port being up-to-date on mac... -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:12> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by robertoschwald@…): Any chance a committer releases a new version, soon? This bug is open since 8 months and is still a full-stopper. Thanks. -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:13> MacPorts <http://www.macports.org/> Ports system for OS X
#41077: mod_jk fails with "source and destination buffer overlap" on Maverick -----------------------+-------------------------------- Reporter: girgen@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: mavericks haspatch Port: mod_jk | -----------------------+-------------------------------- Comment (by mf2k@…): This patch does not work for me: {{{ $ sudo port install mod_jk ---> Computing dependencies for mod_jk ---> Fetching archive for mod_jk ---> Attempting to fetch mod_jk-1.2.40_0.darwin_13.x86_64.tbz2 from http://packages.macports.org/mod_jk ---> Attempting to fetch mod_jk-1.2.40_0.darwin_13.x86_64.tbz2 from http://lil.fr.packages.macports.org/mod_jk ---> Attempting to fetch mod_jk-1.2.40_0.darwin_13.x86_64.tbz2 from http://nue.de.packages.macports.org/macports/packages/mod_jk ---> Fetching distfiles for mod_jk ---> Attempting to fetch tomcat-connectors-1.2.40-src.tar.gz from http://sea.us.distfiles.macports.org/macports/distfiles/mod_jk ---> Attempting to fetch tomcat-connectors-1.2.40-src.tar.gz from http://distfiles.macports.org/mod_jk ---> Attempting to fetch tomcat-connectors-1.2.40-src.tar.gz from http://www.apache.org/dist/tomcat/tomcat-connectors/jk ---> Verifying checksums for mod_jk ---> Extracting mod_jk ---> Configuring mod_jk ---> Building mod_jk ---> Staging mod_jk into destroot Error: Failed to destroot mod_jk: xinstall: Cannot stat: /opt/local/var/macports/build/_opt_mports_trunk_dports_www_mod_jk/mod_jk/work /tomcat-connectors-1.2.40-src/native/apache-2.0/mod_jk.so, No such file or directory Error: See /opt/local/var/macports/logs/_opt_mports_trunk_dports_www_mod_jk/mod_jk/main.log for details. Error: Follow http://guide.macports.org/#project.tickets to report a bug. Error: Processing of port mod_jk failed }}} -- Ticket URL: <https://trac.macports.org/ticket/41077#comment:14> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts