koverstreet / bcachefs-tools

http://bcachefs.org
GNU General Public License v2.0
116 stars 88 forks source link

mount: replace rpassword with rustix::termios #312

Closed lotheac closed 1 month ago

lotheac commented 1 month ago

because rpassword unconditionally open()s /dev/tty, it fails with ENXIO on the console without workarounds like busybox's cttyhack. in contrast, bcachefs unlock works fine on console, so change the passphrase prompt logic in mount to be closer to what it is in unlock.

lotheac commented 1 month ago

fixes the problem reported previously as https://github.com/koverstreet/bcachefs-tools/issues/292 ; the crucial part is that in the initrd, /dev/console is in fact a tty (and thus the prompt code path is taken), but it is not a controlling terminal and cannot be open()ed.

tmuehlbacher commented 1 month ago

rustix is already in the dependency tree, the nix crate is not.

lotheac commented 1 month ago

rustix is already in the dependency tree, the nix crate is not.

thanks. replaced with rustix::termios.

koverstreet commented 1 month ago

Merged