Fix (break) os-release detection.
open($fh, ...) associates a filehandle with $fh, even when
open() fails. The $fh is truthy, even when the filehandle is closed.
On FreeBSD, */etc/os-release* does not exist (in versions prior
to 13, at least), but the code tries to open that; open()
returns undefined so the last doesn't trigger, but $fh
is now associated with something, and is truthy: the while-loop
ends, croak_runtime() is skipped, and a closed filehandle
is read. There's no lines in there, and os-release detection
ends up thinking generic-Linux.
The warning that perl prints is
readline() on closed filehandle $fh at kdesrc-build/modules/ksb/OSSupport.pm line 147.
(line number modulo some debug-hacking of mine). By setting
$fh back to undefined the while-loop will actually try all
of the possibilities.
- Effectively, this prevents FreeBSD from using kdesrc-build, since there is no os-release (and that's apparently fatal).
- This might be a perl 5.30.2 issue? I don't know how truthy older filehandles are, nor whether open() sets them on failure.