jnr / jnr-posix

Java Posix layer
Other
241 stars 91 forks source link

File system failures on Linux PPC #146

Closed headius closed 4 years ago

headius commented 4 years ago

In #144 we fixed some PPC compatibility issues, but two failures still remain for the reporter @sarveshtamba:

readlinkPointerTest(jnr.posix.FileTest)  Time elapsed: 0.013 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:</tmp/jnr-p[?six-r??dl?nk-t?]st470986432865872718...> but was:</tmp/jnr-p[?six-r??dl?nk-t?]st470986432865872718...>
        at org.junit.Assert.assertEquals(Assert.java:115)
        at org.junit.Assert.assertEquals(Assert.java:144)
        at jnr.posix.FileTest.readlinkPointerTest(FileTest.java:580)

accessTest(jnr.posix.FileTest)  Time elapsed: 0.003 sec  <<< FAILURE!
java.lang.AssertionError: access:  expected:<-1> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.failNotEquals(Assert.java:743)
        at org.junit.Assert.assertEquals(Assert.java:118)
        at org.junit.Assert.assertEquals(Assert.java:555)
        at jnr.posix.FileTest.accessTest(FileTest.java:508)

Results :

Failed tests:
  FileTest.accessTest:508 access:  expected:<-1> but was:<0>
  FileTest.readlinkPointerTest:580 expected:</tmp/jnr-p[?six-r??dl?nk-t?]st470986432865872718...> but was:</tmp/jnr-p[?six-r??dl?nk-t?]st470986432865872718...>

Tests run: 93, Failures: 2, Errors: 0, Skipped: 1

I cannot reproduce these failures on my Power8 Linux environment so they may be specific to @sarveshtamba's setup.

headius commented 4 years ago

@sarveshtamba Could you give us more information about your environment? What flavor of Linux, what filesystem, etc.

sarveshtamba commented 4 years ago

@headius here are the details:-

Linux Flavour:- Red Hat Enterprise Linux Server release 7.7 (Maipo) Arch:- ppc64le Filesystem details:-

sh-4.2# df -Th
Filesystem            Type     Size  Used Avail Use% Mounted on
overlay               overlay  170G  130G   41G  77% /
tmpfs                 tmpfs     16G     0   16G   0% /dev
tmpfs                 tmpfs     16G     0   16G   0% /sys/fs/cgroup
/dev/mapper/rhel-root xfs      170G  130G   41G  77% /logs
shm                   tmpfs     64M     0   64M   0% /dev/shm
tmpfs                 tmpfs     16G     0   16G   0% /proc/scsi
tmpfs                 tmpfs     16G     0   16G   0% /sys/firmware

Latest failures on ppc64le with a clean repo clone and build:- v3.0.55:-

Running jnr.posix.util.DefaultPOSIXHandlerTest
Tests run: 32, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.26 sec <<< FAILURE! - in jnr.posix.FileTest
accessTest(jnr.posix.FileTest)  Time elapsed: 0.01 sec  <<< FAILURE!
java.lang.AssertionError: access:  expected:<-1> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.failNotEquals(Assert.java:743)
        at org.junit.Assert.assertEquals(Assert.java:118)
        at org.junit.Assert.assertEquals(Assert.java:555)
        at jnr.posix.FileTest.accessTest(FileTest.java:508)

master:-

Running jnr.posix.IOTest
Tests run: 32, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.4 sec <<< FAILURE! - in jnr.posix.FileTest
accessTest(jnr.posix.FileTest)  Time elapsed: 0.034 sec  <<< FAILURE!
java.lang.AssertionError: access:  expected:<-1> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.failNotEquals(Assert.java:743)
        at org.junit.Assert.assertEquals(Assert.java:118)
        at org.junit.Assert.assertEquals(Assert.java:555)
        at jnr.posix.FileTest.accessTest(FileTest.java:508)

Let me know if you need any further details.

headius commented 4 years ago

@sarveshtamba I suspect this may be due to increased security measures in RHEL. I will try to bring up an instance today and see if I can reproduce.

sarveshtamba commented 4 years ago

Hi @headius , any luck on spinning a RHEL ppc64le instance and checking the failures?

headius commented 4 years ago

@sarveshtamba Unfortunately not; the PPC64 environment I have does not support RHEL, and the RHEL environments I have access to do not support PPC64.

Perhaps you could try playing with TEMP env vars and pointing it at a known read/write/execute path, like something under a user location? I know some variants of Linux (perhaps including RHEL) tightly lock down the global temp location.

headius commented 4 years ago

@sarveshtamba Related to my suggestion above... perhaps you can try re-running after my upcoming commit, which will show the full path to the files in question. It might give us a clue as to why your filesystem behaves differently.

Looking deeper at the tests that actually fail...

The access test in FileTest:508 seems very simple: chmod 0400 and try to access the file for write. It should produce a -1 return value but returns 0 (ok to write). Clearly something's odd here. Filesystem doesn't support permissions? I will add more checks and logging here.

The readlink failure is more complicated. The test creates a temp file, links to it, and then uses readlink to get the filename again. It seems like it works ok and the filenames almost match, but the test fails and whatever didn't match is cropped off. I'd recommend adding some logging here so we can see why the filenames differ.

Sorry I can't be of more help but without being able to reproduce these issues we'll have to work together. 😀

sarveshtamba commented 4 years ago

@headius I was able to successfully build the latest clean master and v3.0.55 repos, using a non-root user instead of root user earlier. Can you please confirm this at your end?

master:-

[INFO] Building jar: /home/sar/jnr-posix-master/target/jnr-posix-3.0.56-SNAPSHOT-javadoc.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ jnr-posix ---
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom (2.5 kB at 167 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom (1.1 kB at 81 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom (5.0 kB at 383 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar (12 kB at 383 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar (230 kB at 5.1 MB/s)
[INFO] Installing /home/sar/jnr-posix-master/target/jnr-posix-3.0.56-SNAPSHOT.jar to /home/sar/.m2/repository/com/github/jnr/jnr-posix/3.0.56-SNAPSHOT/jnr-posix-3.0.56-SNAPSHOT.jar
[INFO] Installing /home/sar/jnr-posix-master/pom.xml to /home/sar/.m2/repository/com/github/jnr/jnr-posix/3.0.56-SNAPSHOT/jnr-posix-3.0.56-SNAPSHOT.pom
[INFO] Installing /home/sar/jnr-posix-master/target/jnr-posix-3.0.56-SNAPSHOT-sources.jar to /home/sar/.m2/repository/com/github/jnr/jnr-posix/3.0.56-SNAPSHOT/jnr-posix-3.0.56-SNAPSHOT-sources.jar
[INFO] Installing /home/sar/jnr-posix-master/target/jnr-posix-3.0.56-SNAPSHOT-javadoc.jar to /home/sar/.m2/repository/com/github/jnr/jnr-posix/3.0.56-SNAPSHOT/jnr-posix-3.0.56-SNAPSHOT-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  47.662 s
[INFO] Finished at: 2020-05-04T06:25:48Z
[INFO] ------------------------------------------------------------------------

3.0.55:-

[INFO] Building jar: /home/sar/jnr-posix-3.0.55/target/jnr-posix-3.0.55-javadoc.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ jnr-posix ---
[INFO] Installing /home/sar/jnr-posix-3.0.55/target/jnr-posix-3.0.55.jar to /home/sar/.m2/repository/com/github/jnr/jnr-posix/3.0.55/jnr-posix-3.0.55.jar
[INFO] Installing /home/sar/jnr-posix-3.0.55/pom.xml to /home/sar/.m2/repository/com/github/jnr/jnr-posix/3.0.55/jnr-posix-3.0.55.pom
[INFO] Installing /home/sar/jnr-posix-3.0.55/target/jnr-posix-3.0.55-sources.jar to /home/sar/.m2/repository/com/github/jnr/jnr-posix/3.0.55/jnr-posix-3.0.55-sources.jar
[INFO] Installing /home/sar/jnr-posix-3.0.55/target/jnr-posix-3.0.55-javadoc.jar to /home/sar/.m2/repository/com/github/jnr/jnr-posix/3.0.55/jnr-posix-3.0.55-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  38.042 s
[INFO] Finished at: 2020-05-04T06:28:36Z
[INFO] ------------------------------------------------------------------------
sarveshtamba commented 4 years ago

@headius any updates for me on this? Did you manage to try the above at your end?

headius commented 4 years ago

@sarveshtamba Aha, root user! That makes a lot of sense!

The root user will never fail these tests, since regardless of the access flags all files will be accessible. Since switching to a non-root user fixes the failures for you, I think we can call this "not a bug".