Skip to Content.
Sympa Menu

sm-commit - Re: [SM-Commit] GIT changes to master grimoire by Vlad Glagolev (e541968349f5b85e4be5bfc9ba8e65bf4534d827)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <smgl AT lynxlynx.info>
  • To: sm-commit AT lists.ibiblio.org, wich AT stack.nl
  • Subject: Re: [SM-Commit] GIT changes to master grimoire by Vlad Glagolev (e541968349f5b85e4be5bfc9ba8e65bf4534d827)
  • Date: Mon, 10 Nov 2008 13:56:47 +0100

On Monday 10 of November 2008 13:47:46 Remko van der Vossen wrote:
> >> schrieb flux <flux AT sourcemage.org>:
> >> > Example: cat FILE | sed -e 's/something/ELSE/' > FILE
> >>
> >> I'm quite sure that this would empty FILE before opening it for cat ...
> >
> > Now I'm getting paranoid. I didn't think this would work yesterday
> > either, but I actually ran this on my machine, and it worked. However,
> > trying it again today shows that it doesn't work, and that FILE is now
> > empty. I checked my bash history, and I didn't see anything different in
> > what I was doing. I have no idea how I got this to work yesterday, and
> > I'm sure I must have done something else, but whatever I did must not be
> > in my bash history :(
>
> Isn't it just a matter of which process gets to the critical point (i.e.
> reading the file for the cat and opencreat for the sed) first, depending
> on scheduling?
Yes, it isn't completely deterministic.

Running this I see only zeros printed:
while true; do ls -R . > FILE; cat FILE | sed -e 's/man1/ELSE/' > FILE; wc -l
FILE; rm FILE; done
0 FILE
0 FILE

But if I omit that, almost full file copies get through:
while true; do ls -R . > FILE; cat FILE | sed -e 's/man1/ELSE/' > FILE; wc -l
FILE; rm FILE; done | grep -v "0 FILE"
4482 FILE
4482 FILE

The full line count is 4660. When using more or less instead of cat, the
output is much more random. Extending the pipe gives me an empty file pretty
consistently.

LP
--
We cannot command nature except by obeying her. --Sir Francis Bacon
Have a sourcerous day! www.sourcemage.org

Attachment: signature.asc
Description: This is a digitally signed message part.




Archive powered by MHonArc 2.6.24.

Top of Page