Skip to content

Commit 20ccdf1

Browse files
committed
Merge pull request #217 from sej7278/master
Quote/regex/wildcard audit (fixes issue #192)
2 parents 87895de + 7618da7 commit 20ccdf1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Arduino.mk

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ ifndef ARDUINO_VERSION
299299
# Remove all the decimals, and right-pad with zeros, and finally grab the first 3 bytes.
300300
# Works for 1.0 and 1.0.1
301301
VERSION_FILE := $(ARDUINO_DIR)/lib/version.txt
302-
AUTO_ARDUINO_VERSION := $(shell [ -e $(VERSION_FILE) ] && cat $(VERSION_FILE) | sed -e 's/^[0-9]://g' -e 's/[.]//g' -e 's/$$/0000/' | head -c3)
302+
AUTO_ARDUINO_VERSION := $(shell [ -e "$(VERSION_FILE)" ] && cat "$(VERSION_FILE)" | sed -e 's/^[0-9]://g' -e 's/[.]//g' -e 's/$$/0000/' | head -c3)
303303
ifdef AUTO_ARDUINO_VERSION
304304
ARDUINO_VERSION = $(AUTO_ARDUINO_VERSION)
305305
$(call show_config_variable,ARDUINO_VERSION,[AUTODETECTED])
@@ -331,7 +331,7 @@ ifndef ARDUINO_SKETCHBOOK
331331

332332
ifneq ($(ARDUINO_PREFERENCES_PATH),)
333333
ARDUINO_SKETCHBOOK = $(shell grep --max-count=1 --regexp="sketchbook.path=" \
334-
$(ARDUINO_PREFERENCES_PATH) | \
334+
"$(ARDUINO_PREFERENCES_PATH)" | \
335335
sed -e 's/sketchbook.path=//' )
336336
endif
337337

@@ -520,7 +520,7 @@ endif
520520

521521
ifndef PARSE_BOARD
522522
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
523-
PARSE_BOARD = $(shell grep -v "^\#" $(BOARDS_TXT) | grep $(1).$(2) | cut -d = -f 2 )
523+
PARSE_BOARD = $(shell grep -v "^\#" "$(BOARDS_TXT)" | grep $(1).$(2) | cut -d = -f 2 )
524524
endif
525525

526526
# If NO_CORE is set, then we don't have to parse boards.txt file
@@ -752,7 +752,6 @@ endif
752752
TARGET_HEX = $(OBJDIR)/$(TARGET).hex
753753
TARGET_ELF = $(OBJDIR)/$(TARGET).elf
754754
TARGET_EEP = $(OBJDIR)/$(TARGET).eep
755-
TARGETS = $(OBJDIR)/$(TARGET).*
756755
CORE_LIB = $(OBJDIR)/libcore.a
757756

758757
# Names of executables - chipKIT needs to override all to set paths to PIC32
@@ -1255,13 +1254,13 @@ ifneq ($(strip $(AVRDUDE_ISP_FUSES_POST)),)
12551254
endif
12561255

12571256
clean:
1258-
$(REMOVE) $(LOCAL_OBJS) $(CORE_OBJS) $(LIB_OBJS) $(CORE_LIB) $(TARGETS) $(DEPS) $(USER_LIB_OBJS) ${OBJDIR}
1257+
$(REMOVE) ./$(OBJDIR)
12591258

12601259
size: $(TARGET_HEX)
12611260
$(call avr_size,$(TARGET_ELF),$(TARGET_HEX))
12621261

12631262
show_boards:
1264-
@$(CAT) $(BOARDS_TXT) | grep -E "^[[:alnum:]]+.name" | sort -uf | sed 's/.name=/:/' | column -s: -t
1263+
@$(CAT) "$(BOARDS_TXT)" | grep -E "^[[:alnum:]]+.name" | sort -uf | sed 's/.name=/:/' | column -s: -t
12651264

12661265
monitor:
12671266
$(MONITOR_CMD) $(call get_monitor_port) $(MONITOR_BAUDRATE)
@@ -1286,7 +1285,7 @@ generated_assembly: generate_assembly
12861285
@$(ECHO) "\"generated_assembly\" target is deprecated. Use \"generate_assembly\" target instead\n\n"
12871286

12881287
help_vars:
1289-
@$(CAT) $(ARDMK_DIR)/arduino-mk-vars.md
1288+
@$(CAT) "$(ARDMK_DIR)/arduino-mk-vars.md"
12901289

12911290
help:
12921291
@$(ECHO) "\nAvailable targets:\n\

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
1414
- Fix: Add missing/reorder/reword targets in `make help` (https://github.com/sej7278)
1515
- New: Arduino.mk is now compatible with Flymake mode (https://github.com/rbarzic)
1616
- Fix: MONITOR_PORT detection (Issue #213, #215) (https://github.com/sej7278)
17+
- Tweak: Audited regexes/quoting/wildcards (Issue #192) (https://github.com/sej7278)
1718

1819
### 1.3.3 (2014-04-12)
1920
- Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278)

0 commit comments

Comments
 (0)