flag-o-matic.eclass: crash in test-flag-PROG() when ${TEMP} is not writable
authorSergei Trofimovich <slyfox@gentoo.org>
Sat, 14 Mar 2020 22:56:22 +0000 (22:56 +0000)
committerSergei Trofimovich <slyfox@gentoo.org>
Sat, 14 Mar 2020 23:17:57 +0000 (23:17 +0000)
Reported by qolfixes on #gentoo-toolchain. Due to permission error in temp/
glibc ebuild silently filtered away all flags from CFLAGS and failed with an
obscure error. The change turn flag filtering error into early fatal error.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
eclass/flag-o-matic.eclass

index 5cc58f9e9392ba1b9490b08dd6a7b45536a3180f..1e685864f4653b073708038731cd6c7632cd4614 100644 (file)
@@ -446,30 +446,30 @@ test-flag-PROG() {
        case "${lang}" in
                # compiler/assembler only
                c)
-                       in_ext='.c'
+                       in_ext='c'
                        in_src='int main(void) { return 0; }'
                        cmdline_extra+=(-xc -c)
                        ;;
                c++)
-                       in_ext='.cc'
+                       in_ext='cc'
                        in_src='int main(void) { return 0; }'
                        cmdline_extra+=(-xc++ -c)
                        ;;
                f77)
-                       in_ext='.f'
+                       in_ext='f'
                        # fixed source form
                        in_src='      end'
                        cmdline_extra+=(-xf77 -c)
                        ;;
                f95)
-                       in_ext='.f90'
+                       in_ext='f90'
                        in_src='end'
                        cmdline_extra+=(-xf95 -c)
                        ;;
 
                # C compiler/assembler/linker
                c+ld)
-                       in_ext='.c'
+                       in_ext='c'
                        in_src='int main(void) { return 0; }'
                        cmdline_extra+=(-xc)
                        ;;
@@ -477,7 +477,7 @@ test-flag-PROG() {
        local test_in=${T}/test-flag.${in_ext}
        local test_out=${T}/test-flag.exe
 
-       printf "%s\n" "${in_src}" > "${test_in}" || return 1
+       printf "%s\n" "${in_src}" > "${test_in}" || die "Failed to create '${test_in}'"
 
        local cmdline=(
                "${comp[@]}"