Re: [PATCH v3] localedata: Avoid concurrently written locales in gen-locale.sh

Florian Weimer <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
* Florian Weimer:

> There is no cross-directory exclusion of concurrent $(gen-locales)
> usage.  Parallel localedef calls can clobber locale data as it is
> being loaded by tests.
>
> With --no-hard-links, the separate touch invocation is now longer
> necessary.
>
> ---
> v2: Avoid mv options.  Probably more portable.
> v3: Add missing mkdir call.  Test is still running.
>  localedata/gen-locale.sh | 26 ++++++++++++++++++--------
>  1 file changed, 18 insertions(+), 8 deletions(-)
>
> diff --git a/localedata/gen-locale.sh b/localedata/gen-locale.sh
> index 4762c04284..013d26eafb 100644
> --- a/localedata/gen-locale.sh
> +++ b/localedata/gen-locale.sh
> @@ -32,17 +32,27 @@ generate_locale ()
>    out=$3
>    flags=$4
>    ret=0
> +
> +  # Use a staging area to avoid writing to locales concurrently.
> +  # While this process is running, $$ is sufficiently unique.
> +  # Use --no-hard-links to prevent localedef from accessing
> +  # other staging areas.
> +  stage="${common_objpfx}localedata/gen-locale.$$.tmp"
> +  mkdir "$stage" 2>/dev/null || true

Oh well.  With these changes, --no-hard-links is no longer needed
(no peer directories to check).  Should I leave it in?

Thanks,
Florian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.