From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9299 invoked by alias); 10 Jan 2015 18:17:10 -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 9271 invoked by uid 89); 10 Jan 2015 18:17:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-pd0-f172.google.com Received: from mail-pd0-f172.google.com (HELO mail-pd0-f172.google.com) (209.85.192.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 10 Jan 2015 18:17:07 +0000 Received: by mail-pd0-f172.google.com with SMTP id y13so23243174pdi.3 for ; Sat, 10 Jan 2015 10:17:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=VjYcOhmJXd8CQYiQZYzhOApGPFbpgJnt3w+LTXs2KdM=; b=avxmn4Uc1/oVT80G7KiY8VlxzaNnKCrFnxdrD8+8RivJklzTy5MGL050fuE2oXafUj yZB6BNi+RaxkoNFG2ZK5aHQwyzbC7WWTRytRFPtshqCjChQzvh7292VX8xY05KBf8xu+ mE+MHA8rWxt28HuzsItpgrqYwYYVFKFFjmDUNalDUp6R3wE7Can7hoC6RF7jixcS3uzU SiT3O9ef8cwYDM+RTctgzYfx7wxaf3lXA6/A7EBv35Gk9ZuPQbIeyaDlqp+wcvQ/js7H BmXott+Bo7jwdG/9Q8g4dSELFOAxpQMlMyq6uEG9kVTP1Ct6yIp+6zOGFHa8BQwmC80t m6fw== X-Gm-Message-State: ALoCoQmG2lA/ThMZrydckkdvm+54ux9U84HCELEeysV4FiOpBz5PJuvx+v1X6uJwc/XzrGsDLbwT X-Received: by 10.68.225.7 with SMTP id rg7mr33217735pbc.24.1420913825516; Sat, 10 Jan 2015 10:17:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.70.22.145 with HTTP; Sat, 10 Jan 2015 10:16:45 -0800 (PST) In-Reply-To: <83sifi611j.fsf@gnu.org> References: <1420903108-24831-1-git-send-email-patrick@parcs.ath.cx> <83wq4u63wu.fsf@gnu.org> <83twzy62t5.fsf@gnu.org> <83sifi611j.fsf@gnu.org> From: Patrick Palka Date: Sat, 10 Jan 2015 18:17:00 -0000 Message-ID: Subject: Re: [PATCH] Append to input history file instead of overwriting it To: Eli Zaretskii Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-01/txt/msg00264.txt.bz2 On Sat, Jan 10, 2015 at 11:41 AM, Eli Zaretskii wrote: >> 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. Ah OK. > >> > 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? I would just let it fail. It's no no big deal, just an inconsequential change in semantics: on POSIX, the last process to perform the rename wins the race; on Windows, the first process to perform the rename wins the race. Yet in either case we end up with a more-or-less up-to-date uncorrupted history file.