Bug 12800

Summary: Can't access MARC bibliographic frameworks and other pages
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: Architecture, internals, and plumbingAssignee: Robin Sheat <robin>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: abl, gmcharlt, robin, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 11842    
Bug Blocks: 13431    
Attachments: Bug 12800: running unit tests that use Koha::Cache breaks cache usage from Apache
Bug 12800: running unit tests that use Koha::Cache breaks cache usage from Apache
[PASSED QA] Bug 12800: running unit tests that use Koha::Cache breaks cache usage from Apache

Description Katrin Fischer 2014-08-21 07:34:05 UTC
When trying to access Administration > MARC bilbiographic frameworks, following perl error message is shown:

Open of share file /tmp/sharefile-koha-koha failed: Permission denied at /usr/lib/perl5/Cache/FastMmap.pm line 640.

It seems to be related to the changes done for bug 11842. Without the patch I can access the page without problem.
Comment 1 Katrin Fischer 2014-08-21 07:36:00 UTC
Same happens when you try to access the Koha to MARC mapping page.
Comment 2 Katrin Fischer 2014-08-21 07:40:33 UTC
... or the catalog detail page?
Comment 3 Katrin Fischer 2014-08-21 08:08:41 UTC
Ok, this seems a bit specific to my installation - downgrading severity.

With help of Jonathan we tried following, both fixed the problem:
- removing libcache-fastmmap-perl
- also, reinstalling the module and deleting /tmp/sharefile-koha-*
Comment 4 Katrin Fischer 2014-08-21 09:19:06 UTC
The problem reoccured with the module installed and after having deleted the /tmp files. This time I couldn't run a unit test file and the error message was shown.
Comment 5 Tomás Cohen Arazi 2014-08-21 18:59:54 UTC Comment hidden (obsolete)
Comment 6 Chris Cormack 2014-08-22 00:25:12 UTC Comment hidden (obsolete)
Comment 7 Kyle M Hall 2014-08-22 15:20:46 UTC
Created attachment 31101 [details] [review]
[PASSED QA] Bug 12800: running unit tests that use Koha::Cache breaks cache usage from Apache

If the user runs:

 $ prove t/Cache.t

with it's system user, two situations can happen:

1) If MEMCACHED_NAMESPACE is set on koha-httpd.xml other than the default 'koha', then
 Apache sets /tmp/sharefile-koha-<namespace> and the problem is not present: running
 the test creates /tmp/sharefile-koha-koha != /tmp/sharefile-koha-<namespace>
=> SUCCESS: no problem

2) If MEMCACHED_NAMESPACE is not set (or eq 'koha'), then there is a permission problem
either running the unit tests, or when using any funcitonality on the UI that needs
Koha::Cache.
Explanation: the one that is run first will set the /tmp/sharefile-koha-koha ownership
so it will be either the dev's sys user, or www-data (or whatever apache is using).

This patch sets a namespace for the unit tests, so there is no collision.

To test:
- On your dev setup, having MEMCACHED_NAMESPACE unset on koha-httpd.conf
- Edit a marc framework. If it fails, remove /tmp/sharefile-koha-koha, and try again
  -> fixed. Now try running
  $ prove t/Cache.t
=> FAIL: test fails because of permission problem
- Apply the patch
- Re-run the test
=> SUCCESS: test passes
Try changing the order, etc.

The temporary file that is used is deleted after the tests are run.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Tomás Cohen Arazi 2014-08-24 16:31:39 UTC
Patch pushed to master.