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

[dev.icinga.com #8068] Two $ dollar signs lead to parse error #2424

Closed
icinga-migration opened this issue Dec 11, 2014 · 4 comments
Closed
Labels
area/configuration DSL, parser, compiler, error handling bug Something isn't working

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/8068

Created by chlab on 2014-12-11 15:53:00 +00:00

Assignee: (none)
Status: Rejected (closed on 2014-12-11 17:56:03 +00:00)
Target Version: (none)
Last Update: 2014-12-12 09:23:06 +00:00 (in Redmine)

Icinga Version: 2.1.1-1~bpo70+1

A command line with two runtime vars following one another like so $ARG1$$ARG2$ results in an error:

Closing $ not found in macro format string

Full stack trace:

[icinga::ContextTrace*] = 
    (0) Resolving macros for string '$USER1$/check_webpage.rb -H $address$ -u http://$ARG1$$ARG2$ --key  $ARG3$ -w 60 -c 90 -n'
    (1) Executing check for object 'example-hostname.org!http_content__example.org'


[2014-12-11 16:33:20 +0100] information/Checkable: Checking for configured notifications for object 'example.org!http_content__example.org'
[2014-12-11 16:33:20 +0100] information/Checkable: Checkable 'example.org!http_content__example.org' does not have any notifications.
[2014-12-11 16:33:20 +0100] critical/checker: Exception occured while checking 'example.org!http_content__example.org': /build/icinga2-pfgHLy/icinga2-2.1.1/lib/icinga/macroprocessor.cpp(170): Throw in function static icinga::String icinga::MacroProcessor::InternalResolveMacros(const icinga::String&, const ResolverList&, const Ptr&, icinga::String*, const EscapeCallback&, int)
Dynamic exception type: boost::exception_detail::clone_impl >
std::exception::what: Closing $ not found in macro format string.
[icinga::StackTrace*] = 
    (0) libbase.so: void boost::throw_exception >(boost::exception_detail::error_info_injector const&) (+0x4a) [0x7fd8a2c47e2a]
    (1) libbase.so: void boost::exception_detail::throw_exception_(std::runtime_error const&, char const*, char const*, int) (+0x54) [0x7fd8a2c47ea4]
    (2) libicinga.so: icinga::MacroProcessor::InternalResolveMacros(icinga::String const&, std::vector >, std::allocator > > > const&, boost::shared_ptr const&, icinga::String*, boost::function const&, int) (+0x447) [0x7fd89f2bbab7]
    (3) libicinga.so: icinga::MacroProcessor::ResolveMacros(icinga::Value const&, std::vector >, std::allocator > > > const&, boost::shared_ptr const&, icinga::String*, boost::function const&) (+0x307) [0x7fd89f2bc087]
    (4) libicinga.so: icinga::PluginUtility::ExecuteCommand(boost::shared_ptr const&, boost::shared_ptr const&, boost::shared_ptr const&, std::vector >, std::allocator > > > const&, boost::function const&) (+0x15e) [0x7fd89f2d3f1e]
    (5) libmethods.so: icinga::PluginCheckTask::ScriptFunc(boost::shared_ptr const&, boost::shared_ptr const&) (+0x5d3) [0x7fd89eb25fe3]
    (6) libmethods.so: icinga::Value icinga::ScriptFunctionWrapperV const&, boost::shared_ptr const&>(void (*)(boost::shared_ptr const&, boost::shared_ptr const&), std::vector > const&) (+0x60) [0x7fd89eb1f860]
    (7) libmethods.so: boost::detail::function::function_obj_invoker1 const&, boost::shared_ptr const&), std::vector > const&), boost::_bi::list2 const&, boost::shared_ptr const&)>, boost::arg<1> > >, icinga::Value, std::vector > const&>::invoke(boost::detail::function::function_buffer&, std::vector > const&) (+0xd) [0x7fd89eb1e0cd]
    (8) libbase.so: icinga::ScriptFunction::Invoke(std::vector > const&) (+0x1c) [0x7fd8a2c7c47c]
    (9) libbase.so: icinga::DynamicObject::InvokeMethod(icinga::String const&, std::vector > const&) (+0x177) [0x7fd8a2c5e8f7]
    (10) libicinga.so: icinga::CheckCommand::Execute(boost::shared_ptr const&, boost::shared_ptr const&) (+0x16e) [0x7fd89f2509ce]
    (11) libicinga.so: icinga::Checkable::ExecuteCheck() (+0x1be) [0x7fd89f2e32ce]
    (12) libchecker.so: icinga::CheckerComponent::ExecuteCheckHelper(boost::shared_ptr const&) (+0x33) [0x7fd89e8d1433]
    (13) libbase.so: icinga::ThreadPool::WorkerThread::ThreadProc(icinga::ThreadPool::Queue&) (+0x2d8) [0x7fd8a2ca3728]
    (14) libboost_thread.so.1.49.0:  (+0x10629) [0x7fd8a3343629]
    (15) libpthread.so.0:  (+0x6b50) [0x7fd8a2f27b50]
    (16) libc.so.6: clone (+0x6d) [0x7fd8a0fbc20d]

I tool a glance at https://github.com/Icinga/icinga2/blob/master/lib/icinga/macroprocessor.cpp and I suspect it might have something to do with pos_second = result.FindFirstOf("$", pos_first + 1); moving one character too far and skipping the following $. Just an idea.


Relations:

@icinga-migration
Copy link
Author

Updated by gbeutner on 2014-12-11 17:56:03 +00:00

  • Status changed from New to Rejected

Yeah, that's exactly the problem. And it's already fixed (as per #7314).

@icinga-migration
Copy link
Author

Updated by gbeutner on 2014-12-11 17:56:16 +00:00

  • Duplicates set to 7314

@icinga-migration
Copy link
Author

Updated by chlab on 2014-12-12 09:23:06 +00:00

Thanks!

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2014-12-16 19:00:50 +00:00

  • Relates set to 6858

@icinga-migration icinga-migration added bug Something isn't working area/configuration DSL, parser, compiler, error handling labels Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration DSL, parser, compiler, error handling bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant