| Filesystem Bug Reporting

Home Tutorial Reference FAQ Releases Portability V3 Intro V3 Design Deprecated Bug Reports

Boost.Filesystem issues such as bug reports or feature requests should be reported via a Boost Trac ticket.

GitHub pull requests are encouraged, too, although anything beyond really trivial fixes needs a trac ticket.

### Bug reports

A timely response to your bug report is much more likely if the problem can be immediately reproduced without guesswork and regression tests can be easily created.

You need to provide the following:

1. A simple test program that:
   - Illustrates the problem, and
   - Automatically yields an unambiguous pass or fail result - returning zero for pass and non-zero for fail is preferred, and
   - Can be used as the basis for adding tests to Boost.Filesystem's regression test suite.
2. The compiler, standard library, platform, and Boost version you used to build and run your test program.
3. A description of how to build and run the test program.
4. A copy of the output from the test program, if any.
5. An email address for follow-up questions.

See Rationale to find out why the above is needed.

For a mostly automatic framework to provide the above, read on!

### Bug reporting framework

The directory `<boost-root>/libs/filesystem/bug>` provides a bug test program (`bug.cpp`) and a build file (`Jamfile.v2`). Here is what you need to do:

1. Add one or more test cases to `bug.cpp` using any text or program editor.
2. Build and test.
3. Attach copies of the Test output and test program to the Trac ticket.

That's it! When you complete those steps, you will be done!

The test output supplies all of the basic information about the compiler, std library, platform, Boost version, and command line, and the test cases you have added should make it easy for the library maintainer to reproduce the problem.

### Using the framework

#### `bug.cpp`

Here is `bug.cpp` as supplied. To report a real bug, use `BOOST_TEST` and `BOOST_TEST_EQ` macros to build your own test cases. You can delete the three tests already in `bug.cpp`:

>     #include <boost/detail/lightweight_test_report.hpp>
>     #include <boost/filesystem.hpp>

>     namespace fs = boost::filesystem;

>     int test_main(int, char*[])     // note name
>     {
>       BOOST_TEST(2 + 2 == 5);       // one convertible-to-bool argument; this one fails!
>       BOOST_TEST_EQ(4 + 4, 9);      // two EqualityComparible arguments; this one fails!
>       BOOST_TEST(fs::exists("."));  // should pass, so nothing should be reported

>       return ::boost::report_errors();   // required
>     }

#### Build and test

POSIX-like systems:

>     cd <boost-root>/libs/filesystem/bug
>     ../../../b2 -a
>     bin/bug

Windows:

>     cd <boost-root>\libs\filesystem\bug
>     ..\..\..\b2 -a
>     bin\bug

#### Test output

Running the test on Windows produced this test output:

>     Microsoft Visual C++ version 14.0
>     Dinkumware standard library version 610
>     Win32
>     Boost version 1.58.0
>     Command line: bin\bug
>     bug.cpp(10): test '2 + 2 == 5' failed in function
>       'int __cdecl test_main(int,char *[])'
>     bug.cpp(11): test '4 + 4 == 9' failed in function
>       'int __cdecl test_main(int,char *[])': '8' != '9'
>     2 errors detected.

The test framework runs `test_main()` from a `try` block with a `catch` block that reports exceptions via `std::exception what()`. So the output will differ if an exception is thrown.

## Background information

You should now have enough information to file an easy-to-reproduce bug report. So you can skip reading the rest of this page unless you need to do something a bit out of the ordinary.

### `b2` command line

`b2` (formerly `bjam`) usage: `b2 [options] [properties] [target]`

Boost.Build b2 has many options, properties, and targets, but you will not need most of them for bug reporting. Here are a few you might find helpful:

Options

> `-a` Rebuild everything rather than just out-of-date targets. Used in the example build above to ensure libraries are built with the same setup as the test program.

Properties

> `address-model=n n` is 32 or 64. Explicitly request either 32-bit or 64-bit code generation. This typically requires that your compiler is appropriately configured.

> `variant=`string string is `debug` or `release`.

> `toolset=`string The C++ compiler to use. For example, `gcc-4.9`, `clang-3.3`, `or msvc-14.0`.

> `include=`string Additional include paths for C and C++ compilers.

> `cxxflags=`string Custom options to pass to the C++ compiler.

> `define=`string Additional macro definitions for C and C++ compilers. string should be either `SYMBOL` or `SYMBOL=VALUE`

### Rationale

Here is the request list again, with rationale added:

1. A simple test program that:

   - Illustrates the problem [Code communicates more clearly than prose. If it looks like it will it will take some time to figure out exactly what the problem is, or worse yet, might result in a wild-goose chase, the bug report gets set aside to be worked on later and then is often forgotten.] and

   - Automatically yields an unambiguous pass or fail result - returning zero for pass and non-zero for fail is preferred [Prevents miscommunications and allows use in automatic regression tests.], and
   - Can be used as the basis for adding tests to Boost.Filesystem's regression test suite [With good test cases fixes come easier and regressions become less likely].
2. The compiler, standard library, platform, and Boost version you used to build and run your test program. [The implementation includes much platform dependent code, and also depends on the other factors mentioned. Know these things upfront brings the bug report into focus without having to ask for more information. ]
3. A description of how to build and run the test program. [If b2 (formerly known as bjam) is used as the build engine, this is not a concern, but otherwise much more information is needed.]
4. A copy of the output from the test program, if any. [Avoids misinterpreting results.]
5. An email address for follow-up questions. [Trac comments are the primary means of response, but it is disheartening when a trac question is not answered and there is no email address attached for followup.]

Revised 28 January, 2015

© Copyright Beman Dawes, 2014

Distributed under the Boost Software License, Version 1.0. See www.boost.org/LICENSE_1_0.txt