Debian Bug report logs -
#628638
bash.1: "shopt -s checkwinsize" has no effect in non-interactive shells
Reply or subscribe to this bug.
Toggle useless messages
Report forwarded
to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#628638; Package bash.
(Mon, 30 May 2011 22:48:04 GMT) (full text, mbox, link).
Acknowledgement sent
to Leslie A Rhorer <lrhorer@satx.rr.com>:
New Bug report received and forwarded. Copy sent to Matthias Klose <doko@debian.org>.
(Mon, 30 May 2011 22:48:04 GMT) (full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
Package: bash
Version: 4.1-3
Severity: normal
The $COLUMNS variable seems to work properly in a terminal window (with shopt -s checkwinsize), but in a child script, the $COLUMNS variable is null no matter what I try, even if the windows is resized while running the script.
-- System Information:
Debian Release: 6.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages bash depends on:
ii base-files 6.0 Debian base system miscellaneous f
ii dash 0.5.5.1-7.4 POSIX-compliant shell
ii debianutils 3.4 Miscellaneous utilities specific t
ii libc6 2.11.2-10 Embedded GNU C Library: Shared lib
ii libncurses5 5.7+20100313-5 shared libraries for terminal hand
Versions of packages bash recommends:
ii bash-completion 1:1.2-3 programmable completion for the ba
Versions of packages bash suggests:
pn bash-doc <none> (no description available)
-- Configuration Files:
/etc/bash.bashrc changed:
alias ll="ls -la"
[ -z "$PS1" ] && return
shopt -s checkwinsize
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
if [ -x /usr/lib/command-not-found ]; then
function command_not_found_handle {
# check because c-n-f could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/bin/python /usr/lib/command-not-found -- $1
return $?
else
return 127
fi
}
fi
-- no debconf information
Information forwarded
to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#628638; Package bash.
(Tue, 31 May 2011 00:00:27 GMT) (full text, mbox, link).
Acknowledgement sent
to Jonathan Nieder <jrnieder@gmail.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>.
(Tue, 31 May 2011 00:00:27 GMT) (full text, mbox, link).
Message #10 received at 628638@bugs.debian.org (full text, mbox, reply):
retitle 628638 bash.1: "shopt -s checkwinsize" has no effect in non-interactive shells
severity 628638 minor
tags 628638 + upstream
quit
Hi Leslie,
Leslie A Rhorer wrote:
> The $COLUMNS variable seems to work properly in a terminal window
> (with shopt -s checkwinsize), but in a child script, the $COLUMNS
> variable is null no matter what I try, even if the windows is
> resized while running the script.
I tried to reproduce this like so:
cat >$HOME/bin/echocolumns <<\EOF
#!/bin/bash
shopt -s checkwinsize
read tmp
echo $COLUMNS
EOF
chmod +x $HOME/bin/echocolumns
echocolumns
[resize the terminal, then hit enter]
Indeed, it printed a blank line instead of a number of columns. But
I can't really fault bash for this behavior when
#!/bin/sh
tput cols
works reliably.
Do you agree? If so, could you suggest a patch for the manpage? If
not, what would be a better behavior?
Thanks for reporting,
Jonathan
Changed Bug title to 'bash.1: "shopt -s checkwinsize" has no effect in non-interactive shells' from 'bash: winndow size not tracked in child shell'
Request was from Jonathan Nieder <jrnieder@gmail.com>
to control@bugs.debian.org.
(Tue, 31 May 2011 00:00:29 GMT) (full text, mbox, link).
Severity set to 'minor' from 'normal'
Request was from Jonathan Nieder <jrnieder@gmail.com>
to control@bugs.debian.org.
(Tue, 31 May 2011 00:00:29 GMT) (full text, mbox, link).
Added tag(s) upstream.
Request was from Jonathan Nieder <jrnieder@gmail.com>
to control@bugs.debian.org.
(Tue, 31 May 2011 00:00:30 GMT) (full text, mbox, link).
Information forwarded
to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#628638; Package bash.
(Wed, 01 Jun 2011 01:54:08 GMT) (full text, mbox, link).
Acknowledgement sent
to <lrhorer@satx.rr.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>.
(Wed, 01 Jun 2011 01:54:08 GMT) (full text, mbox, link).
Message #21 received at 628638@bugs.debian.org (full text, mbox, reply):
> -----Original Message-----
> From: Jonathan Nieder [mailto:jrnieder@gmail.com]
> Sent: Monday, May 30, 2011 6:57 PM
> To: Leslie A Rhorer
> Cc: 628638@bugs.debian.org
> Subject: Re: bash: window size not tracked in child shell
>
> retitle 628638 bash.1: "shopt -s checkwinsize" has no effect in non-
> interactive shells
> severity 628638 minor
> tags 628638 + upstream
> quit
>
> Hi Leslie,
>
> Leslie A Rhorer wrote:
>
> > The $COLUMNS variable seems to work properly in a terminal window
> > (with shopt -s checkwinsize), but in a child script, the $COLUMNS
> > variable is null no matter what I try, even if the windows is
> > resized while running the script.
>
> I tried to reproduce this like so:
>
> cat >$HOME/bin/echocolumns <<\EOF
> #!/bin/bash
> shopt -s checkwinsize
> read tmp
> echo $COLUMNS
> EOF
>
> chmod +x $HOME/bin/echocolumns
> echocolumns
> [resize the terminal, then hit enter]
>
> Indeed, it printed a blank line instead of a number of columns. But
> I can't really fault bash for this behavior when
>
> #!/bin/sh
> tput cols
>
> works reliably.
OK, why? Why doesn't sending the process a SIGWINCH force it to update the
$COLUMNS variable?
> Do you agree? If so, could you suggest a patch for the manpage? If
> not, what would be a better behavior?
>
> Thanks for reporting,
> Jonathan
Well, I'm not quite sure what you mean by "can't really fault bash...", but
yes, if there is an acceptable work-around, I suppose merely updating the
man page is sufficient. What about the $LINES variable? How can the script
obtain it? Assuming there is a way, I would suggest something very close to
your report above. Perhaps:
"The checkwinsize parameter has no effect in non-interactive shells. The
$COLUMNS and $LINES parameters will remain null unless updated by the script
itself. EXAMPLE: If one must obtain the width of the screen, one may set
COLUMNS=$( tput cols ). To obtain the window height, set LINES="
Followed by however that is done.
Information forwarded
to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#628638; Package bash.
(Wed, 01 Jun 2011 02:51:14 GMT) (full text, mbox, link).
Acknowledgement sent
to Jonathan Nieder <jrnieder@gmail.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>.
(Wed, 01 Jun 2011 02:51:16 GMT) (full text, mbox, link).
Message #26 received at 628638@bugs.debian.org (full text, mbox, reply):
Explain that COLUMNS and LINES are not set automatically in
non-interactive shells, and recommend direct use of the tput utility
from ncurses as a replacement.
Fixes: http://bugs.debian.org/628638
Reported-by: Leslie A Rhorer <lrhorer@satx.rr.com>
Helped-by: Leslie A Rhorer <lrhorer@satx.rr.com>
---
Hi Chet et al,
Here's a quick documentation patch, based on the report mentioned
above. Thoughts of all kinds welcome.
doc/bash.1 | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/doc/bash.1 b/doc/bash.1
index 1890b3c..4df0986 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -1802,7 +1802,10 @@ being closed.
.TP
.B COLUMNS
Used by the \fBselect\fP builtin command to determine the terminal width
-when printing selection lists. Automatically set upon receipt of a SIGWINCH.
+when printing selection lists. Automatically set in interactive shells
+upon receipt of a SIGWINCH.
+To obtain the width of the terminal in a non-interactive shell,
+use \fBCOLUMNS\fP=$(tput cols).
.TP
.B COMPREPLY
An array variable from which \fBbash\fP reads the possible completions
@@ -2021,9 +2024,12 @@ This variable determines the locale category used for number formatting.
.TP
.B LINES
Used by the \fBselect\fP builtin command to determine the column length
-for printing selection lists. Automatically set upon receipt of a
+for printing selection lists. Automatically set in interactive shells
+upon receipt of a
.SM
.BR SIGWINCH .
+To obtain the width of the terminal in a non-interactive shell,
+use \fBLINES\fP=$(tput lines).
.TP
.B MAIL
If this parameter is set to a file name and the
@@ -8732,8 +8738,8 @@ above). The shell always
postpones exiting if any jobs are stopped.
.TP 8
.B checkwinsize
-If set, \fBbash\fP checks the window size after each command
-and, if necessary, updates the values of
+If set and the shell is interactive, \fBbash\fP checks the window size
+after each command and, if necessary, updates the values of
.SM
.B LINES
and
--
1.7.5.3
Added tag(s) patch.
Request was from Jonathan Nieder <jrnieder@gmail.com>
to control@bugs.debian.org.
(Wed, 01 Jun 2011 03:03:03 GMT) (full text, mbox, link).
Information forwarded
to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#628638; Package bash.
(Wed, 01 Jun 2011 18:54:10 GMT) (full text, mbox, link).
Acknowledgement sent
to Jonathan Nieder <jrnieder@gmail.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>.
(Wed, 01 Jun 2011 18:54:10 GMT) (full text, mbox, link).
Message #35 received at 628638@bugs.debian.org (full text, mbox, reply):
Jonathan Nieder wrote:
> Leslie Rhorer wrote:
>> Yeah, I think that's fine. Feel free to close the bug report.
>
> Thanks for looking it over (and thanks for reporting the problem in
> the first place). I'll leave the bug open until the patch or
> something like it is applied.
Gah! Wrong address; sorry for the noise.
Information forwarded
to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#628638; Package bash.
(Sun, 05 Jun 2011 00:48:07 GMT) (full text, mbox, link).
Acknowledgement sent
to chet.ramey@case.edu:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>.
(Sun, 05 Jun 2011 00:48:07 GMT) (full text, mbox, link).
Message #40 received at 628638@bugs.debian.org (full text, mbox, reply):
On 5/31/11 10:49 PM, Jonathan Nieder wrote:
> Explain that COLUMNS and LINES are not set automatically in
> non-interactive shells, and recommend direct use of the tput utility
> from ncurses as a replacement.
Thanks for the report, though the tput recommendation doesn't belong in
a manual page. It's more appropriate for an FAQ or a bash guide.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
Information forwarded
to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#628638; Package bash.
(Fri, 18 Jul 2014 16:51:05 GMT) (full text, mbox, link).
Acknowledgement sent
to "Wolcott, Kristle Kaye" <kristle.wolcott@mnsu.edu>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>.
(Fri, 18 Jul 2014 16:51:05 GMT) (full text, mbox, link).
Message #45 received at 628638@bugs.debian.org (full text, mbox, reply):
From: Wolcott, Kristle Kaye
Sent: Friday, July 18, 2014 11:36 AM
Subject: Help Desk
Dear Faculty & Staff
ITS Help Desk Institute account Maintenance Routine System. all institutional mail account users are advice to upgrade /update account now This has been made mandatory for all. To Upgrade/Update CLICK HERE<http://web-mailhelpdesksystem.dudaone.com>
Failure to do this you will have your account suspended on till report is made to the institution authorities.
ITS Service Team
© Copyright 2014.
All Rights Reserved
Information forwarded
to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#628638; Package bash.
(Sat, 18 Feb 2017 19:15:03 GMT) (full text, mbox, link).
Acknowledgement sent
to adwideme@box709.bluehost.com:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>.
(Sat, 18 Feb 2017 19:15:03 GMT) (full text, mbox, link).
Message #50 received at 628638@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
Dear Customer,
We can not deliver your parcel arrived at February 15.
Please check delivery label attached!
With thanks and appreciation,
Gordon Morton,
UPS Parcels Delivery Clerk.
[UPS-Receipt-3500719.zip (application/zip, attachment)]
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Wed Dec 6 06:20:11 2023;
Machine Name:
bembo
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.