From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3798 invoked by alias); 10 Jan 2015 16:41:36 -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 3781 invoked by uid 89); 10 Jan 2015 16:41:33 -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: mtaout21.012.net.il Received: from mtaout21.012.net.il (HELO mtaout21.012.net.il) (80.179.55.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 10 Jan 2015 16:41:31 +0000 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0NHY00800ZO37400@a-mtaout21.012.net.il> for gdb-patches@sourceware.org; Sat, 10 Jan 2015 18:41:28 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NHY007HBZP4YR80@a-mtaout21.012.net.il>; Sat, 10 Jan 2015 18:41:28 +0200 (IST) Date: Sat, 10 Jan 2015 16:41:00 -0000 From: Eli Zaretskii Subject: Re: [PATCH] Append to input history file instead of overwriting it In-reply-to: To: Patrick Palka Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83sifi611j.fsf@gnu.org> References: <1420903108-24831-1-git-send-email-patrick@parcs.ath.cx> <83wq4u63wu.fsf@gnu.org> <83twzy62t5.fsf@gnu.org> X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00263.txt.bz2 > From: Patrick Palka > Date: Sat, 10 Jan 2015 11:17:56 -0500 > Cc: gdb-patches@sourceware.org > > On Sat, Jan 10, 2015 at 11:03 AM, Eli Zaretskii wrote: > >> From: Patrick Palka > >> Date: Sat, 10 Jan 2015 10:48:03 -0500 > >> Cc: gdb-patches@sourceware.org > >> > >> > On Windows, a call to 'rename' fails if the destination already > >> > exists. Does the logic here cope with that? > >> > >> Hmm, the logic does not really cope with Windows' behavior here, > >> because the above warning should only get emitted for unexpected > >> failures. So I suppose we should only emit the above warning if errno > >> != EBUSY (perhaps only on Windows systems)? > > > > Why EBUSY? > > Just a wild guess. What would be the correct error code to check for? > Looks like it would be EACCES.. According to my testing, it's EEXIST. > > We could also explicitly remove the target before the rename call (and > > ignore any errors from that), which will make it work like on Posix > > systems. > > I don't think that would be sufficient. In a hypothetical but > plausible scenario, process GDB1 would call unlink(), process GDB2 > would then call unlink(), process GDB1 would then call rename() > successfully, process GDB2 would then call rename() and fail on > Windows despite calling unlink() on the destination. What would you suggest that GDB2 does instead? I see no solution here that would not fail in some way. Do you?