RMS_Update: restore bounded sudo prompt and raise UDP buffers to 16MB - #972
Draft
Cybis320 wants to merge 2 commits into
Draft
RMS_Update: restore bounded sudo prompt and raise UDP buffers to 16MB#972Cybis320 wants to merge 2 commits into
Cybis320 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related changes to
RMS_Update.sh, kept as separate commits.1. Restore the bounded sudo password prompt
sudoWithTimeout()was added in52b085ecand removed inc5fd3ab5("Prevent corruption of config and mask file", a 384-line restructure). Nothing in that commit was about sudo and no reference to it survives, so this looks like collateral of the rewrite rather than a decision.Without it, the fallback branch runs a bare
sudo apt-getand waits on sudo's own prompt. Sudo'spasswd_timeoutdefaults to0(no timeout), so an unattended run can block indefinitely — which matters becauseGRMSUpdater.shstops all stations before calling this script.Reinstated as
ensure_sudo "<reason>": 30sread -ttimeout, 3 attempts, background keep-alive to survive a longapt-get.install_missing_dependenciesnow goes through it, collapsing theapt-getloop that was previously written out twice.Four deliberate differences from the original:
stop_sudo_keep_alivefromemergency_cleanupand a newEXITtrap) — the original leaked itsudo -n -vso it can never compete for the terminal, plus akill -0 "$$"guardprintfinstead ofechofor the password, whichechocan mangle on backslashes2. Raise UDP buffers to 16MB during update
BufferedCapture.pyasks rtspsrc for a 16MBudp-buffer-size, but the kernel clamps that tonet.core.rmem_max. Where the limit is lower the request is a no-op and frames drop under load.UpdateBuffers.shalready sets this, but nothing ever called it, so stations only got it if run by hand.UpdateBuffers.shgains--check(unprivileged, exit 0 adequate / 10 needs raising) and--yes; argument parsing moved above the root gate so--checkworks without sudo--yes, the confirm prompt used to read empty, print "No changes made" and exit 0 — indistinguishable from success to a caller. It now fails loudlyRMS_Update.shgainsupdate_udp_buffers()after the dependency step, plus--skip-buffersThe check is unprivileged, so sudo is only requested when there is real work: one prompt per station, silent no-op on every update after. It always returns 0 — buffer sizing affects capture at runtime and should never fail a build.
Testing
Against a mock Linux
sysctl(macOS has nonet.core.*):--checkat 208KB / 1MB / 16MB returns 10 / 10 / 0--yesexits 1; with--yesproceeds; already-adequate exits 0 without applyingupdate_udp_bufferspaths return 0bash -nNothing was executed against
/etc— the apply stage was stubbed in the test copy.Note
GRMSUpdater.sh:595now takes the skip path and prints the manual command rather than stalling with stations stopped. That also means multi-camera hosts won't get the buffer bump automatically and will need one manualsudo ./Scripts/UpdateBuffers.sh --yes. If that should be automatic, the cleaner fix is for GRMSUpdater to establish sudo up front, beforestop_stations.🤖 Generated with Claude Code