From: J. William Campbell <jwilliamcampbell@comcast.net>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Use `ln -sf` rather than `rm -f && ln -s`
Date: Mon, 28 Jan 2008 13:41:22 -0800 [thread overview]
Message-ID: <479E4C02.9060806@comcast.net> (raw)
In-Reply-To: <200801281616.04178.vapier@gentoo.org>
Mike Frysinger wrote:
> On Monday 28 January 2008, Wolfgang Denk wrote:
>
>> In message <200801280638.59012.vapier@gentoo.org> you wrote:
>>
>>> odd ... git-send-email ate the explanatory text ...
>>> ---
>>> The -f option to `ln` should give the same behavior as the -f option to
>>> the `rm` command. It is better to do this in one shot so as to avoid
>>> race conditions when building in parallel. I build on a quad G5 and
>>> without this change, it isn't uncommon for the build to fail when using
>>> -j8 due to this small window where the files don't actually exist.
>>>
>> Note that "ln -s -f" will come down to two separate system calls as
>> well:
>>
>> ...
>> unlink();
>> symlink();
>> ...
>>
>> So you don't avoid the race condition; you're just making it a little
>> less likely at the cost of reduced portability.
>>
>
> yes, i know it's much less likely, but that difference on my system has been
> from 1-in-20 build failures to 1-in-none-so-far-out-of-hundreds. the real
> fix is to overhaul the u-boot build system, but that'll take quite a bit of
> time and this change is for all practical purposes, Good Enough. i dont know
> what portability issues you refer to considering the -f flag is in POSIX and
> has been supported on all Linux systems since before that (pre-2000).
> -mike
>
>
I don't think there is a race condition at all in the "ln -s -f" case.
The race condition exists in the first approach because the shell is
allowed to execute the rm and the ln in parallel, while in the "ln -s
-f" case the two system calls are sequential in the same thread of
execution (inside ln) and therefore happen in a defined order. It is not
just that the window is small, there is no window.
-Bill
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> ------------------------------------------------------------------------
>
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
>
next prev parent reply other threads:[~2008-01-28 21:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-28 11:37 [U-Boot-Users] [PATCH] Use `ln -sf` rather than `rm -f && ln -s` Mike Frysinger
2008-01-28 11:38 ` Mike Frysinger
2008-01-28 20:56 ` Wolfgang Denk
2008-01-28 21:16 ` Mike Frysinger
2008-01-28 21:41 ` J. William Campbell [this message]
2008-01-28 23:11 ` Johannes Stezenbach
2008-01-29 0:27 ` Mike Frysinger
2008-02-14 0:18 ` Wolfgang Denk
2008-01-28 20:53 ` Wolfgang Denk
2008-01-28 20:57 ` Mike Frysinger
2008-04-14 19:50 ` Wolfgang Denk
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=479E4C02.9060806@comcast.net \
--to=jwilliamcampbell@comcast.net \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.