commit:     520388fda047e61a04802faf86a3d8d850cc58dc
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon May 13 21:56:09 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May 13 22:19:14 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=520388fd

Render _update_winsize() immune to the prevailing value of IFS

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 functions.sh.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/functions.sh.in b/functions.sh.in
index d1df518..555d1d1 100644
--- a/functions.sh.in
+++ b/functions.sh.in
@@ -638,12 +638,17 @@ _update_tty_level()
 
 _update_winsize()
 {
+       local ifs
+
        # The following use of stty(1) is portable as of POSIX Issue 8. It would
        # be beneficial to leverage the checkwinsize option in bash but the
        # implementation is buggy. Given that Chet has agreed to investigate,
        # it may eventually become possible to support it.
+       ifs=$IFS
+       IFS=' '
        # shellcheck disable=2046
        set -- $(stty size 2>/dev/null)
+       IFS=$ifs
        if [ "$#" -eq 2 ] && is_int "$1" && is_int "$2" && [ "$1" -gt 0 ] && [ 
"$2" -gt 0 ]; then
                genfun_rows=$1
                genfun_cols=$2

Reply via email to