Item1308: EditTablePlugin has problems with included topics with included edittable definition

pencil
Priority: Urgent
Current State: Closed
Released In: 1.0.4
Target Release: patch
Applies To: Extension
Component: EditTablePlugin
Branches:
Reported By: KennethLavrsen
Waiting For: Main.KennethLavrsen
Last Change By: KennethLavrsen
My Foswiki just died with a crash

Use of uninitialized value in pattern match (m//) at /var/www/Release01x00/core/lib/Foswiki/Plugins/EditTablePlugin/Core.pm line 783.
 at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 314
   CGI::Carp::realdie('Use of uninitialized value in pattern match (m//) at /var/www...') called at /usr/lib/perl5/5.8.8/CGI/Carp.pm line 385
   CGI::Carp::die('Use of uninitialized value in pattern match (m//) at /var/www...') called at /var/www/Release01x00/core/lib/Foswiki.pm line 154
   Foswiki::__ANON__('Use of uninitialized value in pattern match (m//) at /var/www...') called at /var/www/Release01x00/core/lib/Foswiki/Plugins/EditTablePlugin/Core.pm line 783
   Foswiki::Plugins::EditTablePlugin::Core::handleEditTableTag('QMS', 'ProcedureSysarch000Comments', ' include="QmsCommentTable" ') called at /var/www/Release01x00/core/lib/Foswiki/Plugins/EditTablePlugin/Core.pm line 235
   Foswiki::Plugins::EditTablePlugin::Core::processText(2, 0, '---+ User Added Comments - ProcedureSysarch000 - System Archi...', 'ProcedureSysarch000Comments', 'QMS', 'ProcedureSysarch000', 'QMS') called at /var/www/Release01x00/core/lib/Foswiki/Plugins/EditTablePlugin/Core.pm line 135
   Foswiki::Plugins::EditTablePlugin::Core::process('---+ User Added Comments - ProcedureSysarch000 - System Archi...', 'ProcedureSysarch000Comments', 'QMS', 'ProcedureSysarch000', 'QMS') called at /var/www/Release01x00/core/lib/Foswiki/Plugins/EditTablePlugin.pm line 114
   Foswiki::Plugins::EditTablePlugin::commonTagsHandler('---+ User Added Comments - ProcedureSysarch000 - System Archi...', 'ProcedureSysarch000Comments', 'QMS', 1, 'Foswiki::Meta=HASH(0xb33748c)') called at /var/www/Release01x00/core/lib/Foswiki/Plugin.pm line 273
   Foswiki::Plugin::invoke('Foswiki::Plugin=HASH(0xa472278)', 'commonTagsHandler', '---+ User Added Comments - ProcedureSysarch000 - System Archi...', 'ProcedureSysarch000Comments', 'QMS', 1, 'Foswiki::Meta=HASH(0xb33748c)') called at /var/www/Release01x00/core/lib/Foswiki/Plugins.pm line 316
   Foswiki::Plugins::dispatch('Foswiki::Plugins=HASH(0xa29811c)', 'commonTagsHandler', '---+ User Added Comments - ProcedureSysarch000 - System Archi...', 'ProcedureSysarch000Comments', 'QMS', 1, 'Foswiki::Meta=HASH(0xb33748c)') called at /var/www/Release01x00/core/lib/Foswiki.pm line 3491
   Foswiki::INCLUDE('Foswiki=HASH(0xa0286b4)', 'Foswiki::Attrs=HASH(0xb3373fc)', 'ProcedureSysarch000', 'QMS', 'Foswiki::Meta=HASH(0xae75c58)') called at /var/www/Release01x00/core/lib/Foswiki.pm line 2771
   Foswiki::_expandTagOnTopicRendering('Foswiki=HASH(0xa0286b4)', 'INCLUDE', '"ProcedureSysarch000Comments"', 'ProcedureSysarch000', 'QMS', 'Foswiki::Meta=HASH(0xae75c58)') called at /var/www/Release01x00/core/lib/Foswiki.pm line 2676
   Foswiki::_processTags('Foswiki=HASH(0xa0286b4)', '---+!! %FORMFIELD{"DocumentID"}% %FORMFIELD{"TopicTitle"}%\x{a}\x{a}<...', 'CODE(0xa3b5458)', 16, 'ProcedureSysarch000', 'QMS', 'Foswiki::Meta=HASH(0xae75c58)') called at /var/www/Release01x00/core/lib/Foswiki.pm line 2593
   Foswiki::expandAllTags('Foswiki=HASH(0xa0286b4)', 'SCALAR(0xb06479c)', 'ProcedureSysarch000', 'QMS', 'Foswiki::Meta=HASH(0xae75c58)') called at /var/www/Release01x00/core/lib/Foswiki.pm line 2950
   Foswiki::handleCommonTags('Foswiki=HASH(0xa0286b4)', '---+!! %FORMFIELD{"DocumentID"}% %FORMFIELD{"TopicTitle"}%\x{a}\x{a}<...', 'QMS', 'ProcedureSysarch000', 'Foswiki::Meta=HASH(0xae75c58)') called at /var/www/Release01x00/core/lib/Foswiki/UI/View.pm line 388
   Foswiki::UI::View::_prepare('---+!! %FORMFIELD{"DocumentID"}% %FORMFIELD{"TopicTitle"}%\x{a}\x{a}<...', 'Foswiki=HASH(0xa0286b4)', 'QMS', 'ProcedureSysarch000', 'Foswiki::Meta=HASH(0xae75c58)', 0) called at /var/www/Release01x00/core/lib/Foswiki/UI/View.pm line 368
   Foswiki::UI::View::view('Foswiki=HASH(0xa0286b4)') called at /var/www/Release01x00/core/lib/Foswiki/UI.pm line 181
   Foswiki::UI::__ANON__() called at /usr/lib/perl5/vendor_perl/5.8.8/Error.pm line 415
   eval {...} called at /usr/lib/perl5/vendor_perl/5.8.8/Error.pm line 407
   Error::subs::try('CODE(0xa1c4858)', 'HASH(0xaeb2814)') called at /var/www/Release01x00/core/lib/Foswiki/UI.pm line 249
   Foswiki::UI::execute('Foswiki::Request=HASH(0xa443d90)', 'CODE(0xa443af0)', 'view', 1) called at /var/www/Release01x00/core/lib/Foswiki/UI.pm line 120
   Foswiki::UI::handleRequest('Foswiki::Request=HASH(0xa443d90)') called at /var/www/Release01x00/core/lib/Foswiki/Engine/CGI.pm line 26
   Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0xa2321f4)') called at /var/www/Release01x00/core/bin/view line 45.

I am attaching the deadly topic

I have ASSERTS on. Trying without.

-- KennethLavrsen - 16 Mar 2009

It was ASSERTS. Trying to find the root cause now

-- KennethLavrsen - 16 Mar 2009

It happens when you have a topic that includes a topic which has en EDITTABLE with an include.

Without asserts on the edit table just doesn't work and the log is filled with initialization warnings.

This is a real life example from our quality management system so I will see this at work if I upgrade to Foswiki (which I still cannot do because of bugs). So I put this urgent.

error log says

[Tue Mar 17 00:42:30 2009] [error] [client 192.168.1.11] [Tue Mar 17 00:42:30 2009] view: Use of uninitialized value in pattern match (m//) at /var/www/Release01x00/core/lib/Foswiki/Plugins/EditTablePlugin/Core.pm line 783., referer: http://merlin.lavrsen.dk/foswiki10/bin/view/QMS/ProcedureSysarch000Comments
[Tue Mar 17 00:42:30 2009] [error] [client 192.168.1.11] [Tue Mar 17 00:42:30 2009] view: Use of uninitialized value in concatenation (.) or string at /var/www/Release01x00/core/lib/Foswiki/Plugins/EditTablePlugin/Core.pm line 821., referer: http://merlin.lavrsen.dk/foswiki10/bin/view/QMS/ProcedureSysarch000Comments
[Tue Mar 17 00:42:30 2009] [error] [client 192.168.1.11] [Tue Mar 17 00:42:30 2009] view: Use of uninitialized value in concatenation (.) or string at /var/www/Release01x00/core/lib/Foswiki/Plugins/EditTablePlugin/Core.pm line 878., referer: http://merlin.lavrsen.dk/foswiki10/bin/view/QMS/ProcedureSysarch000Comments
[Tue Mar 17 00:42:30 2009] [error] [client 192.168.1.11] [Tue Mar 17 00:42:30 2009] view: Use of uninitialized value in concatenation (.) or string at /var/www/Release01x00/core/lib/Foswiki/Plugins/EditTablePlugin/Core.pm line 953., referer: http://merlin.lavrsen.dk/foswiki10/bin/view/QMS/ProcedureSysarch000Comments
[Tue Mar 17 00:42:33 2009] [error] [client 192.168.1.11] File does not exist: /var/www/Release01x00/core/pub/QMS/ProcedureSysarch000, referer: http://merlin.lavrsen.dk/foswiki10/bin/view/QMS/ProcedureSysarch000

The last file does not exist is because no drawing has been made. This is unrelated.

-- KennethLavrsen - 16 Mar 2009

After a good sleep some more information. Besides the warnings in the error log and the crashing when turning on asserts (developer mode) the problem for the end user is that the Edit button for the edit table is not correctly visible. You get a small empty button.

But when you click it all is OK. You are taken to the included topic and end up in edit mode there. This is all OK. This is as it always worked. If you include a topic with an EDITTABLE and you edit the table from the parent you are taken to the included topic and editing the table there. I have no illusions about changing that. So all we need to figure out is how to get the warnings silenced and the edit button shown correctly from the parent.

-- KennethLavrsen - 17 Mar 2009

One more important information. The fact that the EDITTABLE tag uses the include parameter is not the problem.

If I change the EDITTABLE tag to a normal one in the included topic the error is still there.

The problem is simply the handling of a topic including another topic that contains an EDITTABLE tag. The view from the parent should be a normal table with an edit button in plain view. The minute you click the edit button you must be taken to the child where the actual editing takes place. And when you are saving you stay in the child and have to find your way back.

-- KennethLavrsen - 17 Mar 2009

Problem seems to be that for an EDITTABLE in an included topic the beforeCommonTagsHandler is never called which means that a lot of variables defined in the ETP init function are never called and this results in an endless row of undefined variables all over the code.

-- KennethLavrsen - 17 Mar 2009

My fix was fix + big hack. I have tested a lot and it works great. Additionally I found a little less hacky way which I will check in.

-- KennethLavrsen - 17 Mar 2009

I have added a unit test with this case. And renamed reinit to initIncludedTopic.

-- ArthurClemens - 17 Mar 2009

ItemTemplate edit

Summary EditTablePlugin has problems with included topics with included edittable definition
ReportedBy KennethLavrsen
Codebase 1.0.0 beta3
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component EditTablePlugin
Priority Urgent
CurrentState Closed
WaitingFor KennethLavrsen
Checkins distro:f4dc75302471 distro:42a2c751deb2 distro:adb98e288646 distro:8ff9fb1baf39 distro:cde441f0f0ac distro:42ca632fce64 distro:bb503e4a79ac
TargetRelease patch
ReleasedIn 1.0.4
I Attachment Action Size Date Who Comment
ProcedureSysarch000.txttxt ProcedureSysarch000.txt manage 4 K 16 Mar 2009 - 23:28 KennethLavrsen  
ProcedureSysarch000Comments.txttxt ProcedureSysarch000Comments.txt manage 395 bytes 16 Mar 2009 - 23:29 KennethLavrsen  
QmsCommentTable.txttxt QmsCommentTable.txt manage 344 bytes 16 Mar 2009 - 23:39 KennethLavrsen  
Topic revision: r13 - 19 Mar 2009, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy