commit:     beaa71df0ab2cfa61beba4be0303099aa6c75e6a
Author:     Dustin C. Hatch <dustin <AT> hatch <DOT> name>
AuthorDate: Fri Feb 19 01:18:13 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Feb 19 21:25:53 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=beaa71df

binfmt.sh: use read in raw mode

The read builtin in most shells will interpret backslash characters
as escapes, and they are lost when reading binfmt files line-by-line.
This causes magic strings containing backslashes to be mangled and
become invalid, resulting in erroneous 'invalid entry' messages.

The -r option to read disables special handling of backslashes and
keeps all lines intact.

X-Gentoo-Bug: 575114
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=575114

 sh/binfmt.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sh/binfmt.sh.in b/sh/binfmt.sh.in
index fd422f8..be0ed48 100644
--- a/sh/binfmt.sh.in
+++ b/sh/binfmt.sh.in
@@ -22,7 +22,7 @@ apply_file() {
 
        ### FILE FORMAT ###
        # See https://www.kernel.org/doc/Documentation/binfmt_misc.txt
-       while read line; do
+       while read -r line; do
                LINENUM=$(( LINENUM+1 ))
                case $line in
                        \#*) continue ;;

Reply via email to