Ethereal-users: Re: [Ethereal-users] ethereal + KDE 2.0 problem

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: Tue, 16 Jan 2001 01:39:20 -0800
On Tue, Jan 16, 2001 at 09:27:45AM +0100, Claus Wagner wrote:
> I put the fix in.

It's not a fix, it's just debugging code.

> Result: when running from an icon, argv[0] equals
> "ethereal", but when launching it from the command line, it says
> "ethereal-capture".

If you do an "update list of packets in real time" capture, it forks and
execs a second Ethereal process to do the capturing; unfortunately, this
means the code I sent will write the output of the child process atop
the output of the parent process, if the child process runs.

The child process runs Ethereal using the pathname supplied as argv[0];
if that pathname can't be used from the directory from which Ethereal
was run, the attempt to run the child process will fail.

When running from an icon, "argv[0]" is just "ethereal"; unless the
Ethereal binary is in the current directory for the KDE process that
forks and execs processes when clicking on icons, the attempt by the
main Ethereal process to run the child Ethereal process will fail, so
only

	argv[0] = ethereal

will get written to the file.

When you ran it from the shell, somehow argv[0] was passed as a path
that does work in an "execvp()" call, so the child process did run, and
preceded to overwrite "/tmp/ethereal_path" with the argv[0] it got
passed, which is "ethereal-capture", that being the way that the parent
process tells the child process that it should run as a capture child
rather than as regular Ethereal.

> Any hints what's the difference here between KDW v 1.2 and 2.0?

Well, when I run it from an icon in KDE 1.2, it puts

	argv[0] = "/usr/home/guy/src/cmd/ethereal.compressed-sniffer/ethereal"

into the file, but that's because the "Execute" property of the icon has
that as the path.

I haven't installed KDE 2, so I don't know how one sets the path for an
icon for an executable, but is it possible to set the path to be a full
path?  If so, try that; if you've already done that, let me know.

If it puts

	argv[0] = "ethereal"

into the file even if you specify a full path, then the difference
between KDE 1 and KDE 2 is that it does so, which causes problems given
the way Ethereal runs the child process.