@philiptaron's lix workspace
Find a file
jade ac78c1dcd5 libutil: fix args assert being thrown on Darwin in nix-eval-jobs
This is because a dynamic_cast<nix::RootArgs *> of a (n-e-j) MyArgs
returns nullptr even though MyArgs has virtual nix::RootArgs as a
parent.

class MyArgs : virtual public nix::MixEvalArgs,
               virtual public nix::MixCommonArgs,
               virtual nix::RootArgs { ... };

So this should work right?? But it does not. We found out that it's
caused by -fvisibility=hidden in n-e-j, but honestly this code was bad
anyway.

The trivial solution is to simply stop relying on RTTI working properly
here, which is probably better OO architecture anyway. However, I am not
100% confident *this* is sound, since we have this horrible hierarchy:

      Args (defines getRoot)
     /        |           \
RootArgs  MixCommonArgs  MixEvalArgs
(overrides)

I am not confident that this is guaranteed to resolve from Args always
in the case of this override.

Assertion failed: (res), function getRoot, file src/libutil/args.cc, line 67.
6MyArgsProcess 60503 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = hit program assert
    frame #4: 0x0000000100b1a41c liblixutil.dylib`nix::Args::processArgs(std::__1::list<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, bool) [inlined] nix::Args::getRoot(this=0x00000001000d0688) at args.cc:67:5 [opt]
   64       std::cout << typeid(*p).name();
   65
   66       auto * res = dynamic_cast<RootArgs *>(p);
-> 67       assert(res);
   68       return *res;
   69   }
   70
Target 0: (nix-eval-jobs) stopped.

(lldb) p this
(MyArgs *) 0x00000001000d0688
(lldb) p *this
(nix::Args) {
  longFlags = size=180  { ... }
  shortFlags = size=4  { ... }
  expectedArgs = size=1  { ... }
  processedArgs = size=0 {}
  hiddenCategories = size=1 {
    [0] = "Options to override configuration settings"
  }
  parent = nullptr
}

We also found that if we did this:
class [[gnu::visibility("default")]] RootArgs : virtual public Args

it would work properly (???!). This is of course, very strange, because
objdump -Ct output on liblixexpr.dylib is identical both with and
without it.

Possibly related: https://www.qt.io/blog/quality-assurance/one-way-dynamic_cast-across-library-boundaries-can-fail-and-how-to-fix-it

Fixes: lix-project/nix-eval-jobs#2
Change-Id: I6b9ed968ed56420a9c4d2dffd18999d78c2761bd
2024-05-31 12:17:06 +00:00
.github
bench
clang-tidy clang-tidy: work with angle brackets and external projects 2024-05-24 02:22:58 +00:00
contrib
doc Merge "document context-dependent keywords" into main 2024-05-31 10:07:50 +00:00
lix-doc lix-doc: don't chomp bold headings off 2024-05-15 15:24:03 -07:00
maintainers Merge "chore: remove incorrect maintainers/*.md documentation" into main 2024-05-20 12:35:20 +00:00
meson packaging: rename nixexpr -> lixexpr and so on 2024-05-23 16:45:23 -06:00
misc doc: sort change-authors.yml 2024-05-23 02:09:05 +00:00
nix-support
perl util.hh: Delete remaining file and clean up headers 2024-05-29 12:38:51 +02:00
scripts
src libutil: fix args assert being thrown on Darwin in nix-eval-jobs 2024-05-31 12:17:06 +00:00
subprojects/aws_sdk build: fix static aws-cpp-sdk 2024-05-30 00:40:25 -06:00
tests Merge "Revert "tests/filetransfer: reënable on Darwin"" into main 2024-05-30 21:53:38 +00:00
.clang-format
.clang-tidy
.dir-locals.el
.editorconfig add editorconfig for markdown 2024-05-24 02:22:44 +00:00
.envrc
.gitignore
.version
boehmgc-coroutine-sp-fallback.diff
boehmgc-traceable_allocator-public.diff
CONTRIBUTING.md
COPYING
default.nix
docker.nix
flake.lock flake: update nixpkgs input to latest nixos-23.11 2024-05-08 23:03:28 +02:00
flake.nix release-notes: build unreleased release notes by default 2024-05-15 15:01:38 -07:00
justfile justfile: remove --quiet from just test 2024-05-24 02:22:25 +00:00
meson.build build: fix static aws-cpp-sdk 2024-05-30 00:40:25 -06:00
meson.options
package.nix build: fix static aws-cpp-sdk 2024-05-30 00:40:25 -06:00
precompiled-headers.h
README.md
shell.nix shell.nix: conform to documentation 2024-05-27 16:47:40 +02:00
treefmt.toml

Lix

Lix is an implementation of Nix, a powerful package management system for Linux and other Unix systems that makes package management reliable and reproducible.

Read more about us at https://lix.systems.

Installation

On Linux and macOS the easiest way to install Nix is to run the following shell command (as a user other than root):

$ curl -sSf -L https://install.lix.systems/lix | sh -s -- install

For systems that already have Nix installed, such as NixOS systems, read our install page

Building And Developing

See our Hacking guide in our manual for instruction on how to to set up a development environment and build Lix from source.

Additional Resources

License

Lix is released under the LGPL v2.1.