secret-manager icon indicating copy to clipboard operation
secret-manager copied to clipboard

sed usage appears to be non-portable

Open devth opened this issue 4 years ago • 1 comments

Describe the bug:

This StackOverflow answer explains differences between GNU and BSD/macOS sed. The current Makefile uses sed in a way that causes an error with BSD/macOS sed:

± make crds-to-chart
cp deploy/crds/*.yaml deploy/charts/secret-manager/templates/crds/; \
	for i in deploy/charts/secret-manager/templates/crds/*.yaml; do \
		sed -i '1s/.*/{{- if .Values.installCRDs }}/;$a{{- end }}' $i; \
	done
sed: 1: "deploy/charts/secret-ma ...": extra characters at the end of d command
sed: 1: "deploy/charts/secret-ma ...": extra characters at the end of d command
sed: 1: "deploy/charts/secret-ma ...": extra characters at the end of d command
make: *** [crds-to-chart] Error 1

Expected behavior

Expect make targets to work across OSes.

Steps to reproduce the bug:

Run make crds-to-chart on macOS.

Workaround

macOS users can install GNU sed using brew install sed then following the instructions to setup $PATH to prefer GNU sed over macOS sed.

/kind bug

devth avatar Oct 14 '20 15:10 devth

I'm not sure there is a portable alternative for some sed commands. If this instance has an alternative which is portable then it could be updated. I would recommend macOS users switch to GNU sed.

mcavoyk avatar Oct 14 '20 23:10 mcavoyk