public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Patrick Palka <patrick@parcs.ath.cx>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Append to input history file instead of overwriting it
Date: Sat, 10 Jan 2015 18:17:00 -0000	[thread overview]
Message-ID: <CA+C-WL8OUwmMQxtLRWgNyJAHgdeHS2UAAdZ99WC+mdBJzgUonA@mail.gmail.com> (raw)
In-Reply-To: <83sifi611j.fsf@gnu.org>

On Sat, Jan 10, 2015 at 11:41 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Patrick Palka <patrick@parcs.ath.cx>
>> 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 <eliz@gnu.org> wrote:
>> >> From: Patrick Palka <patrick@parcs.ath.cx>
>> >> 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.

  reply	other threads:[~2015-01-10 18:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29  2:01 Patrick Palka
2014-12-01 20:50 ` Sergio Durigan Junior
2014-12-04 16:18 ` Pedro Alves
2014-12-05  0:19   ` Patrick Palka
2014-12-05 10:45     ` Pedro Alves
2014-12-05 14:11       ` Patrick Palka
2014-12-10 16:54         ` Pedro Alves
2014-12-10 17:17           ` Eli Zaretskii
2014-12-10 17:23             ` Pedro Alves
2015-01-10 14:10           ` Patrick Palka
2015-01-10 15:16             ` Patrick Palka
2015-01-10 15:18               ` Patrick Palka
2015-01-10 15:39                 ` Eli Zaretskii
2015-01-10 15:48                   ` Patrick Palka
2015-01-10 16:03                     ` Eli Zaretskii
2015-01-10 16:18                       ` Patrick Palka
2015-01-10 16:41                         ` Eli Zaretskii
2015-01-10 18:17                           ` Patrick Palka [this message]
2015-01-10 18:46                             ` Patrick Palka
2015-01-12 19:05                               ` Pedro Alves
2015-01-12 22:56                                 ` Patrick Palka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+C-WL8OUwmMQxtLRWgNyJAHgdeHS2UAAdZ99WC+mdBJzgUonA@mail.gmail.com \
    --to=patrick@parcs.ath.cx \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).