One thing to note. When I set:
function osc_copy($source, $dest, $options = array('folderPermission' => 0755, 'filePermission' => 0644)) {
I can't install languages (and possibly other things) from the market. It creates dirs with 0644, which misses the exec permission to go inside the dir and the permission error is returned. But when I restored this to the original:
function osc_copy($source, $dest, $options = array('folderPermission' => 0755, 'filePermission' => 0755)) {
All files inside the language dirs have exec permission set.
So it looks like it can't determine whether the file is a regular file or whether it is a directory -- it treats both the same.