Boost logo

Boost :

Subject: Re: [boost] Boost.Filesystem: basename function is not compatible with POSIX; potential for path-related security issues
From: Beman Dawes (bdawes_at_[hidden])
Date: 2010-01-17 19:17:06


On Sat, Jan 16, 2010 at 8:45 PM, Steve M. Robbins <steve_at_[hidden]> wrote:

> Hi,
>
> I got the following report [1] for Boost.Filesystem from a Debian
> user. Before entering into trac, I thought I'd ask whether this
> deviation from POSIX is by design or is a bug.
>
>
> Thanks,
> -Steve
> P.S. The original report is based on Boost 1.40, but I
> verified the same behaviour on Boost 1.41.
>
>
> [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565504
>
> ----- Forwarded message from Roger Leigh <rleigh_at_[hidden]> -----
>
> Package: libboost-filesystem1.40.0
> Version: 1.40.0-5
> Severity: important
>
> The basename function is not compatible with the POSIX function by the
> same name...
>

Right. That's part of the reason why boost::filesystem::basename() is
deprecated.

Use path::filename() if you want the POSIX functionality. Use path::stem()
if you want the old boost::filesystem::basename() functionality. Use
path::extension() if you want the extension.

--Beman


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