From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1582 invoked by alias); 10 Dec 2014 17:17:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 1572 invoked by uid 89); 10 Dec 2014 17:17:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mtaout20.012.net.il Received: from mtaout20.012.net.il (HELO mtaout20.012.net.il) (80.179.55.166) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Dec 2014 17:17:37 +0000 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NGD00H00M9XGL00@a-mtaout20.012.net.il> for gdb-patches@sourceware.org; Wed, 10 Dec 2014 19:12:34 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NGD00HAKMGY7250@a-mtaout20.012.net.il>; Wed, 10 Dec 2014 19:12:34 +0200 (IST) Date: Wed, 10 Dec 2014 17:17:00 -0000 From: Eli Zaretskii Subject: Re: [PATCH] Append to input history file instead of overwriting it In-reply-to: <54887AB5.3000101@redhat.com> To: Pedro Alves Cc: patrick@parcs.ath.cx, gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83a92vv37l.fsf@gnu.org> References: <1417226462-11254-1-git-send-email-patrick@parcs.ath.cx> <54808956.9070507@redhat.com> <54818CCE.5010701@redhat.com> <54887AB5.3000101@redhat.com> X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00209.txt.bz2 > Date: Wed, 10 Dec 2014 16:54:13 +0000 > From: Pedro Alves > 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.