[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cfengine-develop] Kind of a bug, maybe
From: |
Luke A. Kanies |
Subject: |
[Cfengine-develop] Kind of a bug, maybe |
Date: |
Fri, 20 Aug 2004 23:14:44 -0500 (CDT) |
Hi Mark,
I kind of found a bug in cfengine today. Well, I know I found one and I
kind of found another.
First, the known bug:
Cfengine should probably never move a file that already ends in '.cfsaved'
to <filename>.cfsaved. I've had multiple occasions where I've had files
named something like file.cfsaved.cfsaved.cfsaved, and it can be quite
disastrous sometimes. If you don't know of a simple way to fix this, I
can probably provide a patch.
Now to the kind-of bug:
Run the following shell script:
#!/bin/sh
bd=/tmp/cftest
mkdir $bd
mkdir -p $bd/orig/a
touch $bd/orig/a/b
mkdir $bd/new
ln -s $bd/orig/a $bd/new
--------------------------------
You now have a simple directory structure in /tmp. Now run the following
simple cfengine script (I highly recommend -v):
control:
actionsequence = ( links )
bd = ( /tmp/cftest )
links:
${bd}/new +>! ${bd}/orig r=inf
-----------------------------------
You now have a very destroyed directory. This error is the first clue:
cfengine:: Moving /tmp/cftest/new/a/b to /tmp/cftest/new/a/b.cfsaved
cfengine:: INFO: /tmp/cftest/new/a is a symbolic link, not a true
directory!
cfengine:: Linking files /tmp/cftest/new/a/b -> /tmp/cftest/orig/a/b
From there, you get a lot of badness. The whole problem is because of the
link done in the shell script, cfengine is actually linking from a file
directly back to itself, just with a different filename, because
/tmp/cftest/orig/a/b is the exact same file as /tmp/cftest/new/a/b.
I call this "kind of a bug" because I don't know the best solution. My
initial reaction is that cfengine should get rid of the soft link, create
a directory, and go on its merry way. That quite possibly is a very bad
thing, though.
It seems like the best response is just make sure that a file is never
linked to itself; if the file you're linking to exists then stat it to
make sure it is not the same file.
And, of course, this is a very handy demonstration of the chaos that
results from saving files that have already been saved via cfengine:
cfengine:: Can't rename
/tmp/cftest/new/a/b_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved
to
/tmp/cftest/new/a/b_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved_1093061372_Fri_Aug_20_23_09_32_2004_.cfsaved
cfengine:: rename: File name too long
I don't really know what the resolution is, but someone needs to be done;
this quite destroyed my (fortunately small) network, and if I had shipped
this file off to my clients before this happened to me... I shudder quite
a bit.
What do you think?
Luke
--
Nature and nature's laws lay hid in night,
God said, "Let Newton be," and all was light.
It did not last; the devil howling "Ho!
Let Einstein be!" restored the status quo.
---------------------------------------------------------------------
Luke Kanies | http://abstractive.org | http://reductiveconsulting.com
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cfengine-develop] Kind of a bug, maybe,
Luke A. Kanies <=