python-utils-r1.eclass: Add missing ||die on file read
authorMichał Górny <mgorny@gentoo.org>
Wed, 18 Nov 2015 19:45:05 +0000 (20:45 +0100)
committerMichał Górny <mgorny@gentoo.org>
Sat, 28 Nov 2015 19:09:06 +0000 (20:09 +0100)
eclass/python-utils-r1.eclass

index c0451a702582404f2d90743b69052f64b1a5af36..7b0f2f87a5661900ccd3ab9bc3f0765d78327dab 100644 (file)
@@ -1041,12 +1041,14 @@ python_fix_shebang() {
                        local shebang i
                        local error= from=
 
+                       # note: we can't ||die here since read will fail if file
+                       # has no newline characters
                        IFS= read -r shebang <"${f}"
 
                        # First, check if it's shebang at all...
                        if [[ ${shebang} == '#!'* ]]; then
                                local split_shebang=()
-                               read -r -a split_shebang <<<${shebang}
+                               read -r -a split_shebang <<<${shebang} || die
 
                                # Match left-to-right in a loop, to avoid matching random
                                # repetitions like 'python2.7 python2'.