From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8C37D138247 for ; Wed, 18 Dec 2013 05:17:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0E32DE0AF5; Wed, 18 Dec 2013 05:17:00 +0000 (UTC) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 788EEE0AE6 for ; Wed, 18 Dec 2013 05:16:59 +0000 (UTC) Received: by mail-vb0-f52.google.com with SMTP id p5so4692713vbn.39 for ; Tue, 17 Dec 2013 21:16:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=mEI/ujtX1KgCEk/8ad7YcID1XlUOxhfqN7EYsHXTI5c=; b=mKjir2tSPuDr57/pUqk+k5Q5KIPqspzT2vyeREyR4jnmgLqtiCE/k8TyKckJXoHHFW MTnD1Cc8tXQbDIty9MYHWVB3zWhrhGdXXg2jDRHxi5JQRoVnMh5s+YZ1/gZNnujzPeUv 3lmP/zpc2MHSgnuhv0VShSa+rYlfUuMQ4+f7W4q703FGWEc5ULGyM1juvdfhPPj8Y4St hIjAkcx5kPLxjtJNIIqVfIGrdyyazlKy9t+5eWCjjDolCR+yTMMRDImgkspQZYEQEBTs 2huhpuHGOia/bw1mbuLmiP+Ed3yL8H8XGuiX1eHZczDZ1pkqpQW6G/cM13Codvkij8w7 GrAg== X-Gm-Message-State: ALoCoQmCjiQmb/rQ7i6t71vegfRxTk/5DfrvWtJ/esXtDeGla7Lk5s+15CUGHT1CWYwyhPWPYN90 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 X-Received: by 10.220.97.69 with SMTP id k5mr49857vcn.45.1387343818698; Tue, 17 Dec 2013 21:16:58 -0800 (PST) Sender: antarus@scriptkitty.com Received: by 10.220.59.71 with HTTP; Tue, 17 Dec 2013 21:16:58 -0800 (PST) X-Originating-IP: [173.8.165.226] In-Reply-To: References: <1387322606-3867-1-git-send-email-vapier@gentoo.org> <1387322892-13303-1-git-send-email-vapier@gentoo.org> Date: Tue, 17 Dec 2013 21:16:58 -0800 X-Google-Sender-Auth: uAKrOXnuDwOa_ZfxpK-IFR973XQ Message-ID: Subject: Re: [gentoo-portage-dev] [PATCH] econf: update configure/config.{sub,guess} atomically to avoid races From: Alec Warner To: gentoo-portage-dev@lists.gentoo.org Content-Type: multipart/alternative; boundary=001a11c2dd7e7ec45304edc8270a X-Archives-Salt: 6989c5e5-e813-47ef-add3-26b1bad7e04b X-Archives-Hash: ed2c80e862b014c32eff2bb3b25d3ec9 --001a11c2dd7e7ec45304edc8270a Content-Type: text/plain; charset=UTF-8 On Tue, Dec 17, 2013 at 6:53 PM, Greg Turner wrote: > On Tue, Dec 17, 2013 at 5:58 PM, Alec Warner wrote: > > Sed is already atomic > > > > antarus@goats5 /tmp/test $ cat foo > > Debian Rocks! > > antarus@goats5 /tmp/test $ strace -e trace=file sed -i -e > > 's/Debian/Gentoo/g' foo > [snip] > > open("foo", O_RDONLY) = 3 > > open("/proc/filesystems", O_RDONLY) = 4 > > open("./sedfDxBxl", O_RDWR|O_CREAT|O_EXCL, 0600) = 4 > > rename("./sedfDxBxl", "foo") = 0 > > Nice demonstration! Been wondering about that... > I originally opened the source code and tried to find the actual rename code...but gave up after about 2 minutes figuring strace would be quicker. I was right ;) -A > > -gmt > > --001a11c2dd7e7ec45304edc8270a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Dec 17, 2013 at 6:53 PM, Greg Turner <gmt@malth.us= > wrote:
On Tue, Dec 17, 2013 at 5:58 PM, Alec Warner <antarus@gentoo.org> wrote:
> Sed is already atomic
>
> antarus@goats5 /tmp/test $ cat foo
> Debian Rocks!
> antarus@goats5 /tmp/test $ strace -e trace=3Dfile sed -i -e
> 's/Debian/Gentoo/g' foo
[snip]
> open("foo", O_RDONLY) =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D 3
> open("/proc/filesystems", O_RDONLY) =C2=A0 =C2=A0 =3D 4
> open("./sedfDxBxl", O_RDWR|O_CREAT|O_EXCL, 0600) =3D 4
> rename("./sedfDxBxl", "foo") =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0=3D 0

Nice demonstration! =C2=A0Been wondering about that...

I originally opened the source code and tried to find= the actual rename code...but gave up after about 2 minutes figuring strace= would be quicker. I was right ;)

-A
=C2=A0

-gmt


--001a11c2dd7e7ec45304edc8270a--