public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: merlyn@stonehenge•com (Randal L. Schwartz)
To: Andy Parkins <andyparkins@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [RFC/PATCH] Implement poor-man's submodule support using  commit hooks
Date: 20 Dec 2006 07:42:05 -0800	[thread overview]
Message-ID: <86y7p21smq.fsf@blue.stonehenge.com> (raw)
In-Reply-To: <200612201440.41784.andyparkins@gmail.com>

>>>>> "Andy" == Andy Parkins <andyparkins@gmail•com> writes:

Andy>  fd_old = open( "someexistingfile" );
Andy>  unlink( "someexistingfile" );
Andy>  fd_new = open( "someexistingfile" );

This is dangerous if the process aborts suddenly.

Might be better to do this:

mumble_command < thefile > thefile.$$
mv thefile.$$ thefile

The second move will be atomic.  The only problem will be if the process
aborts, which will leave stale temp files around.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge•com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.

  reply	other threads:[~2006-12-20 15:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-20 13:09 [RFC/PATCH] Implement poor-man's submodule support using commit hooks Andy Parkins
2006-12-20 13:29 ` Johannes Sixt
2006-12-20 13:47   ` Andy Parkins
2006-12-20 14:07     ` Jakub Narebski
2006-12-20 14:20       ` Andy Parkins
2006-12-20 14:33     ` Rogan Dawes
2006-12-20 14:40       ` Andy Parkins
2006-12-20 15:42         ` Randal L. Schwartz [this message]
2006-12-20 16:09         ` Johannes Schindelin
2006-12-20 13:36 ` Martin Waitz
2006-12-20 13:48   ` Andy Parkins
2006-12-20 14:35   ` Andy Parkins
2006-12-20 15:44     ` Martin Waitz
2006-12-20 14:18 ` Johannes Sixt

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=86y7p21smq.fsf@blue.stonehenge.com \
    --to=merlyn@stonehenge$(echo .)com \
    --cc=andyparkins@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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