From: John Darrington Date: Sat, 24 Jul 2021 13:32:04 +0000 (+0200) Subject: Tolerate pathnames with spaces X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=ee1bfc05f5ab73883df26e616019e07a1bfee873 Tolerate pathnames with spaces Reported by: Vivien Kraus --- diff --git a/Makefile.am b/Makefile.am index 8b44e82efc..b571440544 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 ?= : diff --git a/doc/automake.mk b/doc/automake.mk index b928691085..3206beb25e 100644 --- a/doc/automake.mk +++ b/doc/automake.mk @@ -206,8 +206,8 @@ endif $(FIGURE_SPVS): $(pspp) .sps.spv: - $(AM_V_GEN)(cd $(top_srcdir)/examples \ - && $(abs_top_builddir)/$(pspp) ../doc/pspp-figures/$( $@.tmp + $(AM_V_GEN)(cd "$(top_srcdir)/examples" \ + && "$(abs_top_builddir)/$(pspp)" ../doc/pspp-figures/$( $@.tmp $(AM_V_at)mv $@.tmp $@ # In some cases, the tutorial only wants some parts of the output. diff --git a/perl-module/Makefile.PL b/perl-module/Makefile.PL index 9081d007f5..3d02cdc9a9 100644 --- a/perl-module/Makefile.PL +++ b/perl-module/Makefile.PL @@ -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', diff --git a/perl-module/automake.mk b/perl-module/automake.mk index ea1a47c7c2..96e24acde4 100644 --- a/perl-module/automake.mk +++ b/perl-module/automake.mk @@ -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 \ diff --git a/src/automake.mk b/src/automake.mk index 1dd598f159..c8f775c1e8 100644 --- a/src/automake.mk +++ b/src/automake.mk @@ -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 diff --git a/src/language/expressions/automake.mk b/src/language/expressions/automake.mk index e741f5adbe..4d2b4b70cc 100644 --- a/src/language/expressions/automake.mk +++ b/src/language/expressions/automake.mk @@ -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 diff --git a/src/language/stats/automake.mk b/src/language/stats/automake.mk index cc74ff4f3c..88c64abece 100644 --- a/src/language/stats/automake.mk +++ b/src/language/stats/automake.mk @@ -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 \ diff --git a/tests/language/stats/npar.at b/tests/language/stats/npar.at index 975d993771..be770ab1b1 100644 --- a/tests/language/stats/npar.at +++ b/tests/language/stats/npar.at @@ -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 diff --git a/tests/libpspp/zip.at b/tests/libpspp/zip.at index 77ca00e1c6..5b21d50f58 100644 --- a/tests/libpspp/zip.at +++ b/tests/libpspp/zip.at @@ -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 ]) diff --git a/tests/output/tex.at b/tests/output/tex.at index 456ce59757..f4708def02 100644 --- a/tests/output/tex.at +++ b/tests/output/tex.at @@ -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]) diff --git a/tests/perl-module.at b/tests/perl-module.at index 5466dbc8b6..329a3f808d 100644 --- a/tests/perl-module.at +++ b/tests/perl-module.at @@ -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 diff --git a/tests/ui/syntax-gen.at b/tests/ui/syntax-gen.at index 220bbee7e7..155ae9d566 100644 --- a/tests/ui/syntax-gen.at +++ b/tests/ui/syntax-gen.at @@ -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