Path: csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail From: james harvey Newsgroups: gnu.bash.bug Subject: Enabling history timestamps makes old commands show .bash_history modified timestamp Date: Sat, 26 Dec 2015 18:15:18 -0500 Lines: 30 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: usenet.stanford.edu 1451266286 10000 208.118.235.17 (28 Dec 2015 01:31:26 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=J80FHfhNe1Q7S3/2TZ0o0Iriw1u4t7RYDvd3ZtfzKmc=; b=053jD5uJSZXg1bItF7j/htkJdSMQ16mdGI7VZ0jucg0CpP8lTGHABnxOrvVf4oRVD/ AHCX4XIfRS0ZGWS87T1qh8o2r1tcSCSCsTLVipsoimIA/i9hkqfJyVXD5nXmnhGm3ENI gWtebCqw5yrve2J6CoWLi3tzDd/HXiRWnQ9YfnfWPDhqQMYpFOPhx4UvGte1xujVWiDd oPNJLDMdaI5MsHJhjEovMzoOt53+luLoSMaKHXB/pF/8xpJscP6klCQGvuydweMZE95Y nBQyNNHKaUi3c0SNCXlMlwZpeJl71L0UWsU3TMFPiZQ7MAhmr15IhvpxCXxyLwY6cB6N sEAw== X-Received: by 10.112.171.35 with SMTP id ar3mr16660996lbc.90.1451171718538; Sat, 26 Dec 2015 15:15:18 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c04::22f X-Mailman-Approved-At: Sun, 27 Dec 2015 20:31:25 -0500 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:12124 When I turn on timestamps for history, .bash_history records without a timestamp (and possibly in-memory records without a timestamp - not sure, haven't tested) inherit the modified timestamp of .bash_history next time it is read. This obviously causes old commands to have a much newer date. I look at HISTTIMEFORMAT as display formatting only, since it writes to .bash_history with since-epoch time. My fix would be to log since-epoch timestamps for each command in .bash_history, and if someone has default HISTTIMEFORMAT, just not to show the timestamps. I'd also implement a backup fix, because you can't retroactively get timestamps for previous commands. And, failing my original fix, this one would make the situation better. I'd have .bash_history commands without a timestamp report as timestamp 0 - 1/1/1970 - rather than the .bash_history modified date, to at least be clear something's off, rather than stealthly report a wrong timestamp. ---Full history customizations--- ========== shopt -s histappend export HISTSIZE=-1 export HISTFILESIZE=-1 export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S " export HISTCONTROL=ignorespace ==========