Path: csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail From: Chet Ramey Newsgroups: gnu.bash.bug Subject: Re: Segfault using HISTTIMEFORMAT Date: Sun, 20 Sep 2015 17:59:29 -0400 Organization: ITS, Case Western Reserve University Lines: 27 Approved: bug-bash@gnu.org Message-ID: References: <05094877-b5a0-4f55-8284-08a27c601353@googlegroups.com> Reply-To: chet.ramey@case.edu NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1442786379 21905 208.118.235.17 (20 Sep 2015 21:59:39 GMT) X-Complaints-To: action@cs.stanford.edu Cc: chet.ramey@case.edu To: rens@endoria.net, bug-bash@gnu.org Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: <05094877-b5a0-4f55-8284-08a27c601353@googlegroups.com> X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 129.22.105.36 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:11519 On 9/20/15 4:59 PM, rens@endoria.net wrote: > When using HISTTIMEFORMAT and a timestamp which is out of range bash seems to segfault. I've tested this with bash version 4.3.30(1)-release (x86_64-pc-linux-gnu) on Debian 8 stable. > > Here is how to reproduce: > * Change (or add) a timestamp in .bash_history to: > #999999999999999999 > > * Start a new bash shell > > * Run the following commands: > export HISTTIMEFORMAT="[%F %T] " > history > > When history gets executed bash segfaults. It segfaults in strftime() in the C library, which must not be prepared to handle LONG_MAX or LONG_MIN on that system. I'll take a look and see if we can trap that overflow, though you'd like to see strftime handle it better. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/