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


Groups > gnu.bash.bug > #16393

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

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Eli Schwartz <eschwartz@archlinux.org>
Newsgroups gnu.bash.bug
Subject Re: hash -l with empty hash table prints to stdout
Date Tue, 16 Jun 2020 22:38:51 -0400
Lines 80
Approved bug-bash@gnu.org
Message-ID <mailman.2032.1592361549.2541.bug-bash@gnu.org> (permalink)
References <87o8pi4eya.fsf@hobgoblin.ariadne.com> <8788c02a-fcbd-9126-391e-718cc2e0a3de@archlinux.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="628hV0C0gvMhP4twtZFfGDkRgKhx8qRrP"
X-Trace usenet.stanford.edu 1592361550 15371 209.51.188.17 (17 Jun 2020 02:39:10 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
X-Spam-BL-Results
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1592361535; bh=HiAFnNuw7dJlxkiKYbqD8k7Hx6G/o+oYeTpTjpZkQTk=; h=Subject:To:References:From:Date:In-Reply-To; b=lrrNuJqf1i/tD5qIuoMbCkySSjtnLvLl3HAI8WT1WRn/Qj6qpvONFgLJNmGFm5VKw t3r6S29SgaW31/HCGdEpRa38SmLAc6YSeoUsazHsDK9Mpsw/qOYyWcBT4UtYvA6h8a T7eDGUeMhm+okuspInBrJGU1iNeVC1dIOvBUYoXoQJGWgJbUe/feAzM/HIOu98Mi7k QKvNUfkNZBttkRZkGECFTC5Lm9qJ43c5hauEEOuVit5WwpIU8gnhq9q2TKT+fjtt3J ydfBtPERDJCk7tuM5Tg0cjp3/rIMO3Dgbjcf8IvBqLO7zD8jb1OC8lbyk21XmatlaG OPyhnJ3T16TBi+bL1EccG5H2h25gCGFzGnKgcI1MbMhq31cmm02Ygtjt1uozWQtYfX m/X9/WAR+t8jIMe07vDZ/LHZF/SOiofiq4A2/fcEHEJNl7+fRlLKjsYRdbiMeXqbpR YI+fVo1xI5f6ecU6sbjsxvLyiNjnqvqcR0mgY5TfBERD3V7MnCThrz/TuLU8DdDKLq oVee+U+vLHE1PTXdHnCWQqldOja3Zrnpuy1Dd3W4ekPSlej0LCci+dUMi/OfXBcraq c7c/1LKtKeOluTp0D2E1klO5ogTWM9Q9OCgqHZUqv2oQ/odnuM3TlX+RrnNOZ95Qd6 GLpiOKQ95ljtvcoal2PrVtH4=
X-Clacks-Overhead GNU Terry Pratchett
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0
In-Reply-To <87o8pi4eya.fsf@hobgoblin.ariadne.com>
Received-SPF pass client-ip=2a01:4f8:160:6087::1; envelope-from=eschwartz@archlinux.org; helo=orion.archlinux.org
X-detected-operating-system by eggs.gnu.org: No matching host in p0f cache. That's all we know.
X-Spam_score_int -53
X-Spam_score -5.4
X-Spam_bar -----
X-Spam_report (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action no action
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <8788c02a-fcbd-9126-391e-718cc2e0a3de@archlinux.org>
X-Mailman-Original-References <87o8pi4eya.fsf@hobgoblin.ariadne.com>
Xref csiph.com gnu.bash.bug:16393

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 6/16/20 10:13 PM, Dale R. Worley wrote:
> What a weird problem!  Yes, "hash -l" should produce output that can be
> read by bash.  But sending the "bash: hash table empty" message to
> stderr put you in the situation where "hash -l >file" doesn't really
> leave the output of "hash -l" in "file".  

Of course it would. The output of hash -l would be "bash-parseable code
to recreate the hash table", as in fact is currently documented. And
*diagnostic* messages are not output, and should not be treated as
output, and don't belong in that file one way or another.

If one really, truly wanted to collect both the expected output *and*
the diagnostic messages, one could redirect stderr too... but I don't
foresee this as being a problem. ;) People would be more likely to
redirect it to /dev/null.

> Maybe you could make the empty
> message be a comment?
> 
>     $ hash -l
>     # hash: hash table empty
> 
> That is acceptable input for bash, has the right effect when read by
> bash, is human-readable, and is capturable by redirecting stdout.

As I suggested, yes. :)

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

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


Thread

Re: hash -l with empty hash table prints to stdout Eli Schwartz <eschwartz@archlinux.org> - 2020-06-16 22:38 -0400

csiph-web