jfrog-cli icon indicating copy to clipboard operation
jfrog-cli copied to clipboard

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

Open rimanov opened this issue 1 year ago • 2 comments

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 avatar Aug 13 '24 16:08 rimanov

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

derekscp avatar Sep 11 '24 20:09 derekscp

This is not a bug and more of a feature request. So putting this into the backlog for prioritization.

shuvadipc avatar Mar 03 '25 06:03 shuvadipc

This issue has been marked as stale due to 6 months of inactivity. As part of our effort to address every issue properly, please feel free to remove the stale label or keep this issue active by leaving a comment. Otherwise, it will be closed in 7 days

github-actions[bot] avatar Sep 24 '25 09:09 github-actions[bot]

This issue was closed due to 7 days of inactivity after being marked as stale. Feel free to reopen it if it remains relevant.

github-actions[bot] avatar Oct 06 '25 00:10 github-actions[bot]