[rvl-list] Re: Important data corruption bug

2005-09-17 Thread Dag Wieers
On Sat, 17 Sep 2005, [EMAIL PROTECTED] wrote:

> Quoting Dag Wieers <[EMAIL PROTECTED]>:
> > Revelation cannot handle a disk-full situation. I just lost all my 
> > passwords (file was 0 bytes in size).
> 
> I will have a closer look at this once I'm back home though, would be nice to
> avoid these situations.

In my opinion this should be tackled by Gnome/Unix, as almost every 
program has this problem. (at least mozilla/firefox, galeon, gaim, 
rrdtool) Each allows to corrupt or nullify config and data files.

What's strange is that revelation freezed (GUI was not updating anymore) 
so I wasn't even able to write it to another location.

And Gnome should probably also have a general warning pop-up when the disk 
is getting full, so people can fix it right away.

Kind regards,
--   dag wieers,  [EMAIL PROTECTED],  http://dag.wieers.com/   --
[all I want is a warm bed and a kind word and unlimited power]



[rvl-list] Re: Important data corruption bug

2005-09-16 Thread erikg
Quoting Dag Wieers <[EMAIL PROTECTED]>:
> On Fri, 16 Sep 2005, Dag Wieers wrote:
> > Revelation cannot handle a disk-full situation. I just lost all my 
> > passwords (file was 0 bytes in size).
> 
> I immediately remounted my partition read-only and then started to look 
> for the characteristics of a revelation file.
> 
>   rvl\0\1\0\0\4
> 
> But whatever I find, I don't know where the file ends. If I provide the 
> file to revelation, it asks the password and then gives an error:
> 
>   The file '/dev/shm/test.rvl' contains invalid data.
> 
> Are there any procedures to restore such a file (or at least know what the 
> length should be) ?

Well, it's possible:

First of all, you need to make sure that the file size minus 28 is a multiple of
8 bytes in length. If it is not, you have to remove enough bytes so that it is.

Let us say your file is 399 bytes long. 399 - 28 is 371 bytes. 371 modulo 8 is
3, which means that the file is 3 bytes too long. Remove those 3 bytes from the
end of the file.

Next, you must decrypt the data. This can be done by the script in this email:

http://oss.codepoet.no/pipermail/revelation-list/2004-August/19.html

You may also want to apply this patch:

http://oss.codepoet.no/pipermail/revelation-list/2005-September/000140.html

Running this script will give you the plaintext XML. You can then open the
plaintext XML in a text editor and remove any junk data which may be following
it.

Also, *if* you don't have the entire XML data it will not be well-formed and no
XML parser in the world would accept it. So you need to fix the XML by adding
the necessary closing tags to make it well-formed.

Once this is done, you can use the Import File function in Revelation and select
file format Revelation XML. You should then hopefully be able to import your
data.


> Also what command would be best to find a file that starts with 
> "rvl\0\1\0\0\4". I am know using:
> 
>   grep -az "rvl$" -A 1 /dev/hda5
> 
> Which is not optimal.

Not really sure, since I can't test it, but something like this:

grep -az "rvl\0.\0\0..\0\0\0" -A 1 /dev/hda5

You may have to tell grep to use extended regular expressions, but I don't
remember the switch. I think it may be -r or something.

Good luck, hope it works out.



[rvl-list] Re: Important data corruption bug

2005-09-16 Thread erikg
Quoting Dag Wieers <[EMAIL PROTECTED]>:
> Revelation cannot handle a disk-full situation. I just lost all my 
> passwords (file was 0 bytes in size).

Hm, right. It is not trivial to detect disk-full situations, because when you
write data to a file what happens is basically:

1. Open file for writing, and truncate size to 0 bytes
2. Write data to file

In a disk full situation, step 2 will fail, but the file will already be
truncated by step 1. The best would be if the operating system provided an
atomic function for writing data to a file, but I'm not sure if this exists in
POSIX.

I could always write to a temp-file and move it over the original file, but in
that case this will break any hard-links to the file because it has a different
inode. One could also check for free space on disk before saving, but not all
media correctly report free diskspace, and this is impossible to do over network
protocols (webdav for example).

I will have a closer look at this once I'm back home though, would be nice to
avoid these situations.



[rvl-list] Re: Important data corruption bug

2005-09-16 Thread Dag Wieers
On Fri, 16 Sep 2005, Dag Wieers wrote:

> Revelation cannot handle a disk-full situation. I just lost all my 
> passwords (file was 0 bytes in size).

I immediately remounted my partition read-only and then started to look 
for the characteristics of a revelation file.

rvl\0\1\0\0\4

But whatever I find, I don't know where the file ends. If I provide the 
file to revelation, it asks the password and then gives an error:

The file '/dev/shm/test.rvl' contains invalid data.

Are there any procedures to restore such a file (or at least know what the 
length should be) ?

Also what command would be best to find a file that starts with 
"rvl\0\1\0\0\4". I am know using:

grep -az "rvl$" -A 1 /dev/hda5

Which is not optimal.

Kind regards,
--   dag wieers,  [EMAIL PROTECTED],  http://dag.wieers.com/   --
[all I want is a warm bed and a kind word and unlimited power]