coreutils
[Top][All Lists]
Advanced

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

Re: Bug#1075768: coreutils: ls doesn't honour COLUMNS if writing to a te


From: Pádraig Brady
Subject: Re: Bug#1075768: coreutils: ls doesn't honour COLUMNS if writing to a teletype
Date: Thu, 4 Jul 2024 20:11:32 +0100
User-agent: Mozilla Thunderbird Beta

On 04/07/2024 17:29, наб wrote:
Package: coreutils
Version: 9.1-1
Version: 9.4-3
Severity: normal

Dear Maintainer,

Quoth POSIX.1-2024:
103406  ENVIRONMENT VARIABLES
103407  The following environment variables shall affect the execution of ls:
103408  COLUMNS  Override the system-selected horizontal display line size, 
used to determine the
103409           column position width for writing multiple text-column output. 
See XBD Chapter
103410           8 (on page 167) for valid values and results when it is unset 
or null. The ls utility
103411           shall use this value to calculate how many pathname text 
columns to write (see
103412           −C). The column width chosen to write the names of files in 
any given directory
103413           shall be constant. Filenames shall not be truncated to fit 
into the multiple text-
103414           column output.

Quoth UNIX™ System V ‒ Release 2.0 User Reference Manual, DEC™ Processors 
(1984):
   There are three major listing formats.  The default format is to list one 
entry
   per line, the -C and -x options enable multi-column formats, and the -m
   option enables stream output format in which files are listed across the 
page,
   separated by commas.  In order to determine output formats for the -C, -x,
   and -m options, /s uses an environment variable, COLUMNS, to determine the
   number of character positions available on one output line.  If this 
variable is
   not set, the terminfo database is used to determine the number of columns,
   based on the environment variable TERM.  If this information cannot be
   obtained, 80 columns are assumed.

Right, both POSIX 2003 and 2008 say that COLUMNS should override any auto width 
determination.
However since the beginning, GNU ls has the -w option to override the width,
and so leaves $COLUMNS as something that is auto set (and usually is by the 
shell).
Since changing this to align with POSIX adds no new functionality,
I'm reluctant to adjust this at this stage, in case COLUMNS is set
incorrectly / inadvertently for some users.
We could safely change this I suppose, gated with the POSIXLY_CORRECT env var.

cheers,
Pádraig.



reply via email to

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