Fix install_apt_sources failure detection#342
Conversation
📝 WalkthroughWalkthroughThe PR refactors how ChangesExit code refactoring in APT source installation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tools/libs/manage_apps.sh`:
- Around line 115-124: The branch in install_apt_sources currently returns 1 on
successful curl downloads and 0 on fallback, which is inverted; change it so
successful download returns 0 and the fallback/compile path returns non-zero
(e.g., 1), and update any callers (like install_apps) that rely on that return
so they invert their conditional or use the function directly in an if/then to
follow shell conventions; specifically, flip the return values in the curl
success/else block (referencing apt_source and key_path) and adjust
install_apps' logic to treat a 0 return as success and non-zero as failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0815b7ef-0a4e-49ea-943c-465a399611de
📒 Files selected for processing (1)
tools/libs/manage_apps.sh
|
Thanks for the PR, but there are a few things about this PR that should be checked before merging:
Sry, but I don't really understand that message 🙈 But I would like to stay consistent in the whole repo and we use the If you like, you could apply the above mentioned change and create a second PR that refactors this whole echo style into proper returns. |
a36b2f1 to
b9a7374
Compare
|
Thanks for the quick review. I've pushed an updated version keeping prior style. I've confirmed the fix to be working locally. Let me know if I missed anything. |
|
I saw your addition of I think a most user would not even know what spyglass and camera-streamer are, so it might be unnecessary more text? |
|
I felt it was useful for me as in my upgrade path from v4 I'd been using camera-streamer which now no longer was available nor was there an easy way to install it. But I'm just an average end user. I can leave it out if you feel it's better. (I've since learned about spyglass and found it to be an easier alternative to run so my own use case has been addressed separately) |
|
I'm wondering about your setup now:
and
Is this a PiOS or something different? |
|
To be honest, I don't recall how I'd set it up originally, likely a vanilla debian + raspi test release install from official raspberry pi images? I've compared it with other systems I run testing (also rpi) or unstable (my main laptop) on and they also lack the VERSION_ID. The target 3D printer raspberry pi running debian testing:
Another one I run also on debian testing:
My main laptop on debian sid / unstable:
|
b9a7374 to
54a0d0c
Compare
|
So ig we should maybe add But back to the PR, I would not add this extra information for now, as fixing it would actually make more sense. |
|
Yeah I guess packaging for debian testing and not just stable would be useful. But it's way more work than this PR is trying to address. Also from a conventions perspective, distros typically will use the release name and not a version number to version their dists: I'll open the issues tomorrow. |
msg output going to stdout meant the = "0" check failed to appropriately detect failure to download the sources file (e.g. running on debian testing where VERSION_ID doesn't exist). msg output also was hidden from user visible output. this fixes the issue by moving messages out of the function
54a0d0c to
00fe8a7
Compare
|
Fyi, as you force-pushed a few times. |
mryel00
left a comment
There was a problem hiding this comment.
This looks good to me now
Thanks a lot for this and all the extra information
msg output going to stdout meant the = "0" check failed to appropriately detect failure to download the sources file (e.g. running on debian testing where VERSION_ID doesn't exist). msg output also was hidden from user visible output.
with this change return codes are unambiguous to test, and all msg output properly makes it to the user visible stdout