Download & Extend

new directories created as read only on windows

Project:fastpath_fscache
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:sinasalek
Status:needs review

Issue Summary

It's not working for me.I'm getting following errors.

Warning: fread() [function.fread]: Length parameter must be greater than 0 in D:\Install\C\xampp\htdocs\news\sites\all\modules\fastpath_fscache\cache.fs.inc on line 64

Warning: Cannot modify header information - headers already sent by (output started at D:\Install\C\xampp\htdocs\news\sites\all\modules\fastpath_fscache\cache.fs.inc:64) in D:\Install\C\xampp\htdocs\news\includes\bootstrap.inc on line 531

Warning: Cannot modify header information - headers already sent by (output started at D:\Install\C\xampp\htdocs\news\sites\all\modules\fastpath_fscache\cache.fs.inc:64) in D:\Install\C\xampp\htdocs\news\includes\bootstrap.inc on line 532


# warning: unlink(/tmp/cache/8/87cd8b8808600624d8c590cfc2e6e94b) [function.unlink]: Permission denied in D:\Install\C\xampp\htdocs\news\sites\all\modules\fastpath_fscache\cache.fs.inc on line 216.
# warning: unlink(/tmp/cache/8/87cd8b8808600624d8c590cfc2e6e94b) [function.unlink]: Permission denied in D:\Install\C\xampp\htdocs\news\sites\all\modules\fastpath_fscache\cache.fs.inc on line 216.

--
Sharique

Comments

#1

Category:bug report» support request

Looking at your errors, I'm guessing you've set up the paths incorrectly in settings.php. The paths suggested by the module (ie /tmp) are appropriate for Unix servers, but you appear to be using Windows... Fix that path to point to a real directory for which you have write permissions and try again. You probably need to use something like 'c:\\windows\\temp' or 'c:\\winnt\\temp'.

#2

I have fixed path settings but stillI'm getting errors

# warning: unlink(D:\Install\C\xampp\htdocs\news\files\cache\/cache/8/87cd8b8808600624d8c590cfc2e6e94b) [function.unlink]: Permission denied in D:\Install\C\xampp\htdocs\news\sites\all\modules\fastpath_fscache\cache.fs.inc on line 216.
# warning: unlink(D:\Install\C\xampp\htdocs\news\files\cache\/cache/8/87cd8b8808600624d8c590cfc2e6e94b) [function.unlink]: Permission denied in D:\Install\C\xampp\htdocs\news\sites\all\modules\fastpath_fscache\cache.fs.inc on line 216

#3

Title:few bugs» support - path problems
Status:active» fixed

you need to give your web server permssion to the file dir. the errors you post say 'access denied'. you will have to google to understand hown to do so if you don't already know.

#4

I found the bug, I think.
Every time it read/write cache folder, it changes the permission to read only.
I have checked it 2-3 times.
--
Sharique

#5

Title:support - path problems» new directories created as read only on windows
Status:fixed» active

#6

Perhaps this is caused by files defaulting to read only on Windows and the undeclared variable problem: http://drupal.org/node/207712 ?

#7

I played with it for a while to find a workaround, i tried to change files and permissions with chmod and by hand, but it didn't solve. so i'm agree with @greggles , i may come up with a solution later.

#8

Assigned to:Anonymous» sinasalek

:) I finally fixed it by using command line instead of unlink function in windows. please have a look at the patch

AttachmentSize
windows server unlink issue.patch 1.48 KB

#9

fread warning and another bug fixed

AttachmentSize
windows fix.patch 1.89 KB

#10

I *think* I have this working in IIS 6 on Server 2003, however I had to remove the test in:

<?php
function cache_delete_file($file) {
if (
$_SERVER['WINDIR'] || $_SERVER['windir']) {
 
$file=realpath($file);
  return
system("del $file");
} else {
  return
unlink($file);
}
exit;
}
?>

so that it reads:

<?php
function cache_delete_file($file) {
$file=realpath($file);
return
system("del $file");
exit;
}
?>

#11

I have tried both codes, while every thing else works fine, I get the output from the system command in the delete function.
It prints out the value of the $file variable.
Any thoughts on this issue, I am stuck.
U can check the issues list for detailed output i am getting.

#12

Fixed in 6.x version: #375293: Drupal 6.x
You can backport it.

#13

Status:active» needs review

Basically:
1.
Fixed code for fread() bug:

<?php
 
if (file_exists($cache_file)) {   
    if (
$fp = fopen($cache_file, 'r')) {
     
$filesize = filesize($cache_file);
      if (
$filesize > 0 && flock($fp, LOCK_SH)) {
       
$data = fread($fp, $filesize);
       
flock($fp, LOCK_UN);
       
$cache = unserialize($data);
      }
     
fclose($fp);
    }
  }
?>

2. Fixed code for unlink() bug:

<?php
    $file
= realpath(cache_filename($cid, $table));
    if (
$fp = fopen($file, 'w')) {
     
// only delete the cache file once we obtain an exclusive lock to prevent
      // deleting a cache file that is currently being read.
     
if (flock($fp, LOCK_EX)) {
        unset(
$fp); // free handle before delete
       
unlink($file); // delete useless cache file
     
}
    }
?>

You can't remove file if you haven't free the file handle.

I don't have any diff on my win machine, so please test it and create some patches or download 6.x version.

#14

Please test following patch.

AttachmentSize
fastpath_fscache.patch 965 bytes
nobody click here