Ethereal-users: Re: [Ethereal-users] Re: Saving an Ethereal Filter file

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Thu, 15 Mar 2001 02:00:32 -0800
On Wed, Mar 14, 2001 at 02:52:57PM -0600, Steve Winn wrote:
> I'm guessing that something might be slightly different about the
> format/location of the filters/preferences files??

No, something is annoying about the Win32 API and the ANSI C standard,
so the 0.8.16 code in Ethereal, which saves the filter files by writing
to a new file and then renaming the new file on top of the old file (so
that you don't lose your filter list if the attempt to write the filter
file fails, e.g. because you run out of space on the file system or go
over your disk quota, or because Ethereal or the machine crashes in the
middle of writing the file out), wasn't working on Windows if the old
filter file exists.

I checked in a change to, on Windows, remove the old filter file first.

(This means that, unlike on UNIX systems writing to file systems that
correctly implement an atomic-rename operation, there's a tiny window in
which the filter file can be lost if there's a crash or other problem.

Microsoft appear to use the "write to a new file and rename it" trick in
Word, at least, probably for the same reason - to avoid losing your
entire file if the write fails - so one would expect them to have
thought of the notion of an atomic rename, especially given that the
folks at Berkeley put it in UNIX back in 1982, but noooo....)

> I got it to work by:
>         1    rename the .ethereal folder to something else
>         2    start ethereal, create and save a filter (ie let ethereal make
> the files again)
>         3    stop ethereal, cut and paste filters from old files into the
> new files now created by ethereal

Removing ".ethereal/dfilters" or ".ethereal/cfilters" before saving the
filter list in question should be sufficient.

> I was also getting strange "/.ethereal/preferences Line 66: No such
> preference"

That's probably due to some DIAMETER preferences going away
(DIAMETER-over-UDP is no longer supported, so there's no longer a
preference setting for the UDP port for DIAMETER).  The preferences
files are currently saved by the "truncate the file and rewrite it"
mechanism, so that code wasn't caught by the rename problem.)

> and program crashes.

That could be the result of almost *anything*.