[Top][All Lists]

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

Re: Builtin history -r does not work with named pipes (i.e. GNU readline

From: dualbus
Subject: Re: Builtin history -r does not work with named pipes (i.e. GNU readline's histfile.c read_history_range)
Date: Mon, 29 May 2017 15:40:10 -0500
User-agent: NeoMutt/20170113 (1.7.2)

On Mon, May 29, 2017 at 04:17:16PM -0400, Chet Ramey wrote:
> So the bug is that readline doesn't print an error message if the history
> file isn't a regular file?

Correct. Another problem is that the history builtin doesn't propagate
back a meaningful return code indicating that there was a problem.

A simple example is that you're trying to seed your history by appending
the output of a command using `history -r'. So you might try:

| $ history -cr <(echo a complex command); echo $?; history
| 0

But for some reason that doesn't work and there is no apparent problem
with it. 

Whereas the following does work:

| $ history -cr /dev/stdin <<<'a complex command'; echo $?; history
| 0
|     1  a complex command

Or, which indicates that something went wrong:

| $ history -cr /tmp; echo $?; history
| 1

In my opinion it should at least return an error code. And if possible
an error message.

The other option is to implement support for reading from non-regular
files, but I'm not sure if it's worth it.

Eduardo Bustamante

reply via email to

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