Commenting on #2:

When building busybox, there is a number of config switches. For your binary to 
support "ps -w" you need this in the config:
- CONFIG_DESKTOP is not set
- CONFIG_FEATURE_PS_WIDE=y

On my 22.04 systems I've got 2 busybox binaries: /usr/bin/busybox (2.1M)
from busybox-static package and /usr/lib/initramfs-tools/bin/busybox
(311K) from busybox-initramfs package. The former was built using
debian/config/pkg/static from the source package (CONFIG_DESKTOP=y), it
does not support "ps -w". The latter was built with
debian/config/pkg/initramfs from the source package (no CONFIG_DESKTOP,
CONFIG_FEATURE_PS_WIDE=y), it supports "ps -w" and, evidently, it is the
one that gets packaged into initramfs.

If your non-desktop busybox was built without CONFIG_FEATURE_PS_WIDE=y,
there should be no problem described in this bug report. In the case,
terminal width would be assumed 79 [1]

To make it work no matter if "ps -w" is supported or not, there are two
options, both based on [2]

1. "ps </dev/null". In this case, ioctl TIOCGWINSZ would be fruitless and the 
hardcoded "80" value will be used.
2. "COLUMNS=80 ps". wh_helper() [3] looks into env vars first.

The former is more like a dirty trick. The latter should be preferred.
In both cases, 80 gets decremented to 79, the hardcoded value when "ps
-w" is not supported.

So, with "COLUMNS=80 ps":
- if "ps -w" is not supported, the hardcoded terminal width 79 is used
- otherwise, the width gets set to getenv("COLUMNS")-1, which is 79 as well

[1] 
https://git.launchpad.net/ubuntu/+source/busybox/tree/procps/ps.c?h=applied/ubuntu/jammy#n650
[2] 
https://git.launchpad.net/ubuntu/+source/busybox/tree/libbb/xfuncs.c?h=applied/ubuntu/jammy#n292
[3] 
https://git.launchpad.net/ubuntu/+source/busybox/tree/libbb/xfuncs.c?h=applied/ubuntu/jammy#n235

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1968636

Title:
  cryptroot-unlock doesn't work at all when terminal width is below 51

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cryptsetup/+bug/1968636/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to