Problem: uploading an image to Bricolage would produce the following error:
fileparse(): need a valid pathname at /usr/local/lib/perl5/site_perl/5.8.6/Bric/Util/Trans/FS.pm line 864
Trying to find the cause/solution: (some steps may have been ommited/forgotten)
- tried with a different filename
- tried with a different filetype
- tried with an image that had worked before (system was migrated)
- tried with a different browser
- tried from different machines
- even checked on the files permissions
I went to the filesystem of the machine running Bricolage:
- checked for permissions
- checked for diskspace
- tried finding the place where the images would be placed (and there they were, but empty (0 bytes))
- checked the error log (nothing interesting there, but it turns out I had misread the log; more later)
- checked if the database was up
Meanwhile:
None of this had helped so far
I went to the code:
- found the module causing the error
- edited it so to understand what was causing the error (turns out the filename was being passed without any value to File::Basename::basename; a bit of hardcoding showed that there would be problems later on anyway)
- found out which module was calling the function with a "die caller" on the line causing the error
- edited that module (Bric::App::Callback::Profile::Media)
- found the line calling the function that would die
- debugged just to be sure there wasn't any filename (and there wasn't, $upload->filename was empty)
- used Data::Dumper (and die) to check on $upload and $fh (the result of $upload->fh); turns out, $fh was undef (interesting, uh?); $upload is an Apache::Upload object
- died with $upload->size just to check its value... it was 0
And then I went out to lunch; on the way to the restaurant, it hit me: there was probably an area missing; the filename was getting there, because it was being written as an empty file; its contents, however, were not; one possibility would be a missing directory or something in an intermediate area.
Of course that... searching for something that is missing isn't quite the easiest thing to do, right? This didn't work.
Round 2:
- checked the error logs again, and indeed there were problems writing the files (permission denied), but where?
- checked for the configuration files, to search the temp directories for the upload stuff; no problems found there...
Time for some new tactics:
- tried cleaning the cache; didn't work
- next step: update Bricolage; didn't work either
- reinstalled libapreq; problem persists
And that's where I am right now. Others have tried to help, but no one managed to come up with a solution so far... Ideas are welcome.
We're still trying different approaches, but I'm not sure...
What I think is that there's a temporary directory somewhere without permissions... I already checked the configuration, and TEMP_DIR is set to be /tmp, which has all the permissions she needs...