-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
htsjdk.samtools.util.IOUtil.assertFileIsWritable on certain NFS environments fails to correctly assess permissions #1671
Comments
@jd-daniels This is tricky for me to debug because I don't have access to a similar system. It's strange that the reported file path is blank. ( I doubt it will fix this problem, but you might want to try upgrading your picard version since that one is pretty old. |
We are having this exact error. Was there ever a fix for it? |
Hi all, Our team is running into this error a well. Similar to @jd-daniels , we started to encounter issues when switching to rhel9 (with a modified permissions structure of some sort). The error reads:
I tried setting |
@michaeljmetzger @jd-daniels @lbergelson Not sure if you are still looking for an answer, but I tested out a fix that seems to be working. Here are the steps I took to make it work: the fix
diff --git a/src/main/java/htsjdk/samtools/util/IOUtil.java b/src/main/java/htsjdk/samtools/util/IOUtil.java
index 730506b2e..f8edf16f2 100644
--- a/src/main/java/htsjdk/samtools/util/IOUtil.java
+++ b/src/main/java/htsjdk/samtools/util/IOUtil.java
@@ -559,8 +559,14 @@ public class IOUtil {
"File does not exist and parent is not a directory.");
}
else if (!parent.canWrite()) {
- throw new SAMException("Cannot write file: " + file.getAbsolutePath() + ". " +
- "File does not exist and parent directory is not writable..");
+ System.err.println("Initial write method failed, trying alternative...");
+ try {
+ File tempFile = File.createTempFile(".writeTest", null, parent);
+ tempFile.delete();
+ } catch (IOException e) {
+ throw new SAMException("Cannot write file: " + file.getAbsolutePath() + ". " +
+ "File does not exist and parent directory is not writable..");
+ }
}
}
else if (file.isDirectory()) { Now you can follow the remaining steps from Picard's documentation to compile with a custom htsjdk version.
If everything worked, you should now have a What does this do?This performs a try-catch when the initial This tripped us up for awhile; I hope it works for you guys, let me know if you have questions / improvements! |
Description of the issue:
When calling assertFilesIsWritable through htsjdk.samtools, through Picard mark duplicates, we find that IOUtil.java fails to correctly assert writable on NFS file shares that have special backend permissions. This NFS location is on Dell Powerscale and has ACL permissions to allow for multi protocol access. The user can write to the parent directory.
Exception in thread "main" htsjdk.samtools.SAMException: Cannot write file: . File does not exist and parent directory is not writable..
at htsjdk.samtools.util.IOUtil.assertFileIsWritable(IOUtil.java:562)
at picard.sam.markduplicates.MarkDuplicates.doWork(MarkDuplicates.java:251)
at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:308)
at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:103)
at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:113)
Your environment:
version of htsjdk
2.24.1
version of java
Java 15.0.1
which OS
RHEL 9.1
5.14.0-162.6.1.el9_1.x86_64
Steps to reproduce
Run Picard mark duplicates on an NFS location that has multi protocol ACLs or probably any server side permission modifications like that.
There is probably a simpler test case using that specific htsjdk.samtools.util.IOUtil.assertFileIsWritable.
Expected behaviour
The directory is writable to the user, so it should not be telling us that it isn’t writable.
We use a lot of different software suites on this same NFS storage location that don’t seem to have an issue, so while a workaround is to use a NFS-only standard permission NFS share, it’s not ideal for many of our researchers..
Actual behaviour
The text was updated successfully, but these errors were encountered: