Skip to content

Commit

Permalink
tools/rel.sh: Make POSIXLY compatible.
Browse files Browse the repository at this point in the history
Fixes: ElementsProject#1221

We were using `\x0` to match NUL chars in the input (on the
assumption that NUL chars are "impossible" for decent LFS-compliant
systems).
However `\x0` is a GNUism.
Use the `\n` and the newline character, which is supported by (most)
POSIX sed.
  • Loading branch information
ZmnSCPxj authored and rustyrussell committed Mar 16, 2018
1 parent 7bbc194 commit e6de41b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/rel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

from=${1}
to=${2}
common=`printf '%s\0%s' "${from}" "${to}" | sed 's/\(.*\).*\x0\1.*/\1/' | sed 's@/[^/]*$@/@'`
common=`printf '%s\n%s' "${from}" "${to}" | sed 'N;s/\(.*\).*\n\1.*$/\1/' | sed 's@/[^/]*$@/@'`
prefix=`printf '%s\n' ${from#$common} | sed 's@[^/][^/]*@..@g'`
printf '%s\n' "$prefix/${to#$common}"

0 comments on commit e6de41b

Please sign in to comment.