#9824 Error when sizing output for a terminal
Closed: fixed by rcritten. Opened by rcritten.

Issue

caed210bc26c0220c9292c40b66177cda671a34f shows help output in a pager. On rawhide (F43)I'm seeing a traceback.

$ ipa help dns
ipa: ERROR: non-public: SystemError: buffer overflow
Traceback (most recent call last):
  File "/usr/lib/python3.14/site-packages/ipalib/backend.py", line 141, in execute
    return self.Command[_name](*args, **options)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/ipalib/frontend.py", line 477, in __call__
    return self.__do_call(*args, **options)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/ipalib/frontend.py", line 544, in __do_call
    ret = self.run(*args, **options)
  File "/usr/lib/python3.14/site-packages/ipalib/cli.py", line 846, in run
    self.print_commands(name, outfile)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/ipalib/cli.py", line 920, in print_commands
    writer.write()
    ~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/ipalib/cli.py", line 727, in write
    if pager and self.buffer_length > get_terminal_height():
                                      ~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/ipalib/util.py", line 1350, in get_terminal_height
    'hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, b'1234'))[0]
          ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SystemError: buffer overflow
ipa: ERROR: an internal error has occurred

I run in relatively small windows. I'm not sure if that's the cause or not.

$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke -flusho -extproc

freeipa-server-4.12.2-14.fc43.x86_64


Got the same error on Fedora Rawhide both with and without GUI. This is not caused by small window.

$ stty -a
speed 38400 baud; rows 51; columns 212; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

To me this seems to be a regression in the fcntl library.

For Python 3.3+, we can simply use (os also works)

shutil.get_terminal_size()[1]

Metadata Update from @dhanina:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/7879

Metadata Update from @dhanina:
- Custom field rhbz adjusted to https://issues.redhat.com/browse/RHEL-25091

Metadata Update from @dhanina:
- Custom field rhbz adjusted to https://issues.redhat.com/browse/IDM-2362 (was: https://issues.redhat.com/browse/RHEL-25091)

master:

  • 4484ad72905d12741b2dd0f29484480fa0566587 Fix terminal height for Rawhide

ipa-4-12:

  • 3b1d0e1c774b4edeb0844018f50a00ea30e55ea0 Fix terminal height for Rawhide

Metadata Update from @rcritten:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata