Gentoo Archives: gentoo-portage-dev

From: Alec Warner <antarus@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] econf: update configure/config.{sub,guess} atomically to avoid races
Date: Wed, 18 Dec 2013 01:58:20
Message-Id: CAAr7Pr-9s-_6UYQY_Wx+kn_1ktCD6ZfxSbF4WWiVXwX1u0VJaQ@mail.gmail.com
In Reply to: Re: [gentoo-portage-dev] [PATCH] econf: update configure/config.{sub,guess} atomically to avoid races by Greg Turner
1 On Tue, Dec 17, 2013 at 5:41 PM, Greg Turner <gmt@×××××.us> wrote:
2
3 > On Tue, Dec 17, 2013 at 3:28 PM, Mike Frysinger <vapier@g.o> wrote:
4 > > + sed -i \
5 > > + -e
6 > "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" \
7 > > + "${ECONF_SOURCE}/configure" \
8 > > + || die "Substition of shebang in
9 > '${ECONF_SOURCE}/configure' failed"
10 >
11 > Shouldn't we take the same copy, ${pid}-suffix, move approach, here
12 > that we've done with config.{sub,guess}? Otherwise, what's to stop
13 > these sed's from trampling each other's work-in-progress (the fact
14 > that ebuilds don't crash left and right does suggest that some
15 > mechanism actually does prevent this, already -- but it's a mystery to
16 > me, and I worry it could be some kind of linux-specific filesystem
17 > quirk).
18 >
19
20 Sed is already atomic
21
22 antarus@goats5 /tmp/test $ cat foo
23 Debian Rocks!
24 antarus@goats5 /tmp/test $ strace -e trace=file sed -i -e
25 's/Debian/Gentoo/g' foo
26 execve("/bin/sed", ["sed", "-i", "-e", "s/Debian/Gentoo/g", "foo"], [/* 39
27 vars */]) = 0
28 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
29 directory)
30 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
31 directory)
32 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
33 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
34 directory)
35 open("/lib/x86_64-linux-gnu/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
36 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
37 directory)
38 open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
39 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
40 directory)
41 open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
42 statfs("/selinux", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096,
43 f_blocks=5419717, f_bfree=920598, f_bavail=645285, f_files=1379040,
44 f_ffree=885151, f_fsid={-495840576, 2082046975}, f_namelen=255,
45 f_frsize=4096}) = 0
46 open("/proc/filesystems", O_RDONLY) = 3
47 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
48 open("//lib/charset.alias", O_RDONLY) = -1 ENOENT (No such file or
49 directory)
50 open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
51 open("foo", O_RDONLY) = 3
52 open("/proc/filesystems", O_RDONLY) = 4
53 open("./sedfDxBxl", O_RDWR|O_CREAT|O_EXCL, 0600) = 4
54 rename("./sedfDxBxl", "foo") = 0
55
56 -A
57
58
59 > -gmt
60 >
61 >

Replies