[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: quanta [POSSIBLY UNSAFE]
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2002-12-08 15:00:39
[Download RAW message or body]

On Sun, Dec 08, 2002 at 11:46:14AM +0100, Waldo Bastian wrote:
> On Sunday 08 December 2002 11:35, Mantia Andras wrote:
> > On 2002. December 08., Sunday 12:11, Waldo Bastian wrote:
> > > On Sunday 08 December 2002 11:01, Andras Mantia wrote:
> > > >    QString args = arguments();
> > > > +  if (!args.isEmpty())
> > > > +     args = KProcess::quote(args);
> > >
> > > Are you sure that is correct? The name suggests that you can have
> > > multiple arguments (like what?) but if you quote them they will be
> > > interpreted as a single argument.
> > >
> > > Cheers,
> > > Waldo
> >
> > Yes, you are right, and it breaks when you specify multiple arguments, but
> > it does not always work even with one argument!
> > KProcess::quote("~/dir/foo") returns  '~/dir/foo', which is not good for
> > apps. I've tried it with kompare and cat.
> >
> > andris@stein:~/cvs-developement/head/quanta> cat '~/.kderc'
> > cat: ~/.kderc: No such file or directory
> >
> > Is this the desired behaviour of KProcess:quote()?
> 
> Yes, ~ is interpreted by the shell and expanded to your home dir, pretty much 
> like ${HOME}. Quoting it disables that.
> 
> If such arguments are provided by the user and constructs like ~/.kderc are 
> still supposed to work, then I would just leave it unquoted. 
> 
that cries for
QString [insert your preferred file handling class here]::
   expandFilename(const QString &name);
that function would expand ~/ and ~<user>/ constructs.
don't we already have this somewhere?

greetings

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic