Permalink
Browse files

Shore up a number of shell quoting issues

When interpolating in strings passed to Formula#system, it should be
done in such a way that if any interpolated variables contain spaces,
they are either (a) passed as part of a list or (b) protected by quotes
if they are part of a long string (which is subject to shell expansion).
Otherwise, they will be split on the space when expanded by the shell
and passed as multiple arguments to whatever process is being executed.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
  • Loading branch information...
1 parent 5d32174 commit 417d7880702a645a5efd272a42dd03a8e7419035 @jacknagel jacknagel committed May 15, 2012
Showing with 110 additions and 104 deletions.
  1. +3 −3 Library/Formula/abcde.rb
  2. +1 −1 Library/Formula/asciitex.rb
  3. +1 −1 Library/Formula/assimp.rb
  4. +3 −3 Library/Formula/audiofile.rb
  5. +1 −1 Library/Formula/avanor.rb
  6. +1 −1 Library/Formula/bibutils.rb
  7. +1 −1 Library/Formula/camlp5.rb
  8. +1 −1 Library/Formula/catdoc.rb
  9. +4 −1 Library/Formula/cd-discid.rb
  10. +1 −1 Library/Formula/cfitsio.rb
  11. +1 −1 Library/Formula/chuck.rb
  12. +1 −1 Library/Formula/clam.rb
  13. +1 −1 Library/Formula/clay.rb
  14. +1 −1 Library/Formula/clhep.rb
  15. +2 −2 Library/Formula/couchdb-lucene.rb
  16. +1 −1 Library/Formula/daemon.rb
  17. +1 −1 Library/Formula/direnv.rb
  18. +1 −1 Library/Formula/dnsmasq.rb
  19. +1 −1 Library/Formula/dvtm.rb
  20. +1 −1 Library/Formula/dwm.rb
  21. +1 −1 Library/Formula/eigen.rb
  22. +4 −4 Library/Formula/freeimage.rb
  23. +1 −1 Library/Formula/git-sh.rb
  24. +1 −1 Library/Formula/git-url-sub.rb
  25. +1 −1 Library/Formula/gitslave.rb
  26. +1 −1 Library/Formula/httping.rb
  27. +1 −1 Library/Formula/innotop.rb
  28. +1 −1 Library/Formula/iodine.rb
  29. +1 −1 Library/Formula/ioping.rb
  30. +1 −1 Library/Formula/jbigkit.rb
  31. +1 −1 Library/Formula/john.rb
  32. +1 −1 Library/Formula/jruby.rb
  33. +1 −1 Library/Formula/lasi.rb
  34. +1 −1 Library/Formula/latex2rtf.rb
  35. +1 −1 Library/Formula/lcov.rb
  36. +1 −1 Library/Formula/ledger.rb
  37. +3 −2 Library/Formula/ledit.rb
  38. +1 −1 Library/Formula/libmusicbrainz.rb
  39. +1 −1 Library/Formula/libplist.rb
  40. +1 −1 Library/Formula/libutf.rb
  41. +1 −1 Library/Formula/magit.rb
  42. +1 −1 Library/Formula/mg.rb
  43. +1 −1 Library/Formula/mhash.rb
  44. +1 −1 Library/Formula/mkvtoolnix.rb
  45. +1 −1 Library/Formula/mongrel2.rb
  46. +1 −1 Library/Formula/mupdf.rb
  47. +1 −1 Library/Formula/mytop.rb
  48. +1 −1 Library/Formula/nacl.rb
  49. +3 −3 Library/Formula/noweb.rb
  50. +3 −3 Library/Formula/nss.rb
  51. +2 −2 Library/Formula/num-utils.rb
  52. +1 −1 Library/Formula/o-make.rb
  53. +1 −1 Library/Formula/objective-caml.rb
  54. +1 −1 Library/Formula/opentracker.rb
  55. +1 −1 Library/Formula/parmetis.rb
  56. +1 −1 Library/Formula/percona-toolkit.rb
  57. +9 −3 Library/Formula/polipo.rb
  58. +1 −1 Library/Formula/poppler.rb
  59. +1 −1 Library/Formula/putty.rb
  60. +1 −1 Library/Formula/pyside.rb
  61. +1 −1 Library/Formula/qhull.rb
  62. +1 −1 Library/Formula/rakudo-star.rb
  63. +4 −7 Library/Formula/sbcl.rb
  64. +1 −1 Library/Formula/sc68.rb
  65. +1 −2 Library/Formula/sedna.rb
  66. +1 −1 Library/Formula/sigar.rb
  67. +1 −1 Library/Formula/sipp.rb
  68. +1 −1 Library/Formula/tabbed.rb
  69. +1 −1 Library/Formula/unifdef.rb
  70. +4 −4 Library/Formula/vtk.rb
  71. +1 −1 Library/Formula/wxmac.rb
  72. +1 −1 Library/Formula/xmp.rb
  73. +1 −1 Library/Formula/xspringies.rb
  74. +2 −2 Library/Formula/zeromq.rb
  75. +3 −3 Library/Formula/zint.rb
@@ -14,8 +14,8 @@ class Abcde < Formula
depends_on 'mkcue'
def install
- # Makefile hardcodes installing files owned by root; don't do this.
- inreplace 'Makefile', '-o 0', ''
- system "export prefix=#{prefix};export DESTDIR=$prefix;make -e install"
+ bin.install 'abcde', 'cddb-tool'
+ etc.install 'abcde.conf' unless (etc/'abcde.conf').exist?
@adamv
adamv May 15, 2012

Maybe we need a "try_install" method.

+ man1.install 'abcde.1', 'cddb-tool.1'
end
end
@@ -13,6 +13,6 @@ def install
end
def test
- system "#{bin}/asciiTeX -f #{prefix}/EXAMPLES"
+ system "#{bin}/asciiTeX", "-f", "#{prefix}/EXAMPLES"
end
end
@@ -14,6 +14,6 @@ def install
end
def test
- system "#{bin}/assimp version"
+ system "#{bin}/assimp", "version"
end
end
@@ -47,9 +47,9 @@ def test
end
mktemp do
- system "#{conv_bin} #{inn} #{out} format wave"
- system "#{info_bin} --short --reporterror #{out}"
- system "#{hear_bin} -p #{out}" if ARGV.verbose?
+ system conv_bin, inn, out, 'format', 'wave'
+ system info_bin, '--short', '--reporterror', out
+ system hear_bin, '-p', out if ARGV.verbose?
end
end
end
@@ -11,7 +11,7 @@ def install
s.gsub! "LD = gpp", "LD = cpp"
end
- system "make DATA_DIR=#{share}/avanor/"
+ system "make", "DATA_DIR=#{share}/avanor/"
bin.install "avanor"
(share+"avanor").install "manual"
end
@@ -6,7 +6,7 @@ class Bibutils < Formula
md5 '395f46393eca8e184652c5e8e1ae83b6'
def install
- system "./configure --install-dir #{prefix}"
+ system "./configure", "--install-dir", prefix
# The configure script replaces the CC variable wrong, so fix it here
inreplace 'Makefile' do |s|
@@ -20,7 +20,7 @@ def install
strictness = "-transitional"
end
- system "./configure -prefix #{prefix} -mandir #{man} #{strictness}"
+ system "./configure", "-prefix", prefix, "-mandir", man, strictness
# this build fails if jobs are parallelized
ENV.deparallelize
system "make world.opt"
@@ -8,7 +8,7 @@ class Catdoc < Formula
def install
# catdoc configure says it respects --mandir=, but does not.
ENV['man1dir'] = man1
- system "./configure --disable-debug --disable-dependency-tracking --prefix=#{prefix}"
+ system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}"
# The INSTALL file confuses make on case insensitive filesystems.
system "mv INSTALL INSTALL.txt"
system "make"
@@ -12,6 +12,9 @@ def patches
end
def install
- system "export prefix=#{prefix}; make -e install"
+ system "make", "prefix=#{prefix}",
+ "CC=#{ENV.cc}",
+ "CFLAGS=#{ENV.cflags}",
+ "install"
end
end
@@ -31,7 +31,7 @@ def install
Dir['*.c'].each do |f|
# compressed_fits.c does not work (obsolete function call)
next if f == 'compress_fits.c'
- system "#{ENV.cc} #{f} -I#{include} -L#{lib} -lcfitsio -lm -o bin/#{f.sub('.c','')}"
+ system ENV.cc, f, "-I#{include}", "-L#{lib}", "-lcfitsio", "-lm", "-o", "bin/#{f.sub('.c', '')}"
end
bin.install Dir['bin/*']
end
@@ -6,7 +6,7 @@ class Chuck < Formula
md5 'ac8459b4067c2491fbdeb61d122a5985'
def install
- system "make -C src/ osx-#{Hardware.cpu_type}"
+ system "make", "-C", "src", "osx-#{Hardware.cpu_type}"
bin.install "src/chuck"
(share+'chuck').install "examples/"
end
@@ -16,7 +16,7 @@ class Clam < Formula
depends_on 'id3lib'
def install
- system "scons configure prefix=#{prefix} with_ladspa=no xmlbackend=none"
+ system "scons", "configure", "prefix=#{prefix}", "with_ladspa=no", "xmlbackend=none"
system "scons"
system "scons install"
end
@@ -16,6 +16,6 @@ def install
end
def test
- system "#{bin}/clay -e 'println(\"Hello, Clay!\");'"
+ system "#{bin}/clay", "-e", "println(\"Hello, Clay!\");"
end
end
@@ -9,7 +9,7 @@ class Clhep < Formula
def install
mkdir 'clhep-build' do
- system "cmake #{std_cmake_parameters} -DCMAKE_PREFIX_PATH=#{prefix} ../CLHEP"
+ system "cmake #{std_cmake_parameters} -DCMAKE_PREFIX_PATH='#{prefix}' ../CLHEP"
system "make install"
end
end
@@ -11,8 +11,8 @@ class CouchdbLucene < Formula
def install
system "mvn"
- system "tar -xzf target/couchdb-lucene-#{version}-dist.tar.gz"
- system "mv couchdb-lucene-#{version}/* #{prefix}"
+ system "tar", "-xzf", "target/couchdb-lucene-#{version}-dist.tar.gz"
+ prefix.install Dir["couchdb-lucene-#{version}/*"]
(etc + "couchdb/local.d/couchdb-lucene.ini").write ini_file
plist_path.write startup_plist
@@ -8,7 +8,7 @@ class Daemon < Formula
def install
system "./config"
system "make"
- system "make PREFIX=#{prefix} install"
+ system "make", "PREFIX=#{prefix}", "install"
end
def test
@@ -8,7 +8,7 @@ class Direnv < Formula
head 'https://github.com/zimbatm/direnv.git'
def install
- system "make install DESTDIR=#{prefix}"
+ system "make", "install", "DESTDIR=#{prefix}"
end
def caveats; <<-EOS.undent
@@ -28,7 +28,7 @@ def install
s.change_make_var! "CFLAGS", ENV.cflags
end
- system "make install PREFIX=#{prefix}"
+ system "make", "install", "PREFIX=#{prefix}"
prefix.install "dnsmasq.conf.example"
plist_path.write startup_plist
@@ -9,6 +9,6 @@ class Dvtm < Formula
def install
inreplace 'config.mk', 'LIBS = -lc -lutil -lncursesw', 'LIBS = -lc -lutil -lncurses'
inreplace 'Makefile', 'strip -s', 'strip'
- system "make PREFIX=#{prefix} install"
+ system "make", "PREFIX=#{prefix}", "install"
end
end
@@ -13,7 +13,7 @@ def install
'{ MODKEY|ShiftMask, XK_q, quit, {0} },',
'{ MODKEY|ControlMask, XK_q, quit, {0} },'
inreplace 'dwm.1', '.B Mod1\-Shift\-q', '.B Mod1\-Control\-q'
- system "make PREFIX=#{prefix} install"
+ system "make", "PREFIX=#{prefix}", "install"
end
def caveats
@@ -10,7 +10,7 @@ class Eigen < Formula
def install
ENV.fortran
mkdir 'eigen-build' do
- system "cmake #{std_cmake_parameters} -DCMAKE_BUILD_TYPE=Release -Dpkg_config_libdir=#{lib} .."
+ system "cmake #{std_cmake_parameters} -DCMAKE_BUILD_TYPE=Release -Dpkg_config_libdir='#{lib}' .."
system "make install"
end
end
@@ -25,10 +25,10 @@ def patches
def install
ENV.universal_binary if ARGV.build_universal?
- system "gnumake -f Makefile.gnu"
- system "gnumake -f Makefile.gnu install PREFIX=#{prefix}"
- system "gnumake -f Makefile.fip"
- system "gnumake -f Makefile.fip install PREFIX=#{prefix}"
+ system "make", "-f", "Makefile.gnu"
+ system "make", "-f", "Makefile.gnu", "install", "PREFIX=#{prefix}"
+ system "make", "-f", "Makefile.fip"
+ system "make", "-f", "Makefile.fip", "install", "PREFIX=#{prefix}"
end
end
@@ -13,6 +13,6 @@ class GitSh < Formula
def install
system "make"
- system "make install PREFIX=#{prefix}"
+ system "make", "install", "PREFIX=#{prefix}"
end
end
@@ -6,6 +6,6 @@ class GitUrlSub < Formula
md5 '5d2dad29dcd53eedc0730f42014bec51'
def install
- system "make install PREFIX=#{prefix}"
+ system "make", "install", "PREFIX=#{prefix}"
end
end
@@ -6,6 +6,6 @@ class Gitslave < Formula
md5 '7fed63110ae1a656af10462f60592000'
def install
- system "make install prefix=#{prefix}"
+ system "make", "install", "prefix=#{prefix}"
end
end
@@ -11,6 +11,6 @@ def patches
end
def install
- system "make install PREFIX=#{prefix}"
+ system "make", "install", "PREFIX=#{prefix}"
end
end
@@ -8,7 +8,7 @@ class Innotop < Formula
depends_on 'DBD::mysql' => :perl
def install
- system "perl Makefile.PL PREFIX=#{prefix}"
+ system "perl", "Makefile.PL", "PREFIX=#{prefix}"
system "make install"
end
end
@@ -11,6 +11,6 @@ def install
"arpa/nameser8_compat", "arpa/nameser_compat"
end
- system "make install prefix=#{prefix}"
+ system "make", "install", "prefix=#{prefix}"
end
end
@@ -8,6 +8,6 @@ class Ioping < Formula
def install
system "make"
- system "make install PREFIX=#{prefix}"
+ system "make", "install", "PREFIX=#{prefix}"
end
end
@@ -38,7 +38,7 @@ def install
def test
mktemp do
system "#{bin}/jbgtopbm #{prefix}/examples/ccitt7.jbg | #{bin}/pbmtojbg - testoutput.jbg"
- system "/usr/bin/cmp #{prefix}/examples/ccitt7.jbg testoutput.jbg"
+ system "/usr/bin/cmp", "#{prefix}/examples/ccitt7.jbg", "testoutput.jbg"
end
end
end
@@ -16,7 +16,7 @@ def install
arch = Hardware.is_64_bit? ? '64' : 'sse2'
cd 'src' do
- system "make clean macosx-x86-#{arch}"
+ system "make", "clean", "macosx-x86-#{arch}"
end
rm 'README'
@@ -28,6 +28,6 @@ def install
end
def test
- system "#{bin}/jruby -e 'puts \"hello\"'"
+ system "#{bin}/jruby", "-e", "puts 'hello'"
end
end
@@ -13,7 +13,7 @@ class Lasi < Formula
depends_on 'doxygen'
def install
- system "cmake -DCMAKE_INSTALL_PREFIX=#{prefix} ."
+ system "cmake -DCMAKE_INSTALL_PREFIX='#{prefix}' ."
system "make install"
end
end
@@ -11,6 +11,6 @@ def install
s.change_make_var! 'MAN_INSTALL', man1
end
- system "make PREFIX=#{prefix} install"
+ system "make", "PREFIX=#{prefix}", "install"
end
end
@@ -9,7 +9,7 @@ def install
%w(bin/gendesc bin/genhtml bin/geninfo bin/genpng bin/lcov).each do |file|
inreplace file, '/etc/lcovrc', "#{prefix}/etc/lcovrc"
end
- system "make PREFIX=#{prefix} install"
+ system "make", "PREFIX=#{prefix}", "install"
end
def patches
@@ -28,7 +28,7 @@ def install
# gmp installs x86_64 only
inreplace 'acprep', "'-arch', 'i386', ", "" if Hardware.is_64_bit?
no_python = ((ARGV.include? '--no-python') ? '--no-python' : '')
- system "./acprep #{no_python} -j#{ENV.make_jobs} opt make -- --prefix=#{prefix}"
+ system "./acprep", no_python, "-j#{ENV.make_jobs}", "opt", "make", "--", "--prefix=#{prefix}"
end
system 'make'
ENV.deparallelize
@@ -11,7 +11,8 @@ class Ledit < Formula
def install
# like camlp5, this build fails if the jobs are parallelized
ENV.deparallelize
- system "make BINDIR=#{bin} LIBDIR=#{lib} MANDIR=#{man}"
- system "make install BINDIR=#{bin} LIBDIR=#{lib} MANDIR=#{man}"
+ args = %W[BINDIR=#{bin} LIBDIR=#{lib} MANDIR=#{man}]
+ system "make", *args
+ system "make", "install", *args
end
end
@@ -10,7 +10,7 @@ class Libmusicbrainz < Formula
def install
neon = Formula.factory("neon")
- neon_args = "-DNEON_LIBRARIES:FILEPATH=#{neon.lib}/libneon.dylib -DNEON_INCLUDE_DIR:PATH=#{neon.include}/neon"
+ neon_args = "-DNEON_LIBRARIES:FILEPATH='#{neon.lib}/libneon.dylib' -DNEON_INCLUDE_DIR:PATH='#{neon.include}/neon'"
system "cmake #{std_cmake_parameters} #{neon_args} ."
system "make install"
@@ -16,7 +16,7 @@ def patches
def install
ENV.deparallelize # make fails on an 8-core Mac Pro
- system "cmake #{std_cmake_parameters} -DCMAKE_INSTALL_NAME_DIR=#{lib} ."
+ system "cmake #{std_cmake_parameters} -DCMAKE_INSTALL_NAME_DIR='#{lib}' ."
system "make install"
# Remove 'plutil', which duplicates the system-provided one. Leave the versioned one, though.
@@ -8,6 +8,6 @@ class Libutf < Formula
def install
inreplace 'Makefile', 'man/man7', 'share/man/man7'
- system "make PREFIX=#{prefix} install"
+ system "make", "PREFIX=#{prefix}", "install"
end
end
@@ -7,6 +7,6 @@ class Magit < Formula
head 'https://github.com/magit/magit.git'
def install
- system "make install DESTDIR=#{prefix} PREFIX="
+ system "make", "install", "DESTDIR=#{prefix}", "PREFIX="
end
end
@@ -9,6 +9,6 @@ def install
# -Wno-error=unused-but-set-variable requires GCC 4.6+
inreplace 'Makefile.in', '-Wno-error=unused-but-set-variable', ''
system "./configure"
- system "make install prefix=#{prefix} mandir=#{man}"
+ system "make", "install", "prefix=#{prefix}", "mandir=#{man}"
end
end
@@ -6,7 +6,7 @@ class Mhash < Formula
md5 'ee66b7d5947deb760aeff3f028e27d25'
def install
- system "./configure --prefix=#{prefix} --disable-debug --disable-dependency-tracking"
+ system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
system "make install"
end
end
@@ -21,7 +21,7 @@ def install
"--prefix=#{prefix}",
"--with-boost-libdir=#{HOMEBREW_PREFIX}/lib", # For non-/usr/local prefix
"--with-boost-regex=boost_regex-mt" # via macports
- system "./drake -j#{ENV.make_jobs}"
+ system "./drake", "-j#{ENV.make_jobs}"
system "./drake install"
end
end
Oops, something went wrong. Retry.

0 comments on commit 417d788

Please sign in to comment.