[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Why COLUMNS is not available, when -i is set?

From: Eduardo A . Bustamante López
Subject: Re: [Help-bash] Why COLUMNS is not available, when -i is set?
Date: Wed, 11 Mar 2015 21:19:23 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

This seems to be a bug. (I'm Cc-ing bug-bash)

When you set the 'i' flag as an option to bash, it works:

    address@hidden ~ % bash -O checkwinsize -ic 'echo "$COLUMNS"'

This is because of the special treatment that 'i' gets in shell.c. There are
some tests there for the value of 'forced_interactive' (the variable set by -i
), and these call init_interactive() when forced_interactive is true (there are
certain variations, but these don't matter much).

But, when you set the 'i' flag via the set builtin, no such special treatment
is given to that change. It just calls change_flag(flag_name, ...) and it
assumes it did its job correctly.

    address@hidden ~ % bash -O checkwinsize -c 'set -i; echo "$COLUMNS"'

So, I see two options:
- We call init_interactive() for the 'i' flag in set.
- Disallow set [-+]i

It's a mess to be able to change the interactive flag like that with set -i/set
+i though, and it will probably lead to more bugs. On the other hand, that's
not a real reason to disallow it. It's just more work.

But, either way, I consider that a bug.

Now, this is by no means a complete patch, but, it shows where the bug probably

    address@hidden ~ % ~/local/src/bash/bash -O checkwinsize -c 'set -i; echo 

I've attached it.

Attachment: set-i.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]