metomi/fcm

Problem unzipping ctx files using filesystem ACLs

MartinDix opened this issue · 1 comments

We use filesystem access control lists to make prebuilds usable across a user group.

However when a member of this group tries to use the prebuild, it fails when trying to uncompress the ctx file. E.g.

[FAIL] /g/data/access/prebuilds/vn10.3_GA7/fcm_make_nci_um_safe_omp/.fcm-make2/ctx.gz: cannot retrieve cache
[FAIL] Inappropriate ioctl for device at /projects/access/apps/fcm/2015.10.0/bin/../lib/FCM/System/Make/Share/Dest.pm line 105, <$handle> line 6.

I haven't dug into the perl library but perhaps the gunzip function is using the simple -r test for readability that was the issue in #127?

Opening the file in the fcm code and passing a file handle to gunzip works

diff --git a/lib/FCM/System/Make/Share/Dest.pm b/lib/FCM/System/Make/Share/Dest.pm
index dd0fdab..fb634ba 100644
--- a/lib/FCM/System/Make/Share/Dest.pm
+++ b/lib/FCM/System/Make/Share/Dest.pm
@@ -102,7 +102,9 @@ sub _ctx_load {
     }
     my $old_m_ctx = eval {
         my $handle = IO::File->new_tmpfile();
-        gunzip($path, $handle) || die($!);
+       # Open the file here to work around ACL problems
+       my $path_handle = new IO::File $path || die("Cannot open cache file $path\n");
+        gunzip($path_handle, $handle) || die($!);
         $handle->seek(0, 0);
         fd_retrieve($handle);
     };

@MartinDix Thanks for patch. Given that you have done the work already, do you want to raise a pull request for this change? (Otherwise I am happy to raise a pull request with this change.)