Dangling symlinks cause upload errors with wildcards in filespecs
Describe the bug
When attempting to upload via a filespec that includes a pattern with a wildcard, if the current directory or any child directories contain dangling symlinks the upload will fail. This is regardless of whether or not the dangling symlink matches the pattern.
Current behavior
[Debug] Usage Report: Sending info...
[Debug] Sending HTTP GET request to: .../artifactory/api/system/version
[Error] stat broken.symlink: no such file or directory
[Error] stat broken.symlink: no such file or directory
[Debug] Uploaded 0 artifacts.
[Error] stat broken.symlink: no such file or directory
[Debug] Artifactory response: 200 OK
[Debug] JFrog Artifactory version is: 7.63.10
[Debug] Sending HTTP POST request to: .../artifactory/api/system/usage
Reproduction steps
Create the following structure:
.
├── a-test.txt
├── broken.symlink -> a-file.txt
└── upload.filespec
upload.filespec:
{
"files": [
{
"pattern": "./*-test.txt",
"target": "generic-test/",
"props": "name=Test File"
}
]
}
Run jfrog rt u --spec=upload.filespec
Expected behavior
Upload the relevant file and ignore the irrelevant broken symlink.
JFrog CLI version
2.67.0
Operating system type and version
AlmaLinux 9.4
JFrog Artifactory version
No response
JFrog Xray version
No response
Hey. I'm experiencing the same issue. Do we have at least a workaround?
The only workarounds I've found are to either clean up your broken symlinks prior to trying the upload, or make use of the --symlinks arg, e.g. jfrog rt u --symlinks --spec=upload.filespec. Using --symlinks changes functionality as it now uploads the symlink and not the file the symlink was pointing to.
Thanks. I went with cleaning dangling symlinks before uploading.
For reference, here is the command I used: find . -xtype l -exec rm {} +.
ChatGPT breakdown:
find .- This initiates a search starting from the current directory (
.) and includes all subdirectories.
- This initiates a search starting from the current directory (
-xtype l- This option filters the search results to broken symbolic links.
- Broken symbolic links are links pointing to a file or directory that no longer exists.
-exec rm {} +- This executes the
rm(remove) command on each broken link found. {}is a placeholder thatfindreplaces with the file path of each broken link.+ensures multiple files are passed tormin a single command, improving efficiency by reducing the number of calls torm.
- This executes the
This is still happening on CLI version 2.72.5. It seems the issue was introduced in 2.60.0.
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
This issue was closed due to 7 days of inactivity after being marked as stale. Feel free to reopen it if it remains relevant.