linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: specify absolute paths for cscope
@ 2009-11-26 12:34 Daniel Vetter
  2009-11-30 17:13 ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2009-11-26 12:34 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Daniel Vetter

Some tools (like my favourite editor, vim) can't handle relative
paths from cscope as soon as cscope.out is no longer in $PWD. Use
absolute paths when generating cscope.files, which seems to be
the recommended way to generate cscope.out, anyway (at least according
to cscope.sf.net).

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 scripts/tags.sh |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index d52f7a0..49bffed 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -89,7 +89,9 @@ all_defconfigs()
 
 docscope()
 {
-	(echo \-k; echo \-q; all_sources) > cscope.files
+	# use absolute paths - vim likes it that way
+	tree=$PWD/$tree
+	(cd /; echo \-k; echo \-q; all_sources) > cscope.files
 	cscope -b -f cscope.out
 }
 
-- 
1.6.5.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: specify absolute paths for cscope
  2009-11-26 12:34 [PATCH] kbuild: specify absolute paths for cscope Daniel Vetter
@ 2009-11-30 17:13 ` Michal Marek
  2009-11-30 18:11   ` Sam Ravnborg
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2009-11-30 17:13 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: linux-kbuild, lkml

On 26.11.2009 13:34, Daniel Vetter wrote:
> Some tools (like my favourite editor, vim) can't handle relative
> paths from cscope as soon as cscope.out is no longer in $PWD. Use
> absolute paths when generating cscope.files, which seems to be
> the recommended way to generate cscope.out, anyway (at least according
> to cscope.sf.net).

But it will fail if you rename the source directory. I'm not sure what
is worse, I myself don't use cscope much. Fixing vim would be the ideal
solution of course (it already handles ../tags fine).

Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: specify absolute paths for cscope
  2009-11-30 17:13 ` Michal Marek
@ 2009-11-30 18:11   ` Sam Ravnborg
  2009-12-01  9:42     ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2009-11-30 18:11 UTC (permalink / raw)
  To: Michal Marek; +Cc: Daniel Vetter, linux-kbuild, lkml

On Mon, Nov 30, 2009 at 06:13:47PM +0100, Michal Marek wrote:
> On 26.11.2009 13:34, Daniel Vetter wrote:
> > Some tools (like my favourite editor, vim) can't handle relative
> > paths from cscope as soon as cscope.out is no longer in $PWD. Use
> > absolute paths when generating cscope.files, which seems to be
> > the recommended way to generate cscope.out, anyway (at least according
> > to cscope.sf.net).
> 
> But it will fail if you rename the source directory. I'm not sure what
> is worse, I myself don't use cscope much. Fixing vim would be the ideal
> solution of course (it already handles ../tags fine).

For tags I recall we fall back to absolute path only for O=... builds.
This made the tags file considerably smaller for a non O=.. build
thus speeding up the search.

So unconditionally using absolute paths for cscope may have drawbacks.

	Sam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: specify absolute paths for cscope
  2009-11-30 18:11   ` Sam Ravnborg
@ 2009-12-01  9:42     ` Daniel Vetter
  2009-12-01 13:06       ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2009-12-01  9:42 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Michal Marek, Daniel Vetter, linux-kbuild, lkml

On Mon, Nov 30, 2009 at 07:11:09PM +0100, Sam Ravnborg wrote:
> On Mon, Nov 30, 2009 at 06:13:47PM +0100, Michal Marek wrote:
> > On 26.11.2009 13:34, Daniel Vetter wrote:
> > > Some tools (like my favourite editor, vim) can't handle relative
> > > paths from cscope as soon as cscope.out is no longer in $PWD. Use
> > > absolute paths when generating cscope.files, which seems to be
> > > the recommended way to generate cscope.out, anyway (at least according
> > > to cscope.sf.net).
> > 
> > But it will fail if you rename the source directory. I'm not sure what
> > is worse, I myself don't use cscope much. Fixing vim would be the ideal
> > solution of course (it already handles ../tags fine).
> 
> For tags I recall we fall back to absolute path only for O=... builds.
> This made the tags file considerably smaller for a non O=.. build
> thus speeding up the search.
> 
> So unconditionally using absolute paths for cscope may have drawbacks.

I've just tried to use cscope with a working directory not equal to the
directory where cscope.out resides:

$ cscope -d -f src/cscope.out

It can't handle relative paths. When I try to open a file (via a
reference) from within cscope, it calls up vim with the wrong path.  So I
think this is a fundamental cscope bug (and not a vim problem).  As I've
already said, every tutorial on the web I could find uses absolute paths,
too, so the problem seems to be common, as is the work-around.  Therefore
please apply this patch (perhaps changing my comment to "cscope is broken
with relative paths, work around it via absolute paths").

Thanks, Daniel
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: specify absolute paths for cscope
  2009-12-01  9:42     ` Daniel Vetter
@ 2009-12-01 13:06       ` Michal Marek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2009-12-01 13:06 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Sam Ravnborg, linux-kbuild, lkml

On 1.12.2009 10:42, Daniel Vetter wrote:
> I've just tried to use cscope with a working directory not equal to the
> directory where cscope.out resides:
> 
> $ cscope -d -f src/cscope.out
> 
> It can't handle relative paths. When I try to open a file (via a
> reference) from within cscope, it calls up vim with the wrong path.  So I
> think this is a fundamental cscope bug (and not a vim problem).  As I've
> already said, every tutorial on the web I could find uses absolute paths,
> too, so the problem seems to be common, as is the work-around.  Therefore
> please apply this patch (perhaps changing my comment to "cscope is broken
> with relative paths, work around it via absolute paths").

OK, you convinced me. I applied it to for-next, with a minor edit to fix
O= builds (the tree variable is an absolute path already):
http://repo.or.cz/w/linux-kbuild.git/commitdiff/037aaae02ecf3925b843316868743c755d73fb22
I hope the next guy won't come and complain the he moved linux-2.6.xy to
linux-2.6.xy.orig and cscope stopped working :).


On 30.11.2009 19:11, Sam Ravnborg wrote:
> For tags I recall we fall back to absolute path only for O=... builds.
> This made the tags file considerably smaller for a non O=.. build
> thus speeding up the search.
> 
> So unconditionally using absolute paths for cscope may have drawbacks.

I tried it and this part seems OK. Generating the database took more or
less the same time, cscope.out grew by less than 1% and opening cscope
and running a query for 'printk' slowed down by about 8%, I think that's
bearable.

Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-01 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-26 12:34 [PATCH] kbuild: specify absolute paths for cscope Daniel Vetter
2009-11-30 17:13 ` Michal Marek
2009-11-30 18:11   ` Sam Ravnborg
2009-12-01  9:42     ` Daniel Vetter
2009-12-01 13:06       ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).