Boost logo

Boost :

Subject: Re: [boost] [filesystem][lexical_cast] Lexical cast of filenames containing spaces
From: Dmitry Goncharov (dgoncharov_at_[hidden])
Date: 2010-08-16 07:12:10


> On 14 August 2010 15:27, Dmitry Goncharov <dgoncharov_at_[hidden]>
> wrote:
> >
> > This bug was fixed two month ago.
> > Have a look https://svn.boost.org/trac/boost/ticket/3863
>
> No, that's what caused this problem. What happens is that you when run a
> program that uses program_options, the shell unquotes the arguments, so
> an argument with a space in is not quoted. Then program options calls
> lexical_cast to convert the argument from a string to a filesystem path.
> Lexical cast uses filesystem's stream extractor to perform this conversion.
> But since there's a space, it only extracts part of the file name.

You are describing the behavior w/o the patch applied.
With the patch applied filesystem's extractor extracts the whole name until a new line.
I see that the patch is already in 1.44.
What version do you see the problem in ?

> Lexical cast
> notices that only some of the string has been extracted, realises that
> something has gone wrong and throws an exception.
>
> There's also a double unencoding issue if the file's name contains quotes.
>
> Daniel

Regards, Dmitry


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk