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

boost::ut::detail::cfg::{largc,largv} are initialized with garbage on alpine linux. #645

Open
tomboehmer opened this issue Nov 22, 2024 · 0 comments

Comments

@tomboehmer
Copy link
Contributor

tomboehmer commented Nov 22, 2024

Expected Behavior

__attribute__((constructor(101))) inline void cmd_line_args should initialize the largc and largv from actual argc and argv.

Actual Behavior

  • largc gets set to a different, seemingly random, integer in each run
  • use of largv leads to a segfault in boost::ut::detail::cfg::parse when assigning to executable_name
  • happens for both clang and gcc
  • If I remove the cmd_line_args function then largc and largv retain their default values of zero: so at least the function gets called
  • i assume this is a musl problem since it works fine on debian with glibc

Steps to Reproduce the Problem

  1. Run on alpine linux: podman run --rm -it alpine:3.20 ash
  2. apk add g++
  3. g++ -o main.out -D BOOST_UT_DISABLE_MODULE=1 -std=c++20 ut_test.cpp
// ut_test.cpp

#include "ut.hpp"                                                                                        
                                                                                                         
int main() {                                                                                             
    std::cerr << "cfg::largc: " << boost::ut::detail::cfg::largc << '\n';                                
    std::cerr << "cfg::largv: " << boost::ut::detail::cfg::largv << '\n';                                
    return 0;                                                                                            
}

Specifications

  • Version: latest git commit from master: aefa901
  • Platform: Alpine Linux 3.20
@tomboehmer tomboehmer changed the title boost::ut::detail::cfg::largc are initialized with garbage on alpine linux. boost::ut::detail::cfg::{largc,largv} are initialized with garbage on alpine linux. Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant