kdebase/kate/app [POSSIBLY UNSAFE]

Oswald Buddenhagen ossi at kde.org
Tue May 25 20:24:50 UTC 2004


On Tue, May 25, 2004 at 04:29:08PM +0200, Wilbert Berendsen wrote:
> > > +  childproc->setUseShell( true );
> >
> > any particular reason for this?
> 
> to find `find' and `grep', but I could use KStandarddirs.
> 
finding grep is obvoiusly find's task. and KProcess cares for find
itself; it uses execvp.

> > note that the chosen "find -exec grep" approach is very slow, as it
> > spawns a grep process for every file. much faster would be "find
> > -print0 | xargs -r0 grep" - unfortunately it is gnu-only due to the
> > nulls. but that should not bother you, as this code is generally
> > gnu-only (at least find -maxdepth and grep -H are non-portable) ...
> 
> Couldn't i use grep -r with --include ?
> 
that's even worse portability-wise. :)

> I understand that i should try either to make it fully portable (in
> which case I shouldn't use find -maxdepth or grep -H or just assume
> GNU.  What would be best?
> 
of course it should be portable. grep -H is no problem because of the
/dev/null trick, just remove it. find is a bigger problem. i think it
would be best to get rid of it alltogether; implementing a recursive
directory traverser is quite simple (either with QDir or posix-only with
opendir/readdir/glob), and an xargs-replacement is no problem, either
(note the maximal command line length; one of our configures checks it).

btw, these comments apply equally to
kdevelop/parts/grepview/grepviewwidget.cpp ...

greetings

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.




More information about the KDevelop-devel mailing list