Skip to content

Commit

Permalink
build: avoid passing empty strings to build flags
Browse files Browse the repository at this point in the history
While checking the return values from icu-i18n, we didn't
validate the content before passing it to the build system.

Also make cflags parsing more robust by avoiding empty strings.

Fixes: nodejs#1787
  • Loading branch information
jbergstroem committed May 25, 2015
1 parent ba76a9d commit bf3d017
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,8 @@ def configure_library(lib, output):
if default_libpath:
default_libpath = '-L' + default_libpath
(pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib)
cflags = pkg_cflags.split('-I') if pkg_cflags else default_cflags
# Remove empty strings from the list of include_dirs
cflags = filter(None, pkg_cflags.split('-I')) if pkg_cflags else default_cflags
libs = pkg_libs if pkg_libs else default_lib
libpath = pkg_libpath if pkg_libpath else default_libpath

Expand Down Expand Up @@ -846,10 +847,12 @@ def configure_intl(o):
sys.exit(1)
(libs, cflags, libpath) = pkgicu
# libpath provides linker path which may contain spaces
o['libraries'] += [libpath]
if libpath:
o['libraries'] += [libpath]
# safe to split, cannot contain spaces
o['libraries'] += libs.split()
o['cflags'] += cflags.split()
if cflags:
o['cflags'] += filter(None, cflags.split('-I'))
# use the "system" .gyp
o['variables']['icu_gyp_path'] = 'tools/icu/icu-system.gyp'
return
Expand Down

0 comments on commit bf3d017

Please sign in to comment.