Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] master 43a81b6: Add some information on

From: Peter Wu <peter@xxxxxxxxxxxxx>
Date: Fri, 01 Aug 2014 00:11:49 +0200
On Thursday 31 July 2014 17:11:59 Evan Huus wrote:
> This issue has been bugging me for a while, but I also haven't been able to
> come up with a satisfactory solution.

Oh my, that filesystem.c code is really ugly and relying on a lot of 
assumptions. Why does it need to distinguish build dirs from other dirs in the 
first place? From the comments, it seems to that for security/stability 
reasons, and another reason is to make plugins get loaded from the build dir.

What about solely relying on envvars? Then there can be a shell-script if you 
like the wrapper provided by libtool:

#!/bin/bash
# tools/run.sh - Wrapper for binaries
# since Mac does not have `readlink -f`, this is an alternative:
rundir=$(cd "$(dirname "$0")" && pwd)
#rundir=$(dirname "$(readlink -f "$0")")
export WIRESHARK_DATA_DIR=$rundir
export WIRESHARK_PLUGIN_DIR=$rundir
#etc.
exec "$rundir/${0##*/}" "$@"

With links:
tmpbin/tshark -> ../tools/run.sh
tmpbin/wireshark -> ../tools/run.sh
etc.

(no need to set LD_LIBRARY_PATH as RPATH is set by cmake for the in-tree 
binaries)

Kind regards,
Peter

> On Thu, Jul 31, 2014 at 4:56 PM, Wireshark code review <
> 
> code-review-do-not-reply@xxxxxxxxxxxxx> wrote:
> > URL:
> > https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=43a81b
> > 61395358d93a3f859e9058dfd7ecc39a7e Submitter: Guy Harris
> > (guy@xxxxxxxxxxxx)
> > Changed: branch: master
> > Repository: wireshark
> > 
> > Commits:
> > 
> > 43a81b6 by Guy Harris (guy@xxxxxxxxxxxx):
> >     Add some information on running from the build directory.
> >     
> >     Change-Id: I6c01141cd02af358152d007175ec0b51357e42b3
> >     Reviewed-on: https://code.wireshark.org/review/3298
> >     Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
> > 
> > Actions performed:
> >     from  9505d3a   Need to make Windows installer packages as well.
> >     adds  43a81b6   Add some information on running from the build
> > 
> > directory.
> > 
> > Summary of changes:
> >  README.cmake |   18 +++++++++++++++++-
> >  1 file changed, 17 insertions(+), 1 deletion(-)