Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6931128

(spec) File attribute tests fail when run as root.

XMLWordPrintable

    • b55
    • generic, x86, sparc
    • generic, solaris, solaris_9, windows
    • Verified

        Tests:

        java_io/File/FileAttributes/FATest4
        java_io/File/FileAttributes/FATest6

        check for the inability to read/write files that have read/write permissions turned off. However if running the test as the root user these tests fail because root can read/write regardless of permission bits.

        The tests should check for being run by root and simply report success in that case.
        One more test has same problem:
        java_nio/file/TestDelete01
        These also seem to have similar issues:

           api/java_io/File/descriptions_setPermissions
           api/java_io/File/index_FilePermissions

        Edited to add: these are JCK tests so not in the same category as the original tests
        JCK tests mentioned above fails on solaris and linux on 6.0 fcs, on jdk7, etc.

        Tests are absolutely correct according to evaluation from Arkadiy Sutchilin, so it seems that this is java RI defect. Redispatching CR to Java product.

        To reproduce the jck failure, install jdk and jck of corresponding versions. Then use this simple script, after modifying path to java and jck:
        #!/bin/bash

        cat /etc/*ele*

        whoami

        /export/jdk/jdk1.6.0/bin/java -showversion -cp "/set/stt/jck_promotions/6b/latest/binaries/JCK-runtime-6b/classes" javasoft.sqe.tests.api.java.io.File.setPermissionsTests -TestCaseID ALL -TestURL file:////set/stt/jck_promotions/6b/latest/binaries/JCK-runtime-6b/tests/api/java_io/File/descriptions.html -TestWorkDirURL file:///export/JCK

        /export/jdk/jdk1.6.0/bin/java -showversion -cp "/set/stt/jck_promotions/6b/latest/binaries/JCK-runtime-6b/classes" javasoft.sqe.tests.api.java.io.File.FilePermissionsTests -TestCaseID ALL -TestURL file:////set/stt/jck_promotions/6b/latest/binaries/JCK-runtime-6b/tests/api/java_io/File/index.html -TestWorkDirURL file:///export/JCK

        The output:

                           Oracle Solaris 10 9/10 s10s_u9wos_14a SPARC
             Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
                                    Assembled 11 August 2010
        root
        java version "1.6.0"
        Java(TM) SE Runtime Environment (build 1.6.0-b105)
        Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

        File0061: Failed. setReadOnly operation succeed but canWrite method returns true
        File0062: Passed. OKAY.
        File0063: Failed. Readonly file was modified
        File0064: Passed. OKAY.
        File0065: Passed. OKAY
        File0066: Passed. OKAY
        File0067: Passed. OKAY
        File0069: Passed. OKAY
        File0070: Passed. OKAY
        STATUS:Failed.test cases: 9; passed: 7; failed: 2; first test case failure: File0061
        java version "1.6.0"
        Java(TM) SE Runtime Environment (build 1.6.0-b105)
        Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

        executable0001: Failed. canExecute() does not correspond to setExecutable()
        executable0002: Passed. OKAY.
        executable0003: Failed. canExecute() does not correspond to setExecutable()
        executable0004: Passed. OKAY.
        executable0005: Passed. OKAY.
        executable0006: Passed. OKAY.
        readable0001: Failed. canRead() does not correspond to setReadable()
        readable0002: Passed. OKAY.
        readable0003: Failed. canRead() does not correspond to setReadable()
        readable0004: Passed. OKAY.
        readable0005: Passed. OKAY.
        readable0006: Passed. OKAY.
        writable0001: Failed. setWritable() doesn't work properly
        writable0002: Passed. OKAY.
        writable0003: Failed. setWritable() doesn't work properly
        writable0004: Passed. OKAY.
        writable0005: Passed. OKAY.
        writable0006: Passed. OKAY.
        canExecute() returned incorrect value: true, expected: false
        canExecute() returned incorrect value: true, expected: false, ownerOnly: true
        canExecute() returned incorrect value: true, expected: false, ownerOnly: false
        canRead() returned incorrect value: true, expected: false
        canRead() returned incorrect value: true, expected: false, ownerOnly: true
        canRead() returned incorrect value: true, expected: false, ownerOnly: false
        canWrite() returned incorrect value: true, expected: false
        canWrite() returned incorrect value: true, expected: false, ownerOnly: true
        canWrite() returned incorrect value: true, expected: false, ownerOnly: false
        STATUS:Failed.test cases: 18; passed: 12; failed: 6; first test case failure: executable0001

              robm Robert Mckenna
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: