containers / BuildSourceImage

Tool to build a source image based on an existing OCI image
GNU General Public License v2.0
29 stars 14 forks source link

Remove escapes from string side of substitutions #59

Closed athos-ribeiro closed 4 years ago

athos-ribeiro commented 4 years ago

Bash Pattern Substitution behaves differently in Bash 4.2 and Bash 5.0. While [1] outputs 'a/b' in Bash 5.0, it outputs a\/b for Bash 4.2. This leads to several errors in the latter environment, including errors for [2].

Since the part of the pattern substitution after the second slash are treated as strings by bash, let's avoid escaping the slash in those paths.

[1] foo='a:b'; echo "${foo/:/\/}" [2] test -f $PATH_AFTER_PATTERN_SUBSTITUTION

Signed-off-by: Athos Ribeiro athos@redhat.com