bug-bash
[Top][All Lists]
Advanced

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

Fwd: Default time for unmarked history lines


From: Reuben Thomas
Subject: Fwd: Default time for unmarked history lines
Date: Mon, 18 Jan 2016 16:53:16 +0000

[
​Forwarding reply erroneously not sent to the list.]​


On 15 January 2016 at 15:26, Chet Ramey <address@hidden> wrote:
On 1/11/16 11:54 AM, Reuben Thomas wrote:
> On 11 January 2016 at 14:22, Chet Ramey <address@hidden
> <mailto:address@hidden>> wrote:
>
>     For a history file without any timestamps, using
>     the current default and setting the history entry timestamp to the current
>     time is more appropriate.
>
>
> ​Why is that? The only similar thing I can think of is file systems, where
> if you zero the metadata you get timestamps of the epoch, not the current
> time.​

OK, consider the situation when a user has no timestamps in his history
file.  There seem to be three choices for the timestamp: the epoch time,
which to me is clearly incorrect ("what? what is this 1970s stuff?"), the
last modified time on the history file itself, and the current time.  I
left the default as the current time, so commands from the history file
are the same as commands entered at the terminal.

​I agree with the user story thought in principle.

The trouble is that this is an experience users have anyway with filesystems and with programs that deal with metadata in files, such as dates in JPEGs: zero (and sometimes absent) metadata result in epoch times/dates.

​By fixing it just in bash you're actually confusing users (like me) who've worked out what tends to happen with 0 dates in general.

So, how about instead interpreting a missing/0 date as a NaD (Not A Date), rather as readline does anyway with time 0, and providing a slightly more meaningful message than the current "??". Then a) I would be able to remove all my bogus "1" timestamps, and b) both "0" and missing timestamps would give the user a clue that data was missing and/or zero?


>     You probably also have histappend set or didn't use something like
>     `history -w' to force the entire history file to be written when the shell
>     exits.
>
>
> ​That's right.​

Then you have presented the history library with an ambiguous situation.

Correct, and it's entirely natural: for years I didn't use timestamps, now I do.

Again, with the solution I propose above, I would get a monotonic history for the part where time is defined, which is good enough.​

--
http://rrt.sc3d.org

reply via email to

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