Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66739

hudson.FilePath returns invalid octal permissions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • core
    • None
    • Running Jenkins in a container using jenkins/jenkins:lts with image id 5d1103b93f92 the version displayed in jenkins is Jenkins 2.289.1

      I have a shared library class for working with files, it uses hudson.FilePath for most of its operations. When trying to get the permissions for /bin/ls using FilePath.mode() is returning 493. 9 being an invalid number I think.

      When getting the permission using sh('ls -la /bin/ls') the returned value is
      -rwxr-xr-x 1 root root 130736 Feb 22 2017 /bin/ls
      Which I'm pretty sure is 755.

      I'm not exactly sure what is going on, I tried on another file in my workspace and not 420 when I was expecting 644.

      Here is the code I'm using to test.

      static void test() {
          FilePath lsPath = new FilePath(null, '/bin/ls')
          Build build = new Build()
          Object wfs = build.getWorkFlowScript()
          wfs.println lsPath.mode()
      }
      

       
      I took a look in the code for FilePath and traced the code to here. But I don't have any real experience debugging Java or Jenkins and I'm not really sure how to continue.

       

            Unassigned Unassigned
            shadycuz Levi Blaney
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: