Bug 45343 - apxs filters out ':' chars from environment variables
Summary: apxs filters out ':' chars from environment variables
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Build (show other bugs)
Version: 2.2.15
Hardware: All All
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: FixedInTrunk
Depends on:
Reported: 2008-07-04 05:38 UTC by Francois LAUPRETRE
Modified: 2010-05-14 14:45 UTC (History)
2 users (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Francois LAUPRETRE 2008-07-04 05:38:49 UTC
Happens on AIX but could happen anywhere an environment variable (CPPFLAGS, LDFLAGS,...) contains a ':' character.

The case : On AIX, the LDFLAGS variable I use contains '-Wl,-blibpath:/build/common'. Apache compiles OK and sets the value correctly in config_vars.mk. But, when getting the value back from apxs ('apxs -q LDFLAGS'), it returns '-Wl,-blibpath /build/common', replacing the first ':' with a space.

So, when trying to link with this string (as when linking mod_jk), the linker crashes with a message 'ld: 0706-015 The -b libpath option needs a parameter', which is correct as the linker uses ':' as a separator, and does not understand the space.

Tracing the problem into apxs, it comes from a substitution at the end of sub get_vars, which says :

$result =~ s|:| |;

Commenting this line out, everything works fine for me. The problem is that, if the code contains this substitution, there must be a reason...
Comment 1 Bill Cole 2010-05-07 15:11:17 UTC
This bug is fully cross-platform, and persists in 2.2.15.  It also causes builds that use apxs (including mod_jk) to fail on FreeBSD whenever the LDFLAGS include a multi-element rpath argument, because those elements are colon-delimited. 

As originally reported, the cause of this breakage is one undocumented line in apxs substituting space for colon with no obvious justification. The value being mangled is ultimately read from config_vars.mk, which is entirely  variable assignments in 'make' syntax. I see nowhere in apxs that a colon would be added to the string parsed out of that file, and such a substitution does not make any sense from the perspective of make's assignment syntax. 

The bug can be fixed with this patch:

 --- support/apxs.in.orig	2006-07-11 20:38:44.000000000 -0700
+++ support/apxs.in.fixed	2010-05-07 11:39:18.768583424 -0700
@@ -253,7 +253,6 @@
     $result =~ s|;;$||;
-    $result =~ s|:| |;
     return $result;
Comment 2 Jeff Trawick 2010-05-14 14:45:26 UTC
fixed in trunk r944383