Skip to content

Commit 58de9e9

Browse files
authored
[#142] Ensure a non-target doesn't escape the scope (#143)
1 parent d0f8677 commit 58de9e9

7 files changed

Lines changed: 50 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
if: runner.os == 'Linux'
2727
run: |
2828
pushd /tmp
29-
wget 'https://ftpmirror.gnu.org/make/make-4.4.1.tar.gz'
29+
wget 'https://mirrors.kernel.org/gnu/make/make-4.4.1.tar.gz'
3030
tar xzf make-4.4.1.tar.gz
3131
cd make-4.4.1
3232
./configure --prefix=/usr/local

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up GNU Make
2121
run: |
2222
pushd /tmp
23-
wget 'https://ftpmirror.gnu.org/make/make-4.4.1.tar.gz'
23+
wget 'https://mirrors.kernel.org/gnu/make/make-4.4.1.tar.gz'
2424
tar xzf make-4.4.1.tar.gz
2525
cd make-4.4.1
2626
./configure --prefix=/usr/local

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ make -v
142142
If your operating system provides an older Make version, upgrading is straightforward:
143143

144144
```bash
145-
wget https://ftpmirror.gnu.org/make/make-4.4.1.tar.gz
145+
wget https://mirrors.kernel.org/gnu/make/make-4.4.1.tar.gz
146146
tar xzf make-4.4.1.tar.gz
147147
cd make-4.4.1
148148
./configure --prefix=/usr/local

pkg/debbuild-env.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM ubuntu:26.04
22
VOLUME /project
33

4-
ADD https://ftpmirror.gnu.org/make/make-4.4.1.tar.gz /tmp/
4+
ADD https://mirrors.kernel.org/gnu/make/make-4.4.1.tar.gz /tmp/
55
RUN apt-get update \
66
&& apt-get install -y gcc perl make
77

src/bmakelib.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ behaviours and hard to find bugs.$(bmakelib.newline)$(bmakelib.newline)\
113113
simple as running $(bmakelib.newline)$(bmakelib.newline)\
114114
\
115115
\
116-
$(bmakelib.octospace)wget 'https://ftpmirror.gnu.org/make/make-4.4.1.tar.gz' $(bmakelib.backslash)$(bmakelib.newline) \
116+
$(bmakelib.octospace)wget 'https://mirrors.kernel.org/gnu/make/make-4.4.1.tar.gz' $(bmakelib.backslash)$(bmakelib.newline) \
117117
$(bmakelib.octospace)&& tar xzf make-4.4.1.tar.gz $(bmakelib.backslash)$(bmakelib.newline) \
118118
$(bmakelib.octospace)&& cd make-4.4.1 $(bmakelib.backslash)$(bmakelib.newline) \
119119
$(bmakelib.octospace)&& ./configure --prefix=/usr/local $(bmakelib.backslash)$(bmakelib.newline) \

src/help.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ sub parse_targets_section {
324324
get_file_lines($target_state{file});
325325
} elsif ($line =~ /^#\s+(?:Builtin rule|recipe to execute \(built-in\))/) {
326326
$target_state{builtin} = 1;
327-
} elsif ($line =~ /^([a-zA-Z0-9_.-]+)\s*:(?!=)/) {
327+
} elsif ($line =~ /^([a-zA-Z0-9_().-]+)\s*:(?!=)/) {
328328
my $next_target = $1;
329329
process_target(
330330
\%target_state,
@@ -348,7 +348,8 @@ sub parse_targets_section {
348348
$targets_by_scope_ref,
349349
$show_bmakelib,
350350
);
351-
} elsif ($line =~ /^# (?:VPATH Utilities|files hash-table-stats)/) {
351+
$pending_not_target = 0;
352+
} elsif ($line =~ /^# (?:VPATH Utilities|files hash-table[ -]stats)/) {
352353
process_target(
353354
\%target_state,
354355
$active_scopes_ref,

tests/test_help

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,46 @@ EOF
382382
|| return 1
383383
}
384384

385+
####################################################################################################
386+
# Issue #142: Non-targets with special characters (e.g. error-if-blank parentheses) do not suppress subsequent targets.
387+
####################################################################################################
388+
389+
function when_target_prerequisite_has_special_characters {
390+
local test_case_name=${FUNCNAME[0]}
391+
local actual_value_filename=${test_case_name}.actual.log
392+
bmakelib.test.cat <<'EOF' > Makefile
393+
SHELL := /usr/bin/env bash
394+
include $(bmakelib.ROOT)/bmakelib.mk
395+
396+
MY_VAR ?= test-val
397+
398+
libscid.configure : bmakelib.error-if-blank( MY_VAR ) ## Configure libscid build
399+
@echo "configuring"
400+
401+
libscid.build : ## Build libscid
402+
@echo "building"
403+
EOF
404+
405+
make bmakelib.conf.help.scope=local bmakelib.conf.help.variables=no bmakelib.conf.help.tips=no help > $actual_value_filename 2>&1
406+
407+
local expexted_pattern_filename=${test_case_name}.expected.pattern
408+
bmakelib.test.cat <<'EOF' > $expexted_pattern_filename
409+
make.+Entering.+
410+
={80}
411+
LOCAL: defined inside the source tree
412+
={80}
413+
414+
TARGETS
415+
libscid\.build\s+Build libscid
416+
libscid\.configure\s+Configure libscid build
417+
418+
make.+Leaving.+
419+
EOF
420+
421+
bmakelib.test.assert_matches $test_case_name $actual_value_filename $expexted_pattern_filename \
422+
|| return 1
423+
}
424+
385425
####################################################################################################
386426

387427
bmakelib.test.run_test_case happy_path_default_help
@@ -392,4 +432,6 @@ bmakelib.test.run_test_case when_tips_is_no
392432
bmakelib.test.run_test_case when_convenience_target_is_no
393433
bmakelib.test.run_test_case docblock_and_inline_mixed_styles
394434
bmakelib.test.run_test_case when_show_bmakelib_is_yes
435+
bmakelib.test.run_test_case when_target_prerequisite_has_special_characters
436+
395437

0 commit comments

Comments
 (0)