Project

General

Profile

« Previous | Next » 

Revision 10217

bugfix: lib/sh/util.sh: sed: must use alias instead of function because function causes segfault in redir() subshell when used with make.sh make() filter (may be bug in bash?). this involves translating `unset LANG` to `env LANG=` (`env -u` to unset a var isn't supported on Mac, but fortunately sed treats LANG="" the same as unset LANG).

View differences:

lib/sh/util.sh
245 245
	echo "$result"
246 246
}
247 247

  
248
sed_cmd="sed -`case "$(uname)" in Darwin) echo E;; *) echo r;; esac`"
249
alias sed_cmd="$sed_cmd"
248
sed_cmd="env LANG= sed -`case "$(uname)" in Darwin) echo E;; *) echo r;; esac`"
249
	# LANG: avoid invalid UTF-8 "illegal byte sequence" errors when LANG=*.UTF-8
250
alias sed="$sed_cmd"
251
	# can't be function because this causes segfault in redir() subshell when
252
	# used with make.sh make() filter
250 253

  
251 254
fi # load new aliases
252 255
if self_being_included; then
253 256

  
254
sed() { local LANG; unset LANG; sed_cmd "$@"; }
255
# LANG: avoid "illegal byte sequence" errors on invalid UTF-8 for LANG=*.UTF-8
256

  
257 257
rtrim() { log+ 3; sed 's/[[:space:]]+$//' <<<"$1"; }
258 258

  
259 259

  

Also available in: Unified diff