gnutls relies on glibc-specific getpass functionality in tests
Description of problem:
The certtool test in cert-tests does not detect any password and fails at line 59 since it relies on getpass falling back to stdin and stderr if it is unable to connect to a TTY. This only occurs on glibc (source code), while other libcs like musl (source code) do not have this behaviour.
I can think of a few options to fix this
- Change getpass_copy to directly use utility functions in
termios.h
. This would be most compatible with existing scripts. Note that according to its man page, getpass is obsolete. - Stop relying on this behavior and test functionality another way, such as giving another password and making sure certtool fails.
- Try to make a pty so that the existing test line still works. This should be possible, but I have no idea how to do it.
Version of gnutls used:
3.6.12
Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)
NixOS
How reproducible:
Steps to Reproduce:
- Build gnutls with musl libc (in my case
nix-build '<nixpkgs>' -A pkgsMusl.gnutls
) - Run tests
Actual results:
The test fails with the following log:
Generating a 3072 bit RSA private key...
Generating a self signed certificate...
No PIN given.
note: when operating in batch mode, set the GNUTLS_PIN or GNUTLS_SO_PIN environment variables
cert generation failed
FAIL certtool (exit status: 1)
Expected results:
The test should pass