[PATCH] Append to input history file instead of overwriting it

Eli Zaretskii eliz@gnu.org
Wed Dec 10 17:17:00 GMT 2014


> Date: Wed, 10 Dec 2014 16:54:13 +0000
> From: Pedro Alves <palves@redhat.com>
> CC: gdb-patches@sourceware.org
> 
> Is it that hard to do though?  How about temporarily renaming the
> history file to something that includes gdb's PID (and would not a
> file name a user would use in practice) while we append
> to it, and then (atomically) rename it back?  Something like:
> 
>  #1 - move $HISTFILE -> $HISTFILE-gdb$PID~
>  #2 - write/append history to $HISTFILE-gdb$PID~
>  #3 - move $HISTFILE-gdb$PID~ -> $HISTFILE

You cannot portably rename a file someone writes to, unless you are
willing to limit this to Posix filesystems.



More information about the Gdb-patches mailing list