Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16387

Re: hash -l with empty hash table prints to stdout

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: hash -l with empty hash table prints to stdout
Date 2020-06-16 09:56 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.1979.1592315773.2541.bug-bash@gnu.org> (permalink)
References <20200615204717.GB28118@jar> <bd77214b-2690-f5de-a814-108e5be8b6f1@case.edu> <447bbb87-ce9a-e038-5a00-68646f9771c4@archlinux.org> <067bf5a9-72ba-f6f6-a170-d1ebaa54919b@case.edu>

Show all headers | View raw


On 6/16/20 9:46 AM, Eli Schwartz wrote:
> On 6/16/20 9:30 AM, Chet Ramey wrote:
>> On 6/15/20 4:47 PM, beluro@web.de wrote:
>>
>>> Bash Version: 5.0
>>> Patch Level: 3
>>> Release Status: release
>>>
>>> Description:
>>
>>> 	`hash -l' is supposed to generate output that is reusable as input
>>> 	(`help hash' says so, at least). In case the hash table is empty, a
>>> 	string not re-usable as input is output to stdout. The exit code
>>> 	indicates success in this case. The string being output is locale-
>>> 	dependant (and therefore is hard to filter out in a work-around).
>>
>> It's an interesting question. An empty hash table is not an error
>> condition, and doesn't result in a non-zero exit status, so output to
>> stderr is not appropriate. You might want to temporarily enable posix mode,
>> which suppresses the message.
> 
> stderr is also a reasonably appropriate place to emit debug info or
> warnings. I would consider this a warning condition...

It's not a warning; there's nothing to warn about. An empty hash table is
not an exceptional condition. It's simply informational.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: hash -l with empty hash table prints to stdout Chet Ramey <chet.ramey@case.edu> - 2020-06-16 09:56 -0400

csiph-web