Summary: | ASTERISK-08547: [patch] Properly handle tempates on config read/write | ||
Reporter: | Steven Sokol (ssokol) | Labels: | |
Date Opened: | 2007-01-10 13:17:00.000-0600 | Date Closed: | 2007-11-09 10:34:33.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/Configuration |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) config.c.patch | |
Description: | The configuration parser properly handles inherited properties from templates when loading them from configuration files, but miss-handles them when writing the configuration back to disk. The attached patch denotes a context which has been built from a template by automatically adding a variable called "inherited_" which is set to the parent category name. When the config handler writes the file, it checks to see if a category is marked as inherited_ and if so, only writes those values which are absent from the parent context. ****** ADDITIONAL INFORMATION ****** Patch appears to apply cleanly against both 1.4 head and against trunk. | ||
Comments: | By: Leif Madsen (lmadsen) 2007-10-31 10:54:42 /housekeeping Is this still an issue that needs to be resolved? I'm not quite sure I understand what is wrong here, or I'd try to reproduce it. Is this in extensions.conf, or all .conf file which use templates? When you say writing back out to the file, I'm guessing you mostly mean the dialplan and writing out the dialplan by adding an extension from the CLI? Do you have an example of a file where this doesn't work so I could reproduce it? By: Jason Parker (jparker) 2007-11-01 15:11:11 Initial config: [c1](!) a = foo [c2](c1) b = bar After saving: [c1](!) a = foo [c2] a = foo b = bar When c2 is loaded, it copies stuff from c1, so when it saves, it keeps them there. I think this is what he's referring to. By: Leif Madsen (lmadsen) 2007-11-01 21:15:16 Ahhhhh gotcha. That makes sense. I'll try and reproduce tomorrow to verify this is still an issue, and if so... I guess this will go to codefreeze :) By: Leif Madsen (lmadsen) 2007-11-02 10:37:38 Hrmmmm... unfortunately this patch didn't work for me. *CLI> dialplan add extension 200,1,Set,c=foobar into c2 *CLI> dialplan save Gives: [c2] exten => 100,1,Set(b=bar) exten => 200,1,Set(c=foobar) exten => s,1,Set(a=foo) Notice the [c1] template is gone... :( By: Steven Sokol (ssokol) 2007-11-02 12:43:00 Leif, Not sure if it's the way the CLI handles add and save. The intent of the patch was to avoid overwrite (actually literal inclusion) of the "inherited" options when saving the dialplan via the Manager (UpdateConfig). Perhaps the "dialplan save" command or the "add extension" commands operate somewhat differently. Thanks, -S By: Leif Madsen (lmadsen) 2007-11-02 13:04:37 Aha... you're doing this through the Manager interface... I didn't even think of that. Do you have a simple script with this already setup so I can test it? By: Steven Sokol (ssokol) 2007-11-02 13:11:55 No but you can test it on any box running the GUI. Just create a template user in users.conf as follows: [foo](!) test=yes data=blahblah Then edit a user created by the GUI by adding the template marker to it. For example: [6000](foo) Then fire up the GUI, load 6000 up, make a change and save it. If the patch is working correctly, when you look into the config you should see the (foo) inheritance indicator still there and no "test" or "data" items in the [6000] entity. If its not working then you'll see [6000] with two new key/value pairs: "test" and "data". Thanks, -S By: Steve Murphy (murf) 2007-11-06 10:55:49.000-0600 OK, I've played with this, and now, I'm an expert. While I think Steve took a practical approach, using a var to store the info needed, it didn't cover all the possibilities, and so I did my own version of this fix, where I put this structure into the structs in config.c; I didn't use the vars, because, if I put the list of templates in a single var, I'd have to write extra code to split it back out. Being the lazy slob I am, I made this list an official list in the ast_cataegory struct... Here's my set of tests: Output output output Input config 1.4 plain with Sokol's patch My version ------------ --------- ------------------ ------------ [foo](!) [foo] [foo] [foo](!) test = yes (same) (same) (same) data=blahblah (same) (same) (same) [foo2](!) [foo2] [foo2] [foo2](!) test2 = yes (same) (same) (same) data2 = bluchbluch (same) (same) (same) [foo3](!) [foo3] [foo3] [foo3](!) test3=no (same) (same) (same) data3=hoochbluch (same) (same) (same) [foo4](foo,foo2,foo3) [foo4] [foo4](foo) [foo4](foo,foo2,foo3) hooch=no test=yes test2=yes hooch=no data3=blahblech data=blahblah data2=bluchbluch data3=blahblech newthing=2 test2=yes test3=no newthing=2 data2=bluchbluch data3=hoochbluch test3=no hooch=no data3=blahblech data3=blahblech newthing=2 newthing=2 Don't ask me why, I didn't debug it, but the 1.4 version, as is, for some reason, left out hooch=no! It's probably bad form to try to override template values in the instances, as the config stuff has both var decls in the var list. Not good, as you'll probably not see the override. But the code as-is does this, so I left it be. By: Steve Murphy (murf) 2007-11-06 10:57:03.000-0600 Ugh! Stupid Mantis! removed all my spacing between columns in the table above! It was so.... pretty.... before, now its so.... UGLY. By: Digium Subversion (svnbot) 2007-11-06 11:50:57.000-0600 Repository: asterisk Revision: 89036 U branches/1.4/main/config.c ------------------------------------------------------------------------ r89036 | murf | 2007-11-06 11:50:55 -0600 (Tue, 06 Nov 2007) | 1 line closes issue ASTERISK-8547 - where the [catname](!) and [catname](othercat1,othercat2,...) notation gets dropped across a ConfigUpdate (or any other thing that would cause a config file to be written). While I was at it, I also cleaned up some of the destroy routines to free up comments, which was not being done. Made sure the new struct I introduced is also cleaned up properly at destruction time. My code handles multiple template inclusions. Many thanks to ssokol for his patch, which, while not literally used in the final merge, served as a foundation for the fix. ------------------------------------------------------------------------ By: Digium Subversion (svnbot) 2007-11-06 15:06:45.000-0600 Repository: asterisk Revision: 89062 _U trunk/ U trunk/main/config.c ------------------------------------------------------------------------ r89062 | murf | 2007-11-06 15:06:44 -0600 (Tue, 06 Nov 2007) | 9 lines Merged revisions 89036 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89036 | murf | 2007-11-06 10:52:50 -0700 (Tue, 06 Nov 2007) | 1 line closes issue ASTERISK-8547 - where the [catname](!) and [catname](othercat1,othercat2,...) notation gets dropped across a ConfigUpdate (or any other thing that would cause a config file to be written). While I was at it, I also cleaned up some of the destroy routines to free up comments, which was not being done. Made sure the new struct I introduced is also cleaned up properly at destruction time. My code handles multiple template inclusions. Many thanks to ssokol for his patch, which, while not literally used in the final merge, served as a foundation for the fix. ........ ------------------------------------------------------------------------ By: Digium Subversion (svnbot) 2007-11-06 15:31:34.000-0600 Repository: asterisk Revision: 89066 _U team/murf/fast-ast2/ U team/murf/fast-ast2/apps/app_amd.c U team/murf/fast-ast2/apps/app_chanisavail.c U team/murf/fast-ast2/apps/app_chanspy.c U team/murf/fast-ast2/apps/app_directed_pickup.c U team/murf/fast-ast2/apps/app_exec.c U team/murf/fast-ast2/apps/app_festival.c U team/murf/fast-ast2/apps/app_followme.c U team/murf/fast-ast2/apps/app_forkcdr.c U team/murf/fast-ast2/apps/app_getcpeid.c U team/murf/fast-ast2/apps/app_macro.c U team/murf/fast-ast2/apps/app_minivm.c U team/murf/fast-ast2/apps/app_mixmonitor.c U team/murf/fast-ast2/apps/app_morsecode.c U team/murf/fast-ast2/apps/app_mp3.c U team/murf/fast-ast2/apps/app_nbscat.c U team/murf/fast-ast2/apps/app_playback.c U team/murf/fast-ast2/apps/app_readfile.c U team/murf/fast-ast2/apps/app_sayunixtime.c U team/murf/fast-ast2/apps/app_sms.c U team/murf/fast-ast2/apps/app_softhangup.c U team/murf/fast-ast2/apps/app_speech_utils.c U team/murf/fast-ast2/apps/app_stack.c U team/murf/fast-ast2/apps/app_test.c U team/murf/fast-ast2/apps/app_waitforring.c U team/murf/fast-ast2/apps/app_waitforsilence.c U team/murf/fast-ast2/apps/app_while.c U team/murf/fast-ast2/channels/chan_agent.c U team/murf/fast-ast2/channels/chan_gtalk.c U team/murf/fast-ast2/channels/chan_jingle.c U team/murf/fast-ast2/channels/chan_sip.c U team/murf/fast-ast2/codecs/codec_zap.c U team/murf/fast-ast2/include/asterisk/jabber.h U team/murf/fast-ast2/include/asterisk/lock.h U team/murf/fast-ast2/include/asterisk/tdd.h U team/murf/fast-ast2/main/ast_expr2.fl U team/murf/fast-ast2/main/ast_expr2f.c U team/murf/fast-ast2/main/astmm.c U team/murf/fast-ast2/main/channel.c U team/murf/fast-ast2/main/config.c U team/murf/fast-ast2/main/fskmodem.c U team/murf/fast-ast2/main/loader.c U team/murf/fast-ast2/main/pbx.c U team/murf/fast-ast2/main/tdd.c U team/murf/fast-ast2/res/res_features.c U team/murf/fast-ast2/res/res_indications.c U team/murf/fast-ast2/res/res_jabber.c U team/murf/fast-ast2/res/res_monitor.c U team/murf/fast-ast2/res/res_musiconhold.c ------------------------------------------------------------------------ r89066 | murf | 2007-11-06 15:31:33 -0600 (Tue, 06 Nov 2007) | 188 lines Merged revisions 89031,89034,89038,89041,89043-89044,89047-89052,89054-89055,89057,89062 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r89031 | rizzo | 2007-11-06 10:05:13 -0700 (Tue, 06 Nov 2007) | 17 lines Fix embedding of modules on FreeBSD: the constructor for the list of modules was run after the constructors for the embedded modules (which appended entries to the list). As a result, the list appeared empty when it was time to use it. On linux the order of execution of constructor was evidently different (it may depend on the ordering of modules in the ELF file). This is only a workaround - there may be other situations where the execution of constructors causes problems, so if we manage to find a more general solution this workaround can go away. ................ r89034 | file | 2007-11-06 10:10:03 -0700 (Tue, 06 Nov 2007) | 12 lines Merged revisions 89032 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89032 | file | 2007-11-06 13:08:05 -0400 (Tue, 06 Nov 2007) | 4 lines Make it so that if a peer is determined to be unreachable using qualify their devicestate will report back unavailable. (closes issue ASTERISK-10551) Reported by: pj ........ ................ r89038 | russell | 2007-11-06 11:23:36 -0700 (Tue, 06 Nov 2007) | 19 lines Merged revisions 89037 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89037 | russell | 2007-11-06 12:20:07 -0600 (Tue, 06 Nov 2007) | 11 lines If someone were to delete the files used by an existing MOH class, and then issue a reload, further use of that class could result in a crash due to dividing by zero. This set of changes fixes up some places to prevent this from happening. (closes issue ASTERISK-10500) Reported by: jcomellas Patches: res_musiconhold_division_by_zero.patch uploaded by jcomellas (license 282) Additional changes added by me. ........ ................ r89041 | qwell | 2007-11-06 11:44:19 -0700 (Tue, 06 Nov 2007) | 4 lines Allow gtalk and jingle to use TLS connections again. Closes issue ASTERISK-9675 ................ r89043 | oej | 2007-11-06 12:04:29 -0700 (Tue, 06 Nov 2007) | 12 lines Merged revisions 89042 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89042 | oej | 2007-11-06 19:53:37 +0100 (Tis, 06 Nov 2007) | 2 lines Bug fixes to tdd support in zaptel. ........ (Small changes for trunk) ................ r89044 | mmichelson | 2007-11-06 12:04:45 -0700 (Tue, 06 Nov 2007) | 7 lines "show application <foo>" changes for clarity. (closes issue ASTERISK-10696, reported and patched by blitzrage) Many thanks! ................ r89047 | qwell | 2007-11-06 12:10:18 -0700 (Tue, 06 Nov 2007) | 12 lines Merged revisions 89046 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89046 | qwell | 2007-11-06 13:09:30 -0600 (Tue, 06 Nov 2007) | 4 lines Correctly set the total number of channels from a zaptel transcoder board. SPD-49, patch by Matthew Nicholson. ........ ................ r89048 | oej | 2007-11-06 12:10:26 -0700 (Tue, 06 Nov 2007) | 2 lines Additional TDD changes (preparing for SIP changes - adding TDD support to SIP) ................ r89049 | tilghman | 2007-11-06 12:16:02 -0700 (Tue, 06 Nov 2007) | 10 lines Merged revisions 89045 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89045 | tilghman | 2007-11-06 13:09:06 -0600 (Tue, 06 Nov 2007) | 2 lines We went to the trouble of creating a method of tracking failed trylocks, then never turned it on (oops). ........ ................ r89050 | oej | 2007-11-06 12:23:10 -0700 (Tue, 06 Nov 2007) | 2 lines Formatting. Illegaly using some spare spaces from Russell's space-bucket. ................ r89051 | murf | 2007-11-06 12:40:33 -0700 (Tue, 06 Nov 2007) | 1 line Hoping to avoid a crash in OSX for a problem blitzrage found ................ r89052 | russell | 2007-11-06 12:51:37 -0700 (Tue, 06 Nov 2007) | 4 lines Fix the memory show allocations CLI command so that it doesn't spew out all of the current memory allocations when you start Asterisk, when the command's handler gets called for initialization. ................ r89054 | russell | 2007-11-06 13:22:50 -0700 (Tue, 06 Nov 2007) | 11 lines Merged revisions 89053 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89053 | russell | 2007-11-06 14:18:49 -0600 (Tue, 06 Nov 2007) | 3 lines Fix init_classes() so that classes that actually do have files loaded aren't treated as empty, and immediately destroyed ... ........ ................ r89055 | mmichelson | 2007-11-06 13:32:49 -0700 (Tue, 06 Nov 2007) | 9 lines Instead of trying to callback a local channel on a failed attended transfer, call the device that made the transfer instead. This makes for much smoother calling back when queues are involved. (closes issue ASTERISK-10680, reported by IPetrov) Tremendous thanks to Russell for pulling me out of my block I was having on this one ................ r89057 | file | 2007-11-06 13:55:58 -0700 (Tue, 06 Nov 2007) | 4 lines Remove native bridging check for DTMF based transfers. Thanks to the last batch of RTP changes it is no longer required for the media stream to go through Asterisk if DTMF is going over signalling. It will simply reinvite back as needed. (closes issue ASTERISK-10697) Reported by: ibc ................ r89062 | murf | 2007-11-06 14:08:38 -0700 (Tue, 06 Nov 2007) | 9 lines Merged revisions 89036 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89036 | murf | 2007-11-06 10:52:50 -0700 (Tue, 06 Nov 2007) | 1 line closes issue ASTERISK-8547 - where the [catname](!) and [catname](othercat1,othercat2,...) notation gets dropped across a ConfigUpdate (or any other thing that would cause a config file to be written). While I was at it, I also cleaned up some of the destroy routines to free up comments, which was not being done. Made sure the new struct I introduced is also cleaned up properly at destruction time. My code handles multiple template inclusions. Many thanks to ssokol for his patch, which, while not literally used in the final merge, served as a foundation for the fix. ........ ................ ------------------------------------------------------------------------ By: Digium Subversion (svnbot) 2007-11-09 10:34:33.000-0600 Repository: asterisk Revision: 89131 _U team/file/t38fun/ U team/file/t38fun/apps/app_queue.c U team/file/t38fun/apps/app_voicemail.c U team/file/t38fun/cdr/cdr_tds.c U team/file/t38fun/channels/chan_sip.c U team/file/t38fun/codecs/codec_zap.c U team/file/t38fun/configs/extensions.ael.sample U team/file/t38fun/configs/res_odbc.conf.sample U team/file/t38fun/doc/valgrind.txt U team/file/t38fun/include/asterisk/lock.h U team/file/t38fun/main/config.c U team/file/t38fun/main/manager.c U team/file/t38fun/main/say.c U team/file/t38fun/main/srv.c U team/file/t38fun/main/tdd.c U team/file/t38fun/pbx/pbx_ael.c U team/file/t38fun/res/res_jabber.c U team/file/t38fun/res/res_musiconhold.c ------------------------------------------------------------------------ r89131 | file | 2007-11-09 10:34:31 -0600 (Fri, 09 Nov 2007) | 168 lines Merged revisions 89032,89036-89037,89042,89045-89046,89053,89079,89085,89088,89090,89093,89095,89097,89099,89101,89103,89105,89111,89115,89119,89125 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89032 | file | 2007-11-06 13:08:05 -0400 (Tue, 06 Nov 2007) | 4 lines Make it so that if a peer is determined to be unreachable using qualify their devicestate will report back unavailable. (closes issue ASTERISK-10551) Reported by: pj ........ r89036 | murf | 2007-11-06 13:52:50 -0400 (Tue, 06 Nov 2007) | 1 line closes issue ASTERISK-8547 - where the [catname](!) and [catname](othercat1,othercat2,...) notation gets dropped across a ConfigUpdate (or any other thing that would cause a config file to be written). While I was at it, I also cleaned up some of the destroy routines to free up comments, which was not being done. Made sure the new struct I introduced is also cleaned up properly at destruction time. My code handles multiple template inclusions. Many thanks to ssokol for his patch, which, while not literally used in the final merge, served as a foundation for the fix. ........ r89037 | russell | 2007-11-06 14:20:07 -0400 (Tue, 06 Nov 2007) | 11 lines If someone were to delete the files used by an existing MOH class, and then issue a reload, further use of that class could result in a crash due to dividing by zero. This set of changes fixes up some places to prevent this from happening. (closes issue ASTERISK-10500) Reported by: jcomellas Patches: res_musiconhold_division_by_zero.patch uploaded by jcomellas (license 282) Additional changes added by me. ........ r89042 | oej | 2007-11-06 14:53:37 -0400 (Tue, 06 Nov 2007) | 2 lines Bug fixes to tdd support in zaptel. ........ r89045 | tilghman | 2007-11-06 15:09:06 -0400 (Tue, 06 Nov 2007) | 2 lines We went to the trouble of creating a method of tracking failed trylocks, then never turned it on (oops). ........ r89046 | qwell | 2007-11-06 15:09:30 -0400 (Tue, 06 Nov 2007) | 4 lines Correctly set the total number of channels from a zaptel transcoder board. SPD-49, patch by Matthew Nicholson. ........ r89053 | russell | 2007-11-06 16:18:49 -0400 (Tue, 06 Nov 2007) | 3 lines Fix init_classes() so that classes that actually do have files loaded aren't treated as empty, and immediately destroyed ... ........ r89079 | tilghman | 2007-11-07 00:07:49 -0400 (Wed, 07 Nov 2007) | 5 lines Suppress AEL warnings on load. Reported by: eliel Patch by: eliel Closes issue ASTERISK-10703 ........ r89085 | mmichelson | 2007-11-07 11:56:49 -0400 (Wed, 07 Nov 2007) | 5 lines Fixing a segfault in the manager "core show channels concise" command. (closes issue ASTERISK-10708, reported by arnd and patched by ys) ........ r89088 | murf | 2007-11-07 17:40:28 -0400 (Wed, 07 Nov 2007) | 1 line In response to 10578, I just ran 1.4 thru valgrind; some of the config leakage I've already fixed, but it doesn't hurt to double check. I found and fixed leaks in res_jabber, cdr_tds, pbx_ael. Nothing major, tho. ........ r89090 | mmichelson | 2007-11-07 18:40:35 -0400 (Wed, 07 Nov 2007) | 6 lines This patch makes it possible for SIP phones to dial extensions defined with '#' characters in extensions.conf AND maintain their escaped characters when forming URI's (closes issue ASTERISK-10265, reported by cahen, patched by me, code review by file) ........ r89093 | tilghman | 2007-11-07 19:39:37 -0400 (Wed, 07 Nov 2007) | 7 lines The member refcount must be incremented, to avoid using it after deallocation. A huge thanks go to lvl- for patiently providing the necessary valgrind output that was necessary to finding this problem of memory corruption. Reported by: lvl- Patch by: tilghman Closes issue ASTERISK-10699 ........ r89095 | file | 2007-11-07 19:53:25 -0400 (Wed, 07 Nov 2007) | 4 lines If callerid is configured in sip.conf use that for checking the presence of an extension in the dialplan. (closes issue ASTERISK-10710) Reported by: spditner ........ r89097 | file | 2007-11-07 21:11:25 -0400 (Wed, 07 Nov 2007) | 8 lines Add support for allowing one outgoing transaction. This means if a response comes back out of order chan_sip will still handle it. I dream of a chan_sip with real transaction support. (closes issue ASTERISK-10498) Reported by: flefoll (closes issue ASTERISK-10472) Reported by: ramonpeek (closes issue ASTERISK-9288) Reported by: atca_pres ........ r89099 | file | 2007-11-07 21:28:56 -0400 (Wed, 07 Nov 2007) | 6 lines Improve the devicestate logic for multiple devices. If any are available then the extension is considered available. (closes issue ASTERISK-9843) Reported by: nic_bellamy Patches: sip-hinting-svn-branch-1.4.patch uploaded by nic (license 299) ........ r89101 | file | 2007-11-07 22:26:48 -0400 (Wed, 07 Nov 2007) | 4 lines Do not add a sip: to the beginning of the To URI unless needed. (closes issue ASTERISK-10331) Reported by: goestelecom ........ r89103 | tilghman | 2007-11-08 00:55:19 -0400 (Thu, 08 Nov 2007) | 2 lines Typo ........ r89105 | kpfleming | 2007-11-08 01:26:47 -0400 (Thu, 08 Nov 2007) | 2 lines fix a glaring bug in the new SRV record handling that would cause incorrect weight sorting ........ r89111 | mmichelson | 2007-11-08 12:47:23 -0400 (Thu, 08 Nov 2007) | 5 lines I made this same adjustment in trunk to fix a bug, and it makes sense to do it in 1.4 as well. If an imapfolder is specified in voicemail.conf, don't ever explicitly connect to INBOX since it may not exist. ........ r89115 | qwell | 2007-11-08 14:45:15 -0400 (Thu, 08 Nov 2007) | 4 lines Avoid warnings on load when using sample configuration files. Issue 11195, patch by eliel. ........ r89119 | mmichelson | 2007-11-08 17:00:08 -0400 (Thu, 08 Nov 2007) | 7 lines Rework of the commit I made yesterday to use the already built-in ast_uri_decode function as opposed to my home-rolled one. Also added comments. Thanks to oej for pointing me in the right direction ........ r89125 | qwell | 2007-11-08 19:52:35 -0400 (Thu, 08 Nov 2007) | 4 lines Properly say the seconds here.. Issue 11203, fix described by vma. ........ ------------------------------------------------------------------------ |