Bug 15841 - history file is touched even if GDB has no terminal (or is in batch mode)
Summary: history file is touched even if GDB has no terminal (or is in batch mode)
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: cli (show other bugs)
Version: unknown
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 15224
  Show dependency treegraph
 
Reported: 2013-08-15 07:43 UTC by hmb
Modified: 2013-08-19 15:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hmb 2013-08-15 07:43:43 UTC
Currently incorrectly history file is touched even if no commands get,
added to it.
below is use case for it (enabled history save on).

$ ls -als ~/gdb_history
0 -rw-rw-r-- 1 mbilal mbilal 0 Aug  8 07:14 /home/mbilal/gdb_history

$ date
Thu Aug  8 07:15:53 PKT 2013

$ ./gdb  -ex "set history filename ~/gdb_history" < /dev/null
GNU gdb (GDB) 7.6.50.20130807-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".

(gdb) quit

$ ls -als ~/gdb_history
0 -rw-rw-r-- 1 mbilal mbilal 0 Aug  8 07:15 /home/mbilal/gdb_history
Comment 1 Sourceware Commits 2013-08-15 08:18:34 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	mbilal@sourceware.org	2013-08-15 08:18:32

Modified files:
	gdb            : top.c ChangeLog 

Log message:
	2013-08-15  Muhammad Bilal  <mbilal@codesourcery.com>
	
	PR cli/15841
	* top.c (quit_force): Skip writing history file
	if input is not from terminal.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/top.c.diff?cvsroot=src&r1=1.240&r2=1.241
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15906&r2=1.15907
Comment 2 hmb 2013-08-15 08:22:42 UTC
fixed