Boost logo

Boost :

From: Tim Nowaczyk (zimage_at_[hidden])
Date: 2003-09-21 21:05:21


Is there a limitation on leading dots on directory names in
boost::filesystem::path? The following code aborts on my debian machine
with libboost-dev 1.30.0-4

---- Code ----
#include <iostream>
#include <boost/filesystem/path.hpp>

int main ()
{
  boost::filesystem::path p ("/tmp/.temp/1.txt");
  std::cout << p.string () << std::endl;
  std::cout << p.leaf () << std::endl;
  std::cout << p.branch_path ().string () << std::endl;

  boost::filesystem::path q ("/tmp/..temp/1.txt");
  std::cout << q.string () << std::endl;
  std::cout << q.leaf () << std::endl;
  std::cout << q.branch_path ().string () << std::endl;
}

---- Output ----
/tmp/.temp/1.txt
1.txt
/tmp/.temp
Aborted

---- GDB backtrace ----
(gdb) run
Starting program: /home/tim/public/src/personal/tjukebox/test/foo
/tmp/.temp/1.txt
1.txt
/tmp/.temp

Program received signal SIGABRT, Aborted.
0x401306c1 in kill () from /lib/libc.so.6
(gdb) bt
#0 0x401306c1 in kill () from /lib/libc.so.6
#1 0x40130465 in raise () from /lib/libc.so.6
#2 0x401319db in abort () from /lib/libc.so.6
#3 0x400b61d7 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.5
#4 0x400b6214 in std::terminate() () from /usr/lib/libstdc++.so.5
#5 0x400b6386 in __cxa_throw () from /usr/lib/libstdc++.so.5
#6 0x0804b018 in void
boost::throw_exception<boost::filesystem::filesystem_error>(boost::filesystem::filesystem_error
const&) ()
#7 0x0804a013 in boost::filesystem::path::m_path_append(std::string
const&, boost::filesystem::path::source_context) ()
#8 0x08049b86 in boost::filesystem::path::path(char const*) ()
#9 0x0804920c in main () at foo.cpp:11

-- 
----------Tim Nowaczyk----------zimage_at_upl.cs.wisc.edu------------------
| <>< Truth
|
| GPG fingerprint = 1612 3E41 D649 63ED 222D  EB27 E84D 4274 392C A50A

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