Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JFrog CLI stops, after finding existing write protected file in the same location #2652

Open
rimanov opened this issue Aug 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@rimanov
Copy link

rimanov commented Aug 13, 2024

Describe the bug

JFrog CLI stops, after finding existing write protected file in the same location instead of prompting for action (overwrite/skip) in interactive mode and allow us to globally set a decision when running in CI.

Current behavior

As it is now the CLI will give up and error out when it encounters such files which is causing issues for users. The expected behavior is for the CLI to prompt for action (overwrite/skip) in interactive mode and allow us to globally set a decision when running in CI.

Reproduction steps

-Create a workspace with a write protected file in it
-Upload the workspace as an archive to Artifactory twice using different include/exclude patterns, ensure the write protected file is in both uploads
-Download archive 1 to a folder using the "--flat" option and "--explode" option
-Download archive 2 to the same folder using the same options
-CLI will fail on extraction because it can't overwrite the write protected file

Expected behavior

The expected behavior is for the CLI to prompt for action (overwrite/skip) in interactive mode and allow us to globally set a decision when running in CI. Implementing an approach to just keep extracting an archive even when errors are encountered.

JFrog CLI version

2.53.1

Operating system type and version

linux/amd64

JFrog Artifactory version

7.71.8

JFrog Xray version

No response

@rimanov rimanov added the bug Something isn't working label Aug 13, 2024
@derekscp
Copy link

Steps to reproduce:

  1. mkdir -p TestArchive/writeprotectedfolder
  2. touch TestArchive/writeprotectedfolder/file1.txt
    touch TestArchive/writeprotectedfolder/file2.txt
  3. chmod -w TestArchive/writeprotectedfolder/
$ tree -p
[drwxr-xr-x]  .
└── [drwxr-xr-x]  TestArchive
    └── [dr-xr-xr-x]  writeprotectedfolder
        ├── [-rw-r--r--]  file1.txt
        └── [-rw-r--r--]  file2.txt

  1. tar -czvf test.tar.gz TestArchive/
  2. jf rt u test.tar.gz example-repo-local
  3. sudo rm TestArchive/writeprotectedfolder/file*
$ tree -p
[drwxr-xr-x]  .
└── [drwxr-xr-x]  TestArchive
    └── [dr-xr-xr-x]  writeprotectedfolder
  1. jf rt dl example-repo-local/test.tar.gz --explode=true --flat=true
    Logs:
[Debug] Usage Report: Sending info...
[Debug] Sending HTTP GET request to: http://<ART_URL>/artifactory/api/system/version
[Debug] Sending HTTP GET request to: http://<ART_URL>/artifactory/api/system/version
[Debug] Artifactory response: 200 OK
[Debug] JFrog Artifactory version is: 7.90.8
[Debug] Sending HTTP POST request to: http://<ART_URL>/artifactory/api/system/usage
[Debug] Artifactory response: 200 OK
[Debug] JFrog Artifactory version is: 7.90.8
[Info] Searching items to download...
[Debug] Searching Artifactory using AQL query:
 items.find({"$or":[{"$and":[{"repo":"example-repo-local","path":".","name":"test.tar.gz"}]}]}).include("name","repo","path","actual_md5","actual_sha1","sha256","size","type","modified","created","property")
[Debug] Sending HTTP POST request to: http://<ART_URL>/artifactory/api/search/aql
[Debug] Artifactory response: 200 OK
[Debug] Streaming data to file...
[Debug] Finished streaming data successfully.
[Info] [Thread 2] Downloading example-repo-local/test.tar.gz
[Debug] [Thread 2] File already exists locally.
[Info] [Thread 2] Extracting archive: /Users/derekp/Downloads/writetest/test.tar.gz to /Users/derekp/Downloads/writetest/
[Error] [Thread 2]  Received an error: reading file in tar archive: /Users/derekp/Downloads/writetest/TestArchive/writeprotectedfolder/file2.txt: creating new file: open /Users/derekp/Downloads/writetest/TestArchive/writeprotectedfolder/file2.txt: permission denied
[Error] reading file in tar archive: /Users/derekp/Downloads/writetest/TestArchive/writeprotectedfolder/file2.txt: creating new file: open /Users/derekp/Downloads/writetest/TestArchive/writeprotectedfolder/file2.txt: permission denied
[Error] reading file in tar archive: /Users/derekp/Downloads/writetest/TestArchive/writeprotectedfolder/file2.txt: creating new file: open /Users/derekp/Downloads/writetest/TestArchive/writeprotectedfolder/file2.txt: permission denied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants