Re: [PATCH 1/4] kernel-shark: Configuration information in ${HOME}/.cache/kernelshark

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2019-04-09 at 15:23 +0300, Yordan Karadzhov (VMware) wrote:
> 
> On 8.04.19 г. 18:13 ч., Steven Rostedt wrote:
> > On Mon, 8 Apr 2019 18:01:03 +0300
> > Slavomir Kaslev <kaslevs@xxxxxxxxxx> wrote:
> > 
> > > > +++ b/Makefile
> > > > @@ -254,7 +254,10 @@ all_cmd: $(CMD_TARGETS)
> > > >   CMAKE_COMMAND = /usr/bin/cmake
> > > >   
> > > >   $(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt
> > > > -	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND)
> > > > -D_INSTALL_PREFIX=$(prefix) ..
> > > > +
> > > > +	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) \
> > > > +		-D_KS_CACHE_DIR=$(HOME)/.cache/kernelshark \
> > >                                  ^
> > > Which $HOME would that be? The one for the user who built
> > > kernelshark and not the user who runs it.
> > > 
> > > 
> 
> As it is right now Cmake will get the value of the -D_KS_CACHE_DIR 
> argument and will tell the GUI to save cache files there. And yes,
> in 
> this case it will be in the $HOME of the user who built kernelshark.
> 
> I can make the GUI to check if _KS_CACHE_DIR is defined and if its
> value 
> (path) belongs to the user who runs the GUI. If this is not the
> case, 
> The GUI will use the default location (~/cache/kernelshark).

This will work but it doesn't solve the actual problem. The actual
problem is that KS_CACHE_DIR must be expanded run time, not compile
time. Otherwise, there is no sensible value one can set to KS_CACHE_DIR
build time that works for all users (unless it's shared, say
/var/tmp/kernelshark).

One alternative is to do this in the above Makefile:

	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) \
		-D_KS_CACHE_DIR='$HOME/.cache/kernelshark'

to force shell not to expand variables and then use wordexp(3) or
similar to do the expansion run time.

Another alternative is to change the semantics of KS_CACHE_DIR so that
if it's relative path (.cache/kernelshark) it's always rooted at the
user's $HOME. OTOH that behavior might not be what some users expect.

Cheers,

-- Slavi




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux