On Tue, Dec 17, 2013 at 5:41 PM, Greg Turner <g...@malth.us> wrote:

> On Tue, Dec 17, 2013 at 3:28 PM, Mike Frysinger <vap...@gentoo.org> wrote:
> > +                       sed -i \
> > +                               -e
> "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" \
> > +                               "${ECONF_SOURCE}/configure" \
> > +                               || die "Substition of shebang in
> '${ECONF_SOURCE}/configure' failed"
>
> Shouldn't we take the same copy, ${pid}-suffix, move approach, here
> that we've done with config.{sub,guess}?  Otherwise, what's to stop
> these sed's from trampling each other's work-in-progress (the fact
> that ebuilds don't crash left and right does suggest that some
> mechanism actually does prevent this, already -- but it's a mystery to
> me, and I worry it could be some kind of linux-specific filesystem
> quirk).
>

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
execve("/bin/sed", ["sed", "-i", "-e", "s/Debian/Gentoo/g", "foo"], [/* 39
vars */]) = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
directory)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
directory)
open("/lib/x86_64-linux-gnu/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
statfs("/selinux", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096,
f_blocks=5419717, f_bfree=920598, f_bavail=645285, f_files=1379040,
f_ffree=885151, f_fsid={-495840576, 2082046975}, f_namelen=255,
f_frsize=4096}) = 0
open("/proc/filesystems", O_RDONLY)     = 3
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
open("//lib/charset.alias", O_RDONLY)   = -1 ENOENT (No such file or
directory)
open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
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

-A


> -gmt
>
>

Reply via email to