[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] procps output truncated due to bash setting $COLUMNS
From: |
Pierre Gaston |
Subject: |
Re: [Help-bash] procps output truncated due to bash setting $COLUMNS |
Date: |
Tue, 1 Jan 2013 13:20:00 +0200 |
On Tue, Jan 1, 2013 at 8:26 AM, <address@hidden> wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.2
> -L/home/abuild/rpmbuild/BUILD/bash-4.2/../readline-6.2
> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-suse-linux-gnu'
> -DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
> -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -fmessage-length=0 -O2 -Wall
> -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
> -fasynchronous-unwind-tables -g -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g
> -std=gnu89 -Wuninitialized -Wextra -Wno-unprototyped-calls -Wno-switch-enum
> -Wno-unused-variable -Wno-unused-parameter -ftree-loop-linear -pipe
> -fprofile-use
> uname output: Linux ares07 3.4.18-jng6-default #1 SMP Wed Nov 14 17:04:47 UTC
> 2012 (21e90c1) x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-suse-linux-gnu
>
> Bash Version: 4.2
> Patch Level: 24
> Release Status: release
>
> Description:
> procps-3.3.3 and later versions truncate their output at $COLUMN
> columns, for example when executing `ps | less -S`.
> The logic procps uses is, in this order, quoted from the source:
>
> // 1. Defaults are implementation-specific. (ioctl,termcap,guess)
> // 2. COLUMNS and LINES override the defaults. (standards compliance)
> // 3. Command line options override everything else.
> // 4. Actual output may be more if the above is too narrow.
>
> This sounds reasonable. What makes it awkward is that bash *always*
> has $COLUMNS set. That looks like an undesired feature to me.
>
> tcsh for example does not set $COLUMNS on its own.
>
> The question here is: should bash not set $COLUMNS, or should ps
> ignore $COLUMNS if not outputting to a tty, or something else?
>
> Repeat-By:
> ps | less
>
> Observe how one does not get more than $COLUMNS worth of output,
> even though ps's stdout is not a tty.
>
> Fix:
> My proposed "fix" is to turn off automatic setting of $COLUMNS -
> or at least to not export it if it was automatically set.
>
Bash sets COLUMNS when interactive, but it does not export it so it
should not interfere with other tools unless it is exported in one of
your startup files.