Issue Type: Bug Created: 2008-06-23T13:11:50.000+0000 Last Updated: 2008-09-02T10:39:44.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)
Reporter: Kishore Kamati (kishore) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Search_Lucene
Related issues: - ZF-2779
When I try to re-create the index, I get this error. Let me know what to do? I'm using ZendFramework-1.0.3.
PHP Fatal error: Uncaught exception 'Zend_Search_Lucene_Exception' with message 'chmod(): Operation not permitted' in ~/Zend/Search/Lucene/Storage/Directory/Filesystem.php:189 Stack trace:
thrown in Zend/Search/Lucene/Storage/Directory/Filesystem.php on line 189
I actually wrote a php script to create index, which is being called by a cron file.
I will appreciate if someone gives me a solution.
Posted by Matthew Ratzloff (mratzloff) on 2008-07-07T15:08:50.000+0000
The problem is that it is using chmod() instead of umask(), which is probably a bad thing for a library to do. This is bad when the owner of the file is not the server user (e.g., publisher:apache or publisher:www) but you do not want to give the user (in this example, publisher) sudo rights so that it can change ownership to apache:apache.
What this should do is umask() in Zend_Search_Lucene_Storage_File_Filesystem prior to the fopen() call (which is passed w+b to create the file if it does not exist). The umask should be 0111 (for the default of 0666):
<pre class="highlight"> $previousUmask = umask(0111); ...fopen(...); umask($previousUmask);
The call to chmod() should be removed, or at least there should be a call to fileperms() first to see if the permissions are correct. By correct, I mean between 0660 and 0777. I'm not sure why the default is 0666.
Posted by Alexander Veremyev (alexander) on 2008-07-25T08:50:37.000+0000
PS Matthew, there was an idea to use umask, but it has problems in multi-threaded environment. See also discussion at [ZF-2779].
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:44.000+0000
Updating for the 1.6.0 release.
Have you found an issue?
See the Overview section for more details.