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

unzip step doesn't set permissions on extracted files

    XMLWordPrintable

Details

    Description

      Run this pipeline:

      node() {
          // create an example ZIP file
          sh '''\
              base64 -d > test.zip << EOF
              UEsDBAoAAAAAAJ2SrkwAAAAAAAAAAAAAAAAIABwAdGVzdC5iaW5VVAkAA1qp+VpaqfladXgLAAEE
              6AMAAAToAwAAUEsBAh4DCgAAAAAAnZKuTAAAAAAAAAAAAAAAAAgAGAAAAAAAAAAAAP2BAAAAAHRl
              c3QuYmluVVQFAANaqfladXgLAAEE6AMAAAToAwAAUEsFBgAAAAABAAEATgAAAEIAAAAAAA==
              EOF'''.stripIndent()
          sh 'unzip -o test.zip && ls -l test.bin && rm test.bin'
          unzip zipFile: 'test.zip', quiet: true
          sh 'ls -l test.bin'
      }
      

      The (relevant) output is:

      + ls -l test.bin
      -rwxrwxr-x 1 jenkins jenkins 0 May 14 15:20 test.bin
      ...
      + ls -l test.bin
      -rw-r--r-- 1 jenkins jenkins 0 May 14 15:51 test.bin
      

      You can see that the native unzip program extracts the file with the permissions it actually has in the archive (775), while the unzip step extracts it with default permissions (644).

      Attachments

        Issue Links

          Activity

            rdonchen_intel Roman Donchenko created issue -
            miraha jang hyemi (Inactive) made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            kon Kalle Niemitalo made changes -
            Status In Progress [ 3 ] Open [ 1 ]
            kon Kalle Niemitalo made changes -
            Link This issue relates to JENKINS-53874 [ JENKINS-53874 ]

            People

              rsandell rsandell
              rdonchen_intel Roman Donchenko
              Votes:
              5 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: