Wireshark-bugs: [Wireshark-bugs] [Bug 1237] New: GUI saves files in wrong directory

Date: Wed, 22 Nov 2006 18:21:10 +0000 (GMT)
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1237

           Summary: GUI saves files in wrong directory
           Product: Wireshark
           Version: 0.99.4
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Medium
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: vandry@xxxxxxxxx


Build Information:
ethereal 0.10.10
Compiled with GTK+ 2.6.4, with GLib 2.6.4, with libpcap 0.8.3, with libz 1.2.2,
with libpcre 4.5, without UCD-SNMP or Net-SNMP, with ADNS.

Running with libpcap version 0.8.3 on Linux 2.6.8-12-amd64-k8.

--
(Using ethereal package from Debian stable. Inspection of the source code for
the latest version shows that it behaves the same way, thus I have marked the
bug against version 0.99.4)

When opening or saving a file for the first time after wireshark is invoked, a
starting directory is set on the file selection dialog (see gtk/file_dlg.c line
122 in function file_selection_new). This occurs, for all intents and purposes,
UNCONDITIONALLY (the only case when it does not occur is the very first time
you use the software or if you wipe out the recent preferences file). The
starting directory should have been the current directory both due to the
principle of least astonishment and because that is basically what the
semantics of the current directory (cwd) are.

Steps to reproduce:

cd
rm .ethereal/recent      # start with blank state
mkdir test1
cd test1
ethereal

<Open or Save a file in this directory>
<Now quit ethereal>

cd ..
mkdir test2
cd test2
ethereal

<Select File/Open>

The file selection dialog will be sitting in ~/test1 but it should have been in
~/test2 because that is the directory it was launched from and the user has not
done anything to request the cwd to be changed and has not done anything that
would cause them to suspect that the cwd has changed spontaneously.

I used to think that this was just a (major) annoyance, but now it has caused
me data loss under reasonable circumstances (i.e. I did not make any mistakes
that could reasonably have been prevented), so now I am declaring it definately
a bug. FYI, I did something like this:

ethereal -r some_file

<I did some manipulations on the file>
<I selected File/Save As... to save the modified file>
<I entered a file name>
<I hit Save>
<I exited ethereal>

My totally reasonable expectation was that the new file would be saved in the
current working directory (which is the same directory in which "some_file" is
located, which is what I wanted). Instead it saved in some other directory in
which I had worked during a previous invocation. Indeed in squashed another
file by the same name in that other directory (that was my data loss).

I could have noticed that ethereal was about to make that mistake by observing
the directory in which the save dialog was sitting but I didn't look at it -- I
had absolutely no cause to suspect that it was other than I expected it do be.

Proposed fix: Do *not* save what amounts to a pseudo-cwd between invocations of
ethereal. Use the system cwd, that's what it's for.

-Phil


-- 
Configure bugmail: http://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.