Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Sep 2012 10:00:36 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        Devin Teske <dteske@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Barton <dougb@freebsd.org>, src-committers@freebsd.org
Subject:   Re: svn commit: r240843 - head/usr.sbin/bsdconfig/timezone/share
Message-ID:  <CAGH67wTd4R9wR2L_9sWmA4E12-VW4x-RzoSRgrD36HOuq%2B4izA@mail.gmail.com>
In-Reply-To: <FE6A261F-D5B9-4767-AAB0-8B01E45421DE@fisglobal.com>
References:  <201209222216.q8MMG7w2053948@svn.freebsd.org> <505FCFED.2000101@FreeBSD.org> <FE6A261F-D5B9-4767-AAB0-8B01E45421DE@fisglobal.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Sep 24, 2012 at 9:45 AM, Devin Teske <devin.teske@fisglobal.com> wrote:
>
> On Sep 23, 2012, at 8:13 PM, Doug Barton wrote:
>
>> On 09/22/2012 15:16, Devin Teske wrote:
>>> -            if : 2> /dev/null > "$_PATH_DB"; then
>>> +            if true 2> /dev/null > "$_PATH_DB"; then
>>>                      cat <<-EOF > "$_PATH_DB"
>>>                      $zoneinfo
>>>                      EOF
>>
>> Is there a reason you're not using mktemp here?
>>
>
> Hi Doug,
>
> There is indeed a reason that mktemp is not used in this situation.
>
> 1. No possibility of a race condition, so little-to-no need for mktemp.
> 2. Using mktemp in a "file-truncate operation" would just be "wrong" (quoting others).
>
> P.S. I posited your question to IRC to see what general consensus was and many agreed that mktemp is not right in this situation.

    Indeed. It's either going to pass (truncate the file) or fail. No
sense in using a temporary file here.
Thanks,
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wTd4R9wR2L_9sWmA4E12-VW4x-RzoSRgrD36HOuq%2B4izA>