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

unzip step doesn't set permissions on extracted files

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins 2.107.3
      Pipeline Utility Steps 2.1.0

      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).

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

              Created:
              Updated: