Bugzilla – Bug 1207253
Perl "bad file descriptor" error when using YaST commandline
Last modified: 2023-03-10 09:42:19 UTC
Hello, using for example the command line "yast dns edit hostname=HOSTNAME" causes in Leap 15.4 (older and newer distros similar) the error >>>>> Warning: unable to close filehandle properly: Bad file descriptor, <STDIN> line 3 during global destruction (#1) (S io) There were errors during the implicit close() done on a filehandle when its reference count reached zero while it was still open, e.g.: { open my $fh, '>', $file or die "open: '$file': $!\n"; print $fh $data or die "print: $!"; } # implicit close here Because various errors may only be detected by close() (e.g. buffering could allow the print in this example to return true even when the disk is full), it is dangerous to ignore its result. So when it happens implicitly, perl will signal errors by warning. Prior to version 5.22.0, perl ignored such errors, so the common idiom shown above was liable to cause silent data loss. <<<< which seems to be a known problem in the past. Cause for this error seems to be the package "perl-TermReadLine-Gnu" (consider naming) V1.20, which is part of all 15.X Leap distributions. Replacing this with the package perl-Term-ReadLine-Gnu V1.45 (also consider naming) from https://software.opensuse.org/package/perl-Term-ReadLine-Gnu seems to fix the issue, but is missing in distributions
Thank you for your bug report. I can reproduce the problem. After some initial confusion, we found some very old YaST modules that actually use Perl. AFAICS all of them are candidates for dropping for for a major refactoring. Dropping is much more likely.
perl-TermReadLine-Gnu... See also https://bugzilla.suse.com/show_bug.cgi?id=1203080
I just checked: yast2-users is also written in Perl, and that one is definitely not a drop candidate. It was refactored not so long ago, and it shows the same problem. Reproducing it doesn't even need valid command line arguments: % yast2 users foo Unknown Command: foo Use 'yast2 users help' for a complete list of available commands. Warning: unable to close filehandle properly: Bad file descriptor, <STDIN> line 5 during global destruction (#1) (S io) There were errors during the implicit close() done on a filehandle when its reference count reached zero while it was still open, e.g.: { open my $fh, '>', $file or die "open: '$file': $!\n"; print $fh $data or die "print: $!"; } # implicit close here Because various errors may only be detected by close() (e.g. buffering could allow the print in this example to return true even when the disk is full), it is dangerous to ignore its result. So when it happens implicitly, perl will signal errors by warning. Prior to version 5.22.0, perl ignored such errors, so the common idiom shown above was liable to cause silent data loss.
CC'ing our Perl maintainer.
Michael, please see the bug reporter's suggestion in comment #0.
Took my solution from here: https://lists.opensuse.org/archives/list/bugs@lists.opensuse.org/message/SWKYI74DRVPBOKIBMPJZICQACK5RKTKX/ resp.: https://bugzilla.suse.com/show_bug.cgi?id=966042
The fix has reached Leap 15.3 as well: https://build.opensuse.org/package/show/openSUSE:Leap:15.3:Update/perl-Term-ReadLine-Gnu