Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use std::filesystem rather than Boost #238

Merged
merged 22 commits into from
Feb 4, 2022
Merged

Conversation

mjcarroll
Copy link
Contributor

@mjcarroll mjcarroll commented Aug 10, 2021

🎉 Remove FilesystemBoost.cc in favor of std::filesystem

Summary

Remove the vendored FilesystemBoost.cc file in favor of using std::filesystem.

Test it

Functionality should remain the same across the stack, and all local unit/integration tests should pass on all platforms.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

@github-actions github-actions bot added 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress labels Aug 10, 2021
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some minor comments and I noticed that it's still a draft.

Can you also test ign-fuel-tools ? just to check that we are not breaking things on Windows

include/ignition/common/TempDirectory.hh Outdated Show resolved Hide resolved
include/ignition/common/TempDirectory.hh Outdated Show resolved Hide resolved
src/DirIter.cc Show resolved Hide resolved
@mjcarroll mjcarroll changed the base branch from ign-common4 to mjcarroll/temp_directory August 31, 2021 18:27
@mjcarroll mjcarroll changed the title Filesystem updates Update to use std::filesystem rather than Boost Aug 31, 2021
@mjcarroll mjcarroll force-pushed the remove_boost branch 2 times, most recently from e666988 to ec7048b Compare August 31, 2021 18:30
@mjcarroll mjcarroll marked this pull request as ready for review August 31, 2021 18:30
@mjcarroll mjcarroll force-pushed the remove_boost branch 2 times, most recently from be50dc4 to 93b2650 Compare September 2, 2021 20:39
@mjcarroll
Copy link
Contributor Author

ignition_common-ci-pr_any-homebrew-amd64 is expected to fail because std::filesystem isn't supported on 10.14

@codecov
Copy link

codecov bot commented Sep 2, 2021

Codecov Report

Merging #238 (e404a82) into main (9b790e6) will increase coverage by 0.10%.
The diff coverage is 95.94%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #238      +/-   ##
==========================================
+ Coverage   76.43%   76.53%   +0.10%     
==========================================
  Files          75       75              
  Lines       10463    10327     -136     
==========================================
- Hits         7997     7904      -93     
+ Misses       2466     2423      -43     
Impacted Files Coverage Δ
include/ignition/common/Filesystem.hh 100.00% <ø> (ø)
src/Util.cc 84.23% <66.66%> (+0.23%) ⬆️
src/Filesystem.cc 96.09% <97.29%> (+22.20%) ⬆️
src/DirIter.cc 100.00% <100.00%> (ø)
src/SystemPaths.cc 85.96% <100.00%> (-0.13%) ⬇️
src/TempDirectory.cc 76.56% <100.00%> (-1.70%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b790e6...e404a82. Read the comment docs.

@chapulina chapulina added the beta Targeting beta release of upcoming collection label Sep 8, 2021
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflicts

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mac and Windows are failing

@mjcarroll
Copy link
Contributor Author

Mac and Windows are failing

Windows is failing because the ign-utils dependency introduced in #244.

It is expected that the Jenkins macOS build will fail, as it is using 10.14. The new GitHub actions-based macOS build is the one we should be referring to from this PR forward.

@mjcarroll
Copy link
Contributor Author

@osrf-jenkins retest this please

@mjcarroll mjcarroll requested a review from ahcorde September 13, 2021 19:36
@chapulina
Copy link
Contributor

Homebrew is not happy yet:

/Users/jenkins/workspace/ignition_common-ci-pr_any-homebrew-amd64/ign-common/src/DirIter.cc:31:15: error: 'directory_iterator' is unavailable: introduced in macOS 10.15
  public: fs::directory_iterator it;

Base automatically changed from mjcarroll/temp_directory to ign-common4 September 13, 2021 22:40
@mjcarroll
Copy link
Contributor Author

Homebrew is not happy yet:

Homebrew is expected to fail starting with this PR. std::filesystem is not supported on macOS 10.14. This is why I added the second actions-based CI against macOS 10.15

@chapulina
Copy link
Contributor

chapulina commented Sep 15, 2021

Homebrew is expected to fail starting with this PR.

So should we disable that job, or update it to use 10.15?

@scpeters
Copy link
Member

down to three really suspicious failures here:

Suspicious indeed. They all seem to segfault even before the test starts, so maybe it's something within GTest? Could the CXX_FILESYSTEM_LIBRARIES have affected it? I can't tell what these tests have in common that's specific to them. They all use TEST and don't have a main, but other tests do too and they're passing.

weird that the tests only fail in jenkins, not in Github actions

those failures occurred on the r2d2 machine, which I have taken offline for testing. I see the following when I try to load one of the failing tests in gdb on r2d2:

Reading symbols from bin/UNIT_Pbr_TEST...
(gdb) r
Starting program: /var/lib/jenkins/workspace/ignition_common-ci-pr_any-ubuntu_auto-amd64/build/bin/UNIT_Pbr_TEST 
warning: Error disabling address space randomization: Operation not permitted
warning: Could not trace the inferior process.
warning: ptrace: Operation not permitted
During startup program exited with code 127.

@scpeters
Copy link
Member

I downloaded the Dockerfile and build.sh script from the jenkins job and with a few modifications was able to get it running on my local machine. I collected the following backtrace from UNIT_Pbr_TEST:

Reading symbols from bin/UNIT_Pbr_TEST...
(gdb) r
Starting program: /home/jenkins/workspace/ignition_common-ci-pr_any-ubuntu_auto-amd64/build/bin/UNIT_Pbr_TEST 
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
std::filesystem::__cxx11::path::~path (this=0x0, __in_chrg=<optimized out>)
   at /usr/include/c++/8/bits/fs_path.h:209
209      ~path() = default;
(gdb) thread apply all bt

Thread 1 (Thread 0x7fb0423e1c40 (LWP 4110)):
#0 std::filesystem::__cxx11::path::~path (this=0x0, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/fs_path.h:209
#1 0x00007fb0438d6434 in std::filesystem::__cxx11::path::_Cmpt::~_Cmpt (this=0x0, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/fs_path.h:644
#2 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt> (__pointer=0x0) at /usr/include/c++/8/bits/stl_construct.h:98
#3 std::_Destroy_aux<false>::__destroy<std::filesystem::__cxx11::path::_Cmpt*> (__last=<optimized out>, __first=0x0) at /usr/include/c++/8/bits/stl_construct.h:108
#4 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt*> (__last=<optimized out>, __first=<optimized out>) at /usr/include/c++/8/bits/stl_construct.h:137
#5 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt*, std::filesystem::__cxx11::path::_Cmpt> (__last=0x2, __first=<optimized out>) at /usr/include/c++/8/bits/stl_construct.h:206
#6 std::vector<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::~vector (this=0x55e9e44c34b0, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/stl_vector.h:567
#7 std::filesystem::__cxx11::path::~path (this=0x55e9e44c3490, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/fs_path.h:209
#8 std::filesystem::__cxx11::path::_Cmpt::~_Cmpt (this=0x55e9e44c3490, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/fs_path.h:644
#9 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt> (__pointer=0x55e9e44c3490) at /usr/include/c++/8/bits/stl_construct.h:98
#10 std::_Destroy_aux<false>::__destroy<std::filesystem::__cxx11::path::_Cmpt*> (__last=<optimized out>, __first=0x55e9e44c3490) at /usr/include/c++/8/bits/stl_construct.h:108
#11 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt*> (__last=<optimized out>, __first=<optimized out>) at /usr/include/c++/8/bits/stl_construct.h:137
#12 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt*, std::filesystem::__cxx11::path::_Cmpt> (__last=0x0, __first=0x55e9e44c3490) at /usr/include/c++/8/bits/stl_construct.h:206
--Type <RET> for more, q to quit, c to continue without paging--c
#13 std::vector<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::~vector (this=<synthetic pointer>, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/stl_vector.h:567
#14 std::vector<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::_M_move_assign (__x=..., this=0x7ffe85f32920) at /usr/include/c++/8/bits/stl_vector.h:1679
#15 std::vector<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::operator= (__x=..., this=0x7ffe85f32920) at /usr/include/c++/8/bits/stl_vector.h:601
#16 std::filesystem::__cxx11::path::operator= (__p=..., this=0x7ffe85f32900) at /usr/include/c++/8/bits/fs_path.h:797
#17 std::filesystem::__cxx11::path::operator= (__p=..., this=0x7ffe85f32900) at /usr/include/c++/8/bits/fs_path.h:791
#18 ignition::common::joinPaths (_path1="/home/jenkins", _path2=".ignition") at /home/jenkins/workspace/ignition_common-ci-pr_any-ubuntu_auto-amd64/ign-common/src/Filesystem.cc:143
#19 0x00007fb0438e3cf9 in ignition::common::SystemPaths::SystemPaths (this=0x55e9e44c3460) at /usr/include/c++/8/bits/basic_string.h:252
#20 0x00007fb0438cccc5 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /home/jenkins/workspace/ignition_common-ci-pr_any-ubuntu_auto-amd64/ign-common/src/Util.cc:564
#21 _GLOBAL__sub_I_Util.cc(void) () at /home/jenkins/workspace/ignition_common-ci-pr_any-ubuntu_auto-amd64/ign-common/src/Util.cc:564
#22 0x00007fb043e2eb8a in ?? () from /lib64/ld-linux-x86-64.so.2
#23 0x00007fb043e2ec91 in ?? () from /lib64/ld-linux-x86-64.so.2
#24 0x00007fb043e1e13a in ?? () from /lib64/ld-linux-x86-64.so.2
#25 0x0000000000000001 in ?? ()
#26 0x00007ffe85f34d24 in ?? ()
#27 0x0000000000000000 in ?? ()
(gdb)

Signed-off-by: Michael Carroll <[email protected]>
src/Util.cc Outdated Show resolved Hide resolved
@mjcarroll
Copy link
Contributor Author

Waiting on osrf/homebrew-simulation#1796

@scpeters
Copy link
Member

Waiting on osrf/homebrew-simulation#1796

I just merged it and restarted the homebrew build

Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few debug messages can be removed

src/SystemPaths.cc Outdated Show resolved Hide resolved
src/SystemPaths.cc Outdated Show resolved Hide resolved
src/SystemPaths.cc Outdated Show resolved Hide resolved
src/SystemPaths.cc Outdated Show resolved Hide resolved
@scpeters scpeters mentioned this pull request Feb 1, 2022
mjcarroll and others added 2 commits February 1, 2022 12:55
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two comments about Filesystem.cc

src/Filesystem.cc Show resolved Hide resolved
src/Filesystem.cc Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants