The flac command line utility does not actually get the width of the terminal, but just assumes it to be 80 characters, if termios.h
on your system defines TIOCGWINSZ
. In src/flac/utils.c, there's the following code:
int get_console_width(void) { int width = 0; #if defined _WIN32 width = win_get_console_width(); #elif defined __EMX__ int s[2]; _scrsize (s); width = s[0]; #elif defined GWINSZ_IN_SYS_IOCTL struct winsize w; if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1) width = w.ws_col; #endif if (width <= 0) width = 80; return width; }
During configuration, GWINSZ_IN_SYS_IOCTL
is defined if termios.h
on your system does NOT define TIOCGWINSZ
, in which case sys/ioctl.h
must be included. That means (on non-WIN32 systems), the code to get the actual window size is compiled only if TIOCGWINSZ
does not appear in termios.h
.
Contact: maximilian.fillinger@uni-duesseldorf.de
All I can tell from your report is that you are not on Windows. However, it would help immensely if you could tell exactly what non-Windows OS you are on.
Sorry, it seems I got ahead of myself. I'm running OpenBSD-current.
From https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Particular-Headers.html
The current code in get_console_width() doesn't work if TIOCGWINSZ is defined in termios.h and GWINSZ_IN_SYS_IOCTL is not defined.
I was going to set up an OpenBSD VM to get to the bottom of this. Without actually testing this for myself I'm not sure what the correct solution is.
I would however be happy to accept a patch that fixes OpenBSD without breaking anything else.
Couldn't one just replace
elif defined GWINSZ_IN_SYS_IOCTL
withelif defined TIOCGWINSZ
in that function? At that point, it shouldn't matter where that constant comes from, right?I just tried that on OpenBSD and it works. Tomorrow, I'll check if it breaks anything on Linux Mint. If not, I'll send a diff to the dev mailinglist. Ok?
If you have a patch that works on OpenBSD, please post it. I can test on Linux.
Ok, got an OpenBSD VM set up. The suggested fix works for Linux and OpenBSD.
Commit is: