Boost logo

Boost :

Subject: Re: [boost] [Boost-commit] svn:boost r62919 - in trunk: boost/filesystem/v2 boost/filesystem/v3 libs/filesystem/v2/test libs/filesystem/v3/test
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2010-06-14 22:24:36


On 14 June 2010 15:10, Beman Dawes <bdawes_at_[hidden]> wrote:
>
> Furthermore, I see the need to output and then roundtrip strings back
> as input, regardless of embedded whitespace, to be a common need
>

I think the best kind of << or >> would be ones that prevent "shell
script injection attacks". Is there some usable lowest common
denominator between the escapes used by various shells?
Platform-specific output and a permissive parser might work too.

Remembering the Requirement to "Be able to write portable script-style
filesystem operations in modern C++"
<http://www.boost.org/doc/libs/1_43_0/libs/filesystem/doc/design.htm#Requirements>,
there should be some way to stringstream together something that can
be safely passed to std::system.

Imagine something like this:

    path p = "-f x";
    stringstream ss;
    ss << delete_program << " " << p;
    system(ss.str().c_str());

It'd be great if it became system("rm './-f x'"); or similar, avoiding
all kinds of pitfalls in the process.


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