[sf-lug] dpkg -l & width ...

Daniel Gimpelevich daniel at gimpelevich.san-francisco.ca.us
Wed Aug 2 09:31:04 PDT 2017


On Wed, 2017-08-02 at 07:30 -0700, Michael Paoli wrote:
> > From: "Rick Moen" <rick at linuxmafia.com>
> > Subject: Re: [sf-lug] NEED INFO ABOUT BOOT SECTOR, SPACE LIMITS
> > Date: Tue, 1 Aug 2017 10:51:28 -0700
> 
> > Quoting Daniel Gimpelevich (daniel at gimpelevich.san-francisco.ca.us):
> >
> >> In the steps I gave, I piped dpkg -l through cat because it apparently
> >> detects the number of columns from the tty that is stdout, and not from
> >> a pipe, e.g. to less or cat.
> >
> > Well, OK, but in my experience, 'dpkg -l | less' works just great
> > provided you run it in a terminal 80 columns (or more) wide, so my point
> > to Alex is that I'm puzzled he perceives a problem he needs scripting to
> > solve.
> >
> > No special steps should be required at all, is my point.  Just have an
> > adequately wide terminal, nothing more.  If there's a problem you see,
> > then maybe your terminal is screwed up and you should be fixing _that_
> > instead.
> 
> Hmmm, I seem to get the behavior Daniel observes.
> Rick, perhaps you have COLUMNS in your typical environment,
> and Daniel and I don't?
> As far as I can easily tell, dpkg -l will use COLUMNS if it's set
> in the environment (but if it's set to less than 80 it seems to treat
> it as if it was set to 80), and if COLUMNS is not set and if stdout
> isatty(3), will try to determine and use width of the tty.
> Or, Rick, perhaps you have some other environmental or version difference
> that gives slightly different behavior?

I just checked, and I _do_ have it set, apparently by the checkwinsize
shell option in bash, because it changes when I resize the window, as
reported by the "echo" command in bash. However, the "env" command does
not output the variable, because it's not exported. If I manually export
it, the exported value also changes with window size, but this would
break my "dpkg -l" habits, so I'm not going to do that. IIRC, Rick
primarily uses a terminal window in macOS, which may or may not properly
set termcap and/or send SIGWINCH.




More information about the sf-lug mailing list