Skip to content

Issue 1353 make fails spaces in path - #1357

Merged
Weltraumschaf merged 43 commits into
secureCodeBox:mainfrom
Weltraumschaf:issue_1353_make_fails_spaces_in_path
Oct 26, 2022
Merged

Weltraumschaf merged 43 commits into
secureCodeBox:mainfrom
Weltraumschaf:issue_1353_make_fails_spaces_in_path

Conversation

@Weltraumschaf

@Weltraumschaf Weltraumschaf commented Sep 14, 2022 •

Copy link
Copy Markdown
Member

Description

We do not allow white spaces in any path (inside the repo) ans also from outside. A checkout lie git checkout ... secure\ Code\ Box will not work due to limitations of GNU Make. workaround is to stop script with a hopefully helpful message.

This PR also cleans up some other stuff in Makefile (see commit messages).

Not fixed: Free BSD. Make from FreeBSD complains about lot of things:

make: "/root/src/secureCodeBox/common.mk" line 24: Invalid line type
make: "/root/src/secureCodeBox/common.mk" line 25: Invalid line type
make: "/root/src/secureCodeBox/common.mk" line 26: Invalid line type
...

Almost always ifeq/ifdef outside recipe. Since there is no docker available for FreeBSD which is a mandatory prerequisite to build -> Won't fix.

Checklist

  • Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration tests.
  • Make sure that all your commits are signed-off and that you are added to the Contributors file.
  • Make sure that all CI finish successfully.
  • Optional (but appreciated): Make sure that all commits are Verified.

@Weltraumschaf Weltraumschaf added the bug Bugs label Sep 14, 2022
@Weltraumschaf Weltraumschaf self-assigned this Sep 14, 2022
@Weltraumschaf
Weltraumschaf marked this pull request as draft September 14, 2022 12:21

@malexmave malexmave left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that make create-new-scanner NAME=name works with this. Other Make targets will probably still fail (@rebeccan is the expert on failing make commands 😁)

@Weltraumschaf
Weltraumschaf force-pushed the issue_1353_make_fails_spaces_in_path branch 5 times, most recently from 02775a0 to fc4af2e Compare September 20, 2022 11:30
@Weltraumschaf
Weltraumschaf force-pushed the issue_1353_make_fails_spaces_in_path branch 10 times, most recently from 18c9c34 to c15b56f Compare September 29, 2022 20:43
@Weltraumschaf
Weltraumschaf marked this pull request as ready for review September 29, 2022 20:45
@Weltraumschaf
Weltraumschaf requested review from malexmave and removed request for malexmave September 29, 2022 20:49

@malexmave malexmave left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this breaks the CI with syntax errors on makefile execution, I can trivially say that this needs changes 😁

@Weltraumschaf
Weltraumschaf force-pushed the issue_1353_make_fails_spaces_in_path branch from 7734bf8 to f6292e2 Compare September 30, 2022 12:32
@Weltraumschaf

Copy link
Copy Markdown
Member Author

Since this breaks the CI with syntax errors on makefile execution, I can trivially say that this needs changes 😁

Was a copy&paste bug. Fixed.

@the-simmon

Copy link
Copy Markdown
Contributor

I cloned this branch into a folder called /tmp/test\ with\ spaces/ then executed make test in the operator folder. This was the result:

Makefile:181: Warnung: Die Befehle für das Ziel „/tmp/test“ werden überschrieben
Makefile:166: Warnung: Alte Befehle für das Ziel „/tmp/test“ werden ignoriert
Makefile:181: Warnung: Die Befehle für das Ziel „with“ werden überschrieben
Makefile:166: Warnung: Alte Befehle für das Ziel „with“ werden ignoriert
Makefile:186: Warnung: Die Befehle für das Ziel „/tmp/test“ werden überschrieben
Makefile:181: Warnung: Alte Befehle für das Ziel „/tmp/test“ werden ignoriert
Makefile:186: Warnung: Die Befehle für das Ziel „with“ werden überschrieben
Makefile:181: Warnung: Alte Befehle für das Ziel „with“ werden ignoriert
Makefile:191: Warnung: Die Befehle für das Ziel „/tmp/test“ werden überschrieben
Makefile:186: Warnung: Alte Befehle für das Ziel „/tmp/test“ werden ignoriert
Makefile:191: Warnung: Die Befehle für das Ziel „with“ werden überschrieben
Makefile:186: Warnung: Alte Befehle für das Ziel „with“ werden ignoriert
make: Zirkuläre Abhängigkeit /tmp/test <- /tmp/test wird nicht verwendet.
make: Zirkuläre Abhängigkeit with <- /tmp/test wird nicht verwendet.
make: Zirkuläre Abhängigkeit with <- with wird nicht verwendet.
mkdir -p /tmp/test with spaces/operator/bin
make: Zirkuläre Abhängigkeit with <- /tmp/test wird nicht verwendet.
make: Zirkuläre Abhängigkeit with <- with wird nicht verwendet.
make: Zirkuläre Abhängigkeit with <- /tmp/test wird nicht verwendet.
make: Zirkuläre Abhängigkeit with <- with wird nicht verwendet.
test -s /tmp/test with spaces/operator/bin/setup-envtest || GOBIN=/tmp/test with spaces/operator/bin go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
bash: Zeile 1: test: Zu viele Argumente.
bash: Zeile 1: with: Kommando nicht gefunden.
make: *** [Makefile:191: with] Fehler 127

Is this the desired behavior? Tested on Arch linux.

@Weltraumschaf

Copy link
Copy Markdown
Member Author

Is this the desired behavior? Tested on Arch linux.

Nope, I'll investigate that.

@Weltraumschaf
Weltraumschaf force-pushed the issue_1353_make_fails_spaces_in_path branch from f6292e2 to bfbea25 Compare October 6, 2022 09:41
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
…ls in make

Problem is, if the body of a conditional is indented like:

```
ifeq (1,1)
	$(error SNAFU!)
endif
```

and the indentation is done with tabs (spaces didn't produce the eror)
then the script fails on macOS/FreeBSD because the indented line is
interpreted as command. GNU Make on macOS/FreBSD is more strict about
that than GNU Make on GNU/Linux system. The script fails with:

> Makefile:8: *** commands commence before first target.  Stop.

This means that a command (with tab indented line) must be written
after a recipe (target).

The solution is to remove all indentation in conditional blocks.
The solution to use spaces was discarded because it is errorprone
to accidentally convert them to tabs and introduce a regression,
even if the readability of such conditionals suffer.

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
BCP is to add the PHONY to each target instead of one global
PHONY target bc it's easier to spot a missing one.

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
…ndition checks

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Unless a user is in an ugly loop of error, install tool, next
error, install next tool etc. So one has the chance to install
all prerequisites at once.

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
…utput w/o escaping something

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
…e var

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
…file

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
This way it is easier to spot missing ones.

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
…of zap advanced

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
…rely on Bash implememntation

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
This is done that we do not need to include comon.mk everywhere
because it is not that common as the name sugest. It is only
expoected to be incldued in scanners.mk, hooks.mk, and sdk.mk
as a test base.

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
… more meaning

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Give the header comment more meaning. Also some reformatting.

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
@Weltraumschaf
Weltraumschaf force-pushed the issue_1353_make_fails_spaces_in_path branch from dfcd4a3 to e426dec Compare October 26, 2022 08:12
@Weltraumschaf
Weltraumschaf merged commit 563ee75 into secureCodeBox:main Oct 26, 2022
@Weltraumschaf
Weltraumschaf deleted the issue_1353_make_fails_spaces_in_path branch December 23, 2022 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bugs

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants