9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: G. David Butler gdb@dbSystems.com
Subject: [9fans] create(2)/open(2) race for file creation
Date: Thu, 26 Feb 1998 16:16:29 -0600	[thread overview]
Message-ID: <19980226221629.GdyDhqqB3kBMsUti-INBRcuLVgS6SfxFjMEN1sKcr2s@z> (raw)

>I'll get back to you on this one.
I'm back...!

The "feature" is Plan9's shared environment space.  As is the case
with many of Plan9's features, they are powerful forces that can
be used for either good or evil.

This problem first showed up when I compiled a new cpu/terminal
kernel and the message "rc: can't open #e/fn#mkextract" would occur.
If you look at the rc scripts in /sys/src/9/port of mkdevlist,
mklinklist, mkmisclist and mkstreamlist you will see a function
called mkextract being defined and used.  During a build multiple
processes are trying to create their version of mkextract and writing
it to #e.  In this case the effect is benign since the scripts don't
invoke other scripts that read the function definition from #e and
attempt to use the possibly incorrect result.

I don't know why rc shares the environment since it doesn't use
the result.  For example (I'm adding a newline to the cat output
for readability):

term% a=1
term% echo $a
1
term% cat /env/a
1
term% rc
term% echo $a
1
term% cat /env/a
1
term% a=2
term% cat /env/a
2
term% exit
term% cat /env/a
2
term% echo $a
1
term%

Since rc doesn't re-initialize from the environment perhaps it
should copy it before it starts.  

Before I go adding Fork() to /sys/src/cmd/rc/plan9.c and changing
fork() to rfork(RFFDG|RFENVG|RFPROC), I think fork(2) should be
changed....  Here we go again.

I don't know of any programs that expect another concurrent process
to change the environment.  In Plan9 it can be used as an IPC, but
is it?

David Butler
gdb@dbSystems.com




             reply	other threads:[~1998-02-26 22:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-26 22:16 G.David [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-02-26 23:30 Russ
1998-02-26 23:01 G.David
1998-02-26 19:33 Eric
1998-02-26  0:24 G.David
1998-02-26  0:04 G.David
1998-02-25 23:42 G.David
1998-02-10 14:34 G.David
1998-02-10  8:59 forsyth
1998-02-09 21:21 G.David
1998-02-09 16:42 G.David
1998-02-09  8:05 Dan
1998-02-08 22:48 G.David
1998-02-08 22:18 Photon
1998-02-08 21:44 Rob
1998-02-08 21:10 G.David
1998-02-08 16:52 G.David
1998-02-08 16:16 G.David
1998-02-08 16:10 Dave
1998-02-08 15:48 G.David
1998-02-08  5:09 G.David
1998-02-08  2:01 Rob
1998-02-08  0:27 G.David

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19980226221629.GdyDhqqB3kBMsUti-INBRcuLVgS6SfxFjMEN1sKcr2s@z \
    --to=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).