libcmd: drop non-default ctors virtual inheritance

it's a trap. it's always a trap. non-default ctors of virtual base
classes must be called with the same parameters every time or very
surprising things will happen. good luck if you virtually derive a
class more than once with different ctor arguments. that'll break.

Change-Id: I1345963e69e98f37c3cbd070bae164d89eade455
This commit is contained in:
eldritch horrors 2024-11-17 14:43:57 +01:00
parent ac74dc3a2b
commit c4a077d0b8
3 changed files with 4 additions and 2 deletions

View file

@ -227,7 +227,7 @@ protected:
public: public:
BuiltPathsCommand(bool recursive = false); BuiltPathsCommand(bool recursive);
virtual void run(ref<Store> store, BuiltPaths && paths) = 0; virtual void run(ref<Store> store, BuiltPaths && paths) = 0;

View file

@ -4,7 +4,7 @@
using namespace nix; using namespace nix;
struct CmdCopy : virtual CopyCommand, virtual BuiltPathsCommand struct CmdCopy : virtual CopyCommand, BuiltPathsCommand
{ {
CheckSigsFlag checkSigs = CheckSigs; CheckSigsFlag checkSigs = CheckSigs;

View file

@ -29,6 +29,8 @@ static auto rCmdRealisation = registerCommand<CmdRealisation>("realisation");
struct CmdRealisationInfo : BuiltPathsCommand, MixJSON struct CmdRealisationInfo : BuiltPathsCommand, MixJSON
{ {
CmdRealisationInfo() : BuiltPathsCommand(false) {}
std::string description() override std::string description() override
{ {
return "query information about one or several realisations"; return "query information about one or several realisations";