Tolerate pathnames with spaces
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 24 Jul 2021 13:32:04 +0000 (15:32 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 24 Jul 2021 18:46:02 +0000 (20:46 +0200)
Reported by: Vivien Kraus

12 files changed:
Makefile.am
doc/automake.mk
perl-module/Makefile.PL
perl-module/automake.mk
src/automake.mk
src/language/expressions/automake.mk
src/language/stats/automake.mk
tests/language/stats/npar.at
tests/libpspp/zip.at
tests/output/tex.at
tests/perl-module.at
tests/ui/syntax-gen.at

index 8b44e82efcd760cfbd17ac186e088339494b3d8e..b571440544eea389860dda85ffab45d3b32ce8a4 100644 (file)
@@ -24,8 +24,8 @@ BUILT_SOURCES =
 built-sources: $(BUILT_SOURCES)
 
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/gl \
-       -I$(top_builddir)/gl \
+       -I"$(top_srcdir)/gl" \
+       -I"$(top_builddir)/gl" \
        -DINSTALLDIR=\"$(bindir)\"
 
 AM_V_P ?= :
index b928691085d4ecefd4d0556dfbba6b13ede7ced6..3206beb25e28ad9d953a109ec0dd76987db22892 100644 (file)
@@ -206,8 +206,8 @@ endif
 
 $(FIGURE_SPVS): $(pspp)
 .sps.spv:
-       $(AM_V_GEN)(cd $(top_srcdir)/examples \
-         && $(abs_top_builddir)/$(pspp) ../doc/pspp-figures/$(<F) -o - -O format=spv) > $@.tmp
+       $(AM_V_GEN)(cd "$(top_srcdir)/examples" \
+         && "$(abs_top_builddir)/$(pspp)" ../doc/pspp-figures/$(<F) -o - -O format=spv) > $@.tmp
        $(AM_V_at)mv $@.tmp $@
 
 # In some cases, the tutorial only wants some parts of the output.
index 9081d007f5fe9363621eebfc359bd014aa57d5e3..3d02cdc9a96fed72759e51b86cbcd77c610097ed 100644 (file)
@@ -28,6 +28,7 @@ do './pspp-module-config' || do {
 };
 
 WriteMakefile(
+    MAKEFILE          => 'MakefileX',
     FULLPERL          => "PSPP_TEST_CMD=\"$Locations{BuildDir}/src/ui/terminal/pspp\" \$(PERL)",
     NAME              => 'PSPP',
     DISTNAME          => 'PSPP-Perl',
index ea1a47c7c2e838504c2d42e820d2cc9867a68fb0..96e24acde459944cbe9d0a637a8c08c837da9eb0 100644 (file)
@@ -36,12 +36,15 @@ PERL_MAKEFLAGS = $(AM_MAKEFLAGS) LD_RUN_PATH=$(pkglibdir)
 perl-module/pspp-module-config: Makefile
        $(AM_V_GEN)(echo '%Locations = (';\
         printf "  SourceDir => '";\
-        (cd $(top_srcdir) && echo `pwd`\', ) ;\
+        (cd "$(top_srcdir)" && echo `pwd`\', ) ;\
         printf "  BuildDir => '";\
-        (cd $(top_builddir) && echo `pwd`\' );\
-        echo ');') > $(top_builddir)/perl-module/pspp-module-config
+        (cd "$(top_builddir)" && echo `pwd`\' );\
+        echo ');') > "$(top_builddir)/perl-module/pspp-module-config"
 
-perl-module/Makefile: perl-module/Makefile.PL perl-module/pspp-module-config $(module_sources)
+perl-module/Makefile: perl-module/MakefileX
+       $(SED)  -e "/^INC/s/\([^=]\)  *-I/\1\" -I/g" -e "/^INC/s/  *-I */ -I\"/g" -e "/^INC/s/ *$$/\"/" -e "/^MYEXTLIB/s/\([^=]\) \([^=]\)/\1\\\\ \2/g" $< > $@
+
+perl-module/MakefileX: perl-module/Makefile.PL perl-module/pspp-module-config $(module_sources)
        $(AM_V_GEN)cd perl-module && $(PERL) Makefile.PL PREFIX=$(prefix) \
                                                          OPTIMIZE="$(CFLAGS) $(CPPFLAGS)" \
                                                          LD="`$(PERL) -e 'use Config::Perl::V;print Config::Perl::V::myconfig()->{config}{ld};'` $(LDFLAGS)"
@@ -80,7 +83,7 @@ perl_module_clean:
        if test x"$(top_builddir)" != x"$(top_srcdir)" ; then \
          rm -f $(module_sources) ; \
        fi
-       rm -f perl-module/Makefile.old
+       rm -f perl-module/Makefile.old perl-module/MakefileX perl-module/MakefileX.old perl-module/Makefile
 
 CLEANFILES += \
         perl-module/PSPP-Perl-$(VERSION_FOR_PERL).tar.gz \
index 1dd598f159598309ce214a73b69249bfb1a8dd7e..c8f775c1e8177d4f8ab5e7bb75595032487b5d5a 100644 (file)
@@ -23,7 +23,7 @@ include $(top_srcdir)/src/data/automake.mk
 
 
 
-AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/lib
+AM_CPPFLAGS += -I"$(top_srcdir)/src" -I"$(top_srcdir)/lib"
 
 
 pkglib_LTLIBRARIES = src/libpspp-core.la src/libpspp.la
index e741f5adbecac179060b1bbc5a394b68abf8737e..4d2b4b70ccd0fbe47eb0bab6ecc1d21274011f9e 100644 (file)
@@ -43,8 +43,8 @@ $(expressions_built_sources): $(helpers)
        $(AV_V_GEN)$(MKDIR_P) `dirname $@` && \
        $(PERL) $< -o $@ -i $(top_srcdir)/src/language/expressions/operations.def
 
-AM_CPPFLAGS += -I$(abs_top_builddir)/src/language/expressions \
-       -I$(top_srcdir)/src/language/expressions
+AM_CPPFLAGS += -I"$(abs_top_builddir)/src/language/expressions" \
+       -I"$(top_srcdir)/src/language/expressions"
 
 EXTRA_DIST += src/language/expressions/TODO
 
index cc74ff4f3c7bbe9b0ef372dc9b3860b1a8da34d0..88c64abece70b25a811bd52682b210597843711b 100644 (file)
@@ -16,7 +16,7 @@
 #
 ## Process this file with automake to produce Makefile.in  -*- makefile -*-
 
-AM_CPPFLAGS += -I$(top_srcdir)/src/language/stats
+AM_CPPFLAGS += -I"$(top_srcdir)/src/language/stats"
 
 language_stats_sources = \
        src/language/stats/aggregate.c \
index 975d993771fea3abe896c78619235dc71bbefd88..be770ab1b17c74305b41c6c0928186b794c30e99 100644 (file)
@@ -1045,7 +1045,7 @@ AT_SETUP([NPAR TESTS Mann-Whitney Multiple])
 dnl Check for a bug where the ranks were inappropriately allocated, when
 dnl multiple variables were tested and MISSING=ANALYSIS chosen.
 
-cp $abs_srcdir/language/mann-whitney.txt .
+cp "$abs_srcdir/language/mann-whitney.txt" .
 
 AT_DATA([npar-mann-whitney.sps], [dnl
 SET FORMAT     = F11.3
index 77ca00e1c68cb38e16388b1ecd7f3f5c9df8d3d8..5b21d50f5854791e06b60a6424c069a170da3ddc 100644 (file)
@@ -22,36 +22,36 @@ here=`pwd`
 dir1=$here/original
 dir2=$here/recovered
 
-mkdir -p $dir1
+mkdir -p "$dir1"
 
 # Generate files of differing sizes with random data in them
 names=""
 s=1;
 while test $s -le 8192 ; do
-       name=$dir1/$s
-       dd if=/dev/urandom of=$name count=1 bs=$s 2> /dev/null
+       name="$dir1/$s"
+       dd if=/dev/urandom of="$name" count=1 bs=$s 2> /dev/null
        s=$(($s * 2));
-       bn=`basename $name`;
+       bn=`basename "$name"`;
         names="$names $bn";
 done
 
-AT_CHECK([cd $dir1 && zip-test w foo.zip $names])
+AT_CHECK([cd "$dir1" && zip-test w foo.zip $names])
 
 # If zipinfo is installed, make sure it can read the zipfile.
 if (zipinfo -v) >/dev/null 2>&1; then
-    AT_CHECK([zipinfo $dir1/foo.zip], [0], [ignore])
+    AT_CHECK([zipinfo "$dir1/foo.zip"], [0], [ignore])
 fi
 
-mkdir -p $dir2
-cp $dir1/foo.zip $dir2
-cd $dir2
+mkdir -p "$dir2"
+cp "$dir1/foo.zip" "$dir2"
+cd "$dir2"
 
 AT_CHECK([zip-test r foo.zip $names])
 
 AT_CHECK([
     # Compare the files to their originals
     for f in $names; do
-     diff $dir1/$f $dir2/$f;
+     diff "$dir1/$f" "$dir2/$f";
      if test $? -ne 0 ; then exit 1; fi;
     done
 ])
@@ -64,38 +64,38 @@ here=`pwd`
 dir1=$here/original
 dir2=$here/recovered
 
-mkdir -p $dir1
+mkdir -p "$dir1"
 
 # Generate files of differing sizes with random data in them
 names=""
 s=1;
 while test $s -le 8192 ; do
-       name=$dir1/$s
-       dd if=/dev/urandom of=$name count=1 bs=$s 2> /dev/null
+       name="$dir1/$s"
+       dd if=/dev/urandom of="$name" count=1 bs=$s 2> /dev/null
        s=$(($s * 2));
-       bn=`basename $name`;
+       bn=`basename "$name"`;
         names="$names $bn";
 done
 
 # The pipe through "cat" below is essential because it makes the
 # output file un-seekable.
-AT_CHECK([cd $dir1 && zip-test w - $names | cat > foo.zip])
+AT_CHECK([cd "$dir1" && zip-test w - $names | cat > foo.zip])
 
 # If zipinfo is installed, make sure it can read the zipfile.
 if (zipinfo -v) >/dev/null 2>&1; then
-    AT_CHECK([zipinfo $dir1/foo.zip], [0], [ignore])
+    AT_CHECK([zipinfo "$dir1/foo.zip"], [0], [ignore])
 fi
 
-mkdir -p $dir2
-cp $dir1/foo.zip $dir2
-cd $dir2
+mkdir -p "$dir2"
+cp "$dir1/foo.zip" "$dir2"
+cd "$dir2"
 
 AT_CHECK([zip-test r foo.zip $names])
 
 AT_CHECK([
     # Compare the files to their originals
     for f in $names; do
-     diff $dir1/$f $dir2/$f;
+     diff "$dir1/$f" "$dir2/$f";
      if test $? -ne 0 ; then exit 1; fi;
     done
 ])
index 456ce59757a4c8413b91bd93bedf139a2d9a9dcf..f4708def02c77e96dbbea831c9086d41bdd6be00 100644 (file)
@@ -199,7 +199,7 @@ AT_CLEANUP
 
 AT_SETUP([tex another example])
 
-AT_CHECK([pspp -O format=tex $abs_top_srcdir/examples/regress.sps], [0], [])
+AT_CHECK([pspp -O format=tex "$abs_top_srcdir/examples/regress.sps"], [0], [])
 AT_CHECK([test $($GWC -L pspp.tex | awk '{print $1}') -le 80], [0], [ignore])
 
 AT_SKIP_IF([test "$TEX" = no])
index 5466dbc8b68cdb39e72eee19ec735b2c5054fc39..329a3f808d21365deee7de670a5722bca8667fb0 100644 (file)
@@ -1,5 +1,5 @@
 dnl PSPP - a program for statistical analysis.
-dnl Copyright (C) 2017, 2020 Free Software Foundation, Inc.
+dnl Copyright (C) 2017, 2020, 2021 Free Software Foundation, Inc.
 dnl
 dnl This program is free software: you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
@@ -19,8 +19,8 @@ AT_BANNER([Perl module tests])
 m4_divert_push([PREPARE_TESTS])
 # Find the Address Sanitizer library that PSPP is linked against, if any.
 # If it exists, it needs to be preloaded when we run Perl.
-asan_lib=$($abs_top_builddir/libtool --mode=execute ldd \
-               $abs_top_builddir/src/ui/terminal/pspp 2>/dev/null \
+asan_lib=$("$abs_top_builddir/libtool" --mode=execute ldd \
+               "$abs_top_builddir/src/ui/terminal/pspp" 2>/dev/null \
           | grep asan \
           | awk '{print $3}')
 if test ! -e "$asan_lib"; then
@@ -33,12 +33,12 @@ dnl equivalent to "use ExtUtils::testlib;" inside the Perl program, but it does
 dnl not need to be run with the perl-module build directory as the current
 dnl working directory.
 run_perl_module () {
-    LD_PRELOAD=$asan_lib:$LD_PRELOAD \
-    LD_LIBRARY_PATH=$abs_top_builddir/src/.libs \
-    DYLD_LIBRARY_PATH=$abs_top_builddir/src/.libs \
+    LD_PRELOAD="$asan_lib":"$LD_PRELOAD" \
+    LD_LIBRARY_PATH="$abs_top_builddir/src/.libs" \
+    DYLD_LIBRARY_PATH="$abs_top_builddir/src/.libs" \
     ASAN_OPTIONS="$ASAN_OPTIONS detect_leaks=false" \
-    $PERL -I$abs_top_builddir/perl-module/blib/arch \
-          -I$abs_top_builddir/perl-module/blib/lib "$@"
+    $PERL -I"$abs_top_builddir/perl-module/blib/arch" \
+          -I"$abs_top_builddir/perl-module/blib/lib" "$@"
 }
 m4_divert_pop([PREPARE_TESTS])
 
@@ -676,7 +676,7 @@ AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
 AT_CHECK([perl -MText::Diff -e '' || exit 77])
 # Skip this test if Perl's Memory::Usage module is not installed.
 AT_CHECK([perl -MMemory::Usage -e '' || exit 77])
-AT_CHECK([run_perl_module $abs_top_builddir/perl-module/t/Pspp.t], [0],
+AT_CHECK([run_perl_module "$abs_top_builddir/perl-module/t/Pspp.t"], [0],
   [[1..38
 ok 1 - use PSPP;
 ok 2 - Dictionary Creation
index 220bbee7e782362ac9002ab3a4642afa34f32909..155ae9d566b158bf57f8b06aac892432d9bbf14a 100644 (file)
@@ -18,7 +18,7 @@ AT_BANNER([SYNTAX GENERATOR])
 
 AT_SETUP([Syntax Generation - printf like])
 
-AT_CHECK([$abs_top_builddir/tests/ui/syntax-gen-test],[0],[dnl
+AT_CHECK(["$abs_top_builddir/tests/ui/syntax-gen-test"],[0],[dnl
 A simple string: Hello worldEND
 A syntax string: "Hello world"END
 A syntax string containing ": 'here"is the quote'END