[Xorp-hackers] [PATCH] rtrmngr fixes

Ben Greear greearb at candelatech.com
Mon Sep 26 09:24:38 PDT 2011


On 09/26/2011 01:43 AM, "Igor Maravić" wrote:
>> On 09/23/2011 06:48 AM, "Igor Maravić" wrote:
>>> cleaned_xrl should have reference to it. That reference should be argument of functions XRLDB::check_xrl_syntax and XRLDB::check_xrl_exists.
>>> Don't know why but it didn't wont to compile with out that fix.
>>>
>>> VALIDATE_XRLDB should be replaced with DEBUG_XRLDB

Ok, the patch and description look good to me, but I cannot apply
your patch.  Please generate the patch with git and send it with
git send-email

Or, if that doesn't work for some reason, generate it and send it as email
attachment to me.  Hopefully that will come through clean.

I can also manually apply small patches like this, but then you
won't get commit credit..so I prefer to just receive proper
patches.

Thanks,
Ben

>>>
>>> BR
>>> Igor Maravić
>>>
>>> Signed-off-by: Igor Maravić<igorm at etf.rs>
>>> ---
>>>
>>> diff -upNr xorp.old/rtrmgr/template_commands.cc xorp.mpls/rtrmgr/template_commands.cc
>>> --- xorp.old/rtrmgr/template_commands.cc	2011-03-22 22:08:58.000000000 +0100
>>> +++ xorp.mpls/rtrmgr/template_commands.cc	2011-09-08 00:30:24.000000000 +0200
>>> @@ -316,6 +316,7 @@ XrlAction::check_xrl_is_valid(const list
>>>        // Then we can check it is a valid XRL as known by the XRLdb.
>>>        //
>>>        string cleaned_xrl;
>>> +    const string&   refToCleanedXRL = cleaned_xrl;
>>>
>>>        // Trim quotes from around the XRL
>>>        size_t start = 0;
>>> @@ -465,13 +466,14 @@ XrlAction::check_xrl_is_valid(const list
>>>        }
>>>        debug_msg("XrlAction after cleaning:\n%s\n", cleaned_xrl.c_str());
>>>
>>> -    if (xrldb->check_xrl_syntax(cleaned_xrl) == false) {
>>> +    if (xrldb->check_xrl_syntax(refToCleanedXRL) == false) {
>>>    	error_msg = c_format("Syntax error in module %s XRL %s: "
>>>    			     "invalid XRL syntax (check_xrl_syntax failed)",
>>>    			     module_name.c_str(), cleaned_xrl.c_str());
>>>    	return false;
>>>        }
>>> -    XRLMatchType match = xrldb->check_xrl_exists(cleaned_xrl);
>>> +
>>> +    XRLMatchType match = xrldb->check_xrl_exists(refToCleanedXRL);
>>>        switch (match) {
>>>        case MATCH_FAIL:
>>>        case MATCH_RSPEC: {
>>
>> What system are you compiling on, and can you show the exact
>> compiler command and errors?
>>
>> Thanks,
>> Ben
>>
>> --
>> Ben Greear<greearb at candelatech.com>
>> Candela Technologies Inc  http://www.candelatech.com
>>
>>
>
> When I compile with
>   scons debug_xrldb=True
>
> first error is:
>
>
> g++ -o obj/i686-pc-linux-gnu/rtrmgr/template_commands.o -c -O1 -g3 -Werror -W -Wall -Wwrite-strings -Wcast-qual -Wpointer-arith -Wcast-align -Woverloaded-virtual -ftemplate-depth-25 -pipe -DXRL_PF=120 -D_FORTIFY_SOURCE=0 -DDEBUG_XRLDB=1 -Iobj/i686-pc-linux-gnu -I. -I. rtrmgr/template_commands.cc
> rtrmgr/template_commands.cc: In member function ‘bool XrlAction::check_xrl_is_valid(const std::list<std::basic_string<char>  >&, const XRLdb*, std::string&)’:
> rtrmgr/template_commands.cc:468:16: error: ‘const class XRLdb’ has no member named ‘check_xrl_syntax’
> rtrmgr/template_commands.cc:474:33: error: ‘const class XRLdb’ has no member named ‘check_xrl_exists’
> scons: *** [obj/i686-pc-linux-gnu/rtrmgr/template_commands.o] Error 1
> scons: building terminated because of errors.
>
> Fix for that is to replace VALIDATE_XRLDB with DEBUG_XRLDB in xrldb.hh and xrldb.cc
> After that it compiles ok. I couldn't reproduce second error. It looked illogical anyway.
>
> This is the patch for that
> Signed-off-by: Igor Maravić<igorm at etf.rs>
> ---
>
> diff -upNr xorp.old/rtrmgr/xrldb.cc xorp.mpls/rtrmgr/xrldb.cc
> --- xorp.old/rtrmgr/xrldb.cc        2011-03-22 22:08:58.000000000 +0100
> +++ xorp.mpls/rtrmgr/xrldb.cc        2011-09-07 16:13:24.000000000 +0200
> @@ -160,7 +160,7 @@ XRLtarget::str() const
>   XRLdb::XRLdb(const string&  xrldir, bool verbose) throw (InitError)
>       : _verbose(verbose)
>   {
> -#ifdef VALIDATE_XRLDB
> +#ifdef DEBUG_XRLDB
>       string errmsg;
>       list<string>  files;
>
> @@ -209,7 +209,7 @@ XRLdb::XRLdb(const string&  xrldir, bool
>   #endif
>   }
>
> -#ifdef VALIDATE_XRLDB
> +#ifdef DEBUG_XRLDB
>   bool
>   XRLdb::check_xrl_syntax(const string&  xrlstr) const
>   {
> diff -upNr xorp.old/rtrmgr/xrldb.hh xorp.mpls/rtrmgr/xrldb.hh
> --- xorp.old/rtrmgr/xrldb.hh        2011-03-22 22:08:58.000000000 +0100
> +++ xorp.mpls/rtrmgr/xrldb.hh        2011-09-07 16:05:26.000000000 +0200
> @@ -65,7 +65,7 @@ private:
>   class XRLdb {
>   public:
>       XRLdb(const string&  xrldir, bool verbose) throw (InitError);
> -#ifdef VALIDATE_XRLDB
> +#ifdef DEBUG_XRLDB
>       bool check_xrl_syntax(const string&  xrl) const;
>       XRLMatchType check_xrl_exists(const string&  xrl) const;
>   #endif


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



More information about the Xorp-hackers mailing list