From c174eb7cb45c3deb0372c5af854cc1f657989220 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Tue, 12 Feb 2019 20:30:49 +0100 Subject: [PATCH] Add tests for spaces in filenames (scripts) --- src/makefile.c | 4 ++-- tests/script/Makefile.NetBSD | 18 +++++++++++++++--- tests/script/project.conf | 14 +++++++++++++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/makefile.c b/src/makefile.c index f9f486b..abb3784 100644 --- a/src/makefile.c +++ b/src/makefile.c @@ -3097,8 +3097,8 @@ static int _makefile_output_variable(Makefile * makefile, String const * name, static int _makefile_mkdir(Makefile * makefile, char const * directory) { /* FIXME keep track of the directories created */ - return _makefile_print(makefile, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", - directory); + return (_makefile_print(makefile, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", + directory) >= 0) ? 0 : -1; } diff --git a/tests/script/Makefile.NetBSD b/tests/script/Makefile.NetBSD index e7278ea..6be0ad0 100644 --- a/tests/script/Makefile.NetBSD +++ b/tests/script/Makefile.NetBSD @@ -1,4 +1,4 @@ -TARGETS = $(OBJDIR)test phony +TARGETS = $(OBJDIR)test phony s\ p\ a\ c\ e\ s $(OBJDIR)s\ p\ a\ c\ e\ s\ 2 OBJDIR = PREFIX = /usr/local DESTDIR = @@ -19,11 +19,19 @@ $(OBJDIR)disabled: a.c b.c phony: a.c b.c ./script.sh -P "$(PREFIX)" -- "phony" +s\ p\ a\ c\ e\ s: $(OBJDIR)s\ p\ a\ c\ e\ s\ 2 + ./s\ c\ r\ i\ p\ t.sh -P "$(PREFIX)" -- "s p a c e s" + +$(OBJDIR)s\ p\ a\ c\ e\ s\ 2: + ./s\ c\ r\ i\ p\ t.sh -P "$(PREFIX)" -- "$(OBJDIR)s p a c e s 2" + clean: - $(RM) -- $(test_OBJS) $(disabled_OBJS) $(phony_OBJS) + $(RM) -- ./script.sh -c -P "/somewhere/else" -- "$(OBJDIR)test" ./script.sh -c -P "$(PREFIX)" -- "$(OBJDIR)disabled" ./script.sh -c -P "$(PREFIX)" -- "phony" + ./s\ c\ r\ i\ p\ t.sh -c -P "$(PREFIX)" -- "s p a c e s" + ./s\ c\ r\ i\ p\ t.sh -c -P "$(PREFIX)" -- "$(OBJDIR)s p a c e s 2" distclean: clean $(RM) -- $(TARGETS) @@ -31,9 +39,13 @@ distclean: clean install: all ./script.sh -P "$(DESTDIR)/somewhere/else/again" -i -- "$(OBJDIR)test" ./script.sh -P "$(DESTDIR)$(PREFIX)" -i -- "phony" + ./s\ c\ r\ i\ p\ t.sh -P "$(DESTDIR)$(PREFIX)" -i -- "s p a c e s" + ./s\ c\ r\ i\ p\ t.sh -P "$(DESTDIR)$(PREFIX)" -i -- "$(OBJDIR)s p a c e s 2" uninstall: ./script.sh -P "$(DESTDIR)/somewhere/else/again" -u -- "test" ./script.sh -P "$(DESTDIR)$(PREFIX)" -u -- "phony" + ./s\ c\ r\ i\ p\ t.sh -P "$(DESTDIR)$(PREFIX)" -u -- "s p a c e s" + ./s\ c\ r\ i\ p\ t.sh -P "$(DESTDIR)$(PREFIX)" -u -- "s p a c e s 2" -.PHONY: all clean distclean install uninstall phony +.PHONY: all clean distclean install uninstall phony s\ p\ a\ c\ e\ s diff --git a/tests/script/project.conf b/tests/script/project.conf index e47ea80..95cc632 100644 --- a/tests/script/project.conf +++ b/tests/script/project.conf @@ -1,4 +1,4 @@ -targets=test,disabled,phony +targets=test,disabled,phony,s p a c e s,s p a c e s 2 dist=Makefile [test] @@ -19,3 +19,15 @@ script=./script.sh depends=a.c,b.c phony=1 install= + +[s p a c e s] +type=script +script=./s c r i p t.sh +depends=$(OBJDIR)s p a c e s 2 +phony=1 +install= + +[s p a c e s 2] +type=script +script=./s c r i p t.sh +install=