assertion failure if ran in / directory
as said
cd /
cmake .
segfault
maybe we can check if we are in a root directory and exit gracefully instead of segfaulting/asserting?
cmOutputConverter.cxx:96 is the culprit
stacktrace:
cmake .
-- Configuring done
cmake: /build/cmake-yjJ9_1/cmake-3.7.2/Source/cmOutputConverter.cxx:96: std::__cxx11::string cmOutputConverter::ConvertToRelativePath(const string&, const string&) const: Assertion `local_path.empty() || local_path[local_path.size() - 1] != '/'' failed.
Aborted (core dumped)
root@Unimatrix01-Xenial:/# gdb cmake
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from cmake...(no debugging symbols found)...done.
(gdb) r .
Starting program: /usr/bin/cmake .
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
-- Configuring done
cmake: /build/cmake-yjJ9_1/cmake-3.7.2/Source/cmOutputConverter.cxx:96: std::__cxx11::string cmOutputConverter::ConvertToRelativePath(const string&, const string&) const: Assertion `local_path.empty() || local_path[local_path.size() - 1] != '/'' failed.
Program received signal SIGABRT, Aborted.
0x00007ffff672bfdf in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff672bfdf in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff672d40a in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff6724e47 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff6724ef2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x000055555568ac82 in cmOutputConverter::ConvertToRelativePath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const ()
#5 0x000055555589f2ec in cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath() ()
#6 0x000055555586dbb7 in cmGlobalGenerator::Compute() ()
#7 0x00005555556dd579 in cmake::Generate() ()
#8 0x00005555556e1d6e in cmake::Run(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) ()
#9 0x0000555555631018 in do_cmake(int, char const* const*) ()
#10 0x0000555555629420 in main ()