google / google/kati

Multi-word MAKEFLAGS doesn't work properly

Open
#89 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1k
Forks
132
Avg merge
11m
Merged PRs (30d)
1

Description

We ran into this issue when upgrading Kati on AOSP, but I've solved this on our side separately by clearing MAKEFLAGS, since we don't want the MAKEFLAGS override behavior and the variables are already available in the environment.

Simple shell testcase to drop into testcase/cmdline_var_spaces.sh:

``` shell
set -e

mk="$@"

cat < Makefile
ifdef SUBMAKE
all:
+@\$(SUBMAKE) SUBMAKE=
else
CLVAR := FAIL
CLVAR_RESULT := FAIL
ifeq (\$(CLVAR),multi word)
CLVAR_RESULT := PASS
endif
all:
@echo \$(CLVAR_RESULT) \$(CLVAR) \$(origin CLVAR)
endif
EOF

make SUBMAKE="${mk}" CLVAR='multi word' 2> /dev/null
```

Which prints out:

```
(make) PASS multi word command line
(ckati) FAIL multi command line
```

If you print out $(MAKEFLAGS), the makeflags is written as:

```
CLVAR=multi\ word SUBMAKE=../../ckati\ SHELL=/bin/bash
```

So kati's MAKEFLAGS parsing needs to handle the escaped spaces (I'm not sure if anything else can be escaped)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.