From ae73a2944a89e0d2406a2aab4a4c082e1e9da3f9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 31 Dec 2016 18:24:12 +0100 Subject: allow warning generation for non-whitelisted options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The idea is simple: Each¹ Find*( call starts with a call check if the given option (with the requested type) exists in the whitelist. The whitelist is specified via our configure-index file so that we have a better chance at keeping it current. the whitelist is loaded via a special (undocumented for now) configuration stanza and if none is loaded the empty whitelist will make it so that no warnings are shown. Much needs to be done still, but that is as good a time as any to take a snapshot of the current state and release it into the wild given that it found some bugs already and has no practical effect on users. ¹ not all in this iteration, but many --- apt-private/private-cmndline.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apt-private/private-cmndline.cc') diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index dcd7e1bae..b8b29e9c8 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -501,9 +501,6 @@ std::vector ParseCommandLine(CommandLine &CmdL, APT_CMD c for (auto const& cmd : CmdsWithHelp) Cmds.push_back({cmd.Match, cmd.Handler}); - // Args running out of scope invalidates the pointer stored in CmdL, - // but we don't use the pointer after this function, so we ignore - // this problem for now and figure something out if we have to. char const * CmdCalled = nullptr; if (Cmds.empty() == false && Cmds[0].Handler != nullptr) CmdCalled = CommandLine::GetCommand(Cmds.data(), argc, argv); @@ -511,6 +508,10 @@ std::vector ParseCommandLine(CommandLine &CmdL, APT_CMD c BinaryCommandSpecificConfiguration(argv[0], CmdCalled); std::string const conf = "Binary::" + _config->Find("Binary"); _config->MoveSubTree(conf.c_str(), nullptr); + + // Args running out of scope invalidates the pointer stored in CmdL, + // but we don't use the pointer after this function, so we ignore + // this problem for now and figure something out if we have to. auto Args = getCommandArgs(Binary, CmdCalled); CmdL = CommandLine(Args.data(), _config); -- cgit v1.2.3