update tuf-repo-init.sh: Remove ununused signing_config.v0.2.json files#134
update tuf-repo-init.sh: Remove ununused signing_config.v0.2.json files#134
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR extends the tuf-repo-init.sh script by adding a new cleanup step that locates and deletes all but the most recent signing_config.v0.2.json files in the targets directory. Flow diagram for the new cleanup step in tuf-repo-init.shflowchart TD
A["Start cleanup step"] --> B["Find all *.signing_config.v0.2.json files in ${OUTDIR}/targets"]
B --> C["Sort files by modification time (descending)"]
C --> D["Keep the most recent file"]
D --> E["Delete all other *.signing_config.v0.2.json files"]
E --> F["Continue with script"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR Compliance Guide 🔍(Compliance updated until commit cf852c6)Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label Previous compliance checksCompliance check up to commit c95a0b4
|
|||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `rhtas/tuf-repo-init.sh:316` </location>
<code_context>
rm -- "$file"
done
+# Remove ununused signing_config.v0.2.json files from ${OUTDIR}/targets
+mapfile -t files_to_delete < <(find "${OUTDIR}/targets/" -type f -name "*.signing_config.v0.2.json" -print0 | xargs -0 ls -t | tail -n +2)
+for file in "${files_to_delete[@]}"; do
</code_context>
<issue_to_address>
**nitpick (typo):** Typo in comment: 'ununused' should be 'unused'.
Please update the comment to fix the typo.
```suggestion
# Remove unused signing_config.v0.2.json files from ${OUTDIR}/targets
```
</issue_to_address>
### Comment 2
<location> `rhtas/tuf-repo-init.sh:317` </location>
<code_context>
done
+# Remove ununused signing_config.v0.2.json files from ${OUTDIR}/targets
+mapfile -t files_to_delete < <(find "${OUTDIR}/targets/" -type f -name "*.signing_config.v0.2.json" -print0 | xargs -0 ls -t | tail -n +2)
+for file in "${files_to_delete[@]}"; do
+ rm -- "$file"
</code_context>
<issue_to_address>
**issue (bug_risk):** Potential issue with file deletion logic if filenames contain newlines or special characters.
Piping filenames to 'ls -t' and 'tail' can cause issues with newlines or special characters. Consider using 'find' with 'sort' and '-print0', or handle the list in bash to avoid parsing errors.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| done | ||
|
|
||
| # Remove ununused signing_config.v0.2.json files from ${OUTDIR}/targets | ||
| mapfile -t files_to_delete < <(find "${OUTDIR}/targets/" -type f -name "*.signing_config.v0.2.json" -print0 | xargs -0 ls -t | tail -n +2) |
There was a problem hiding this comment.
issue (bug_risk): Potential issue with file deletion logic if filenames contain newlines or special characters.
Piping filenames to 'ls -t' and 'tail' can cause issues with newlines or special characters. Consider using 'find' with 'sort' and '-print0', or handle the list in bash to avoid parsing errors.
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
Summary by Sourcery
Enhancements: