Skip to content

Tools: install-prereqs-ubuntu: avoid duplicate shell rc lines on rerun - #35299

Open
khancyr wants to merge 1 commit into
ArduPilot:masterfrom
khancyr:env_bash
Open

khancyr wants to merge 1 commit into
ArduPilot:masterfrom
khancyr:env_bash

Conversation

@khancyr

@khancyr khancyr commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor
  • check ~/.bashrc, where the completion line is written, instead of the login file
  • only append the venv activate line and the docker ~/.ardupilot_env source line if not already present
  • look for .git in ARDUPILOT_ROOT rather than the current directory, and accept a file so git worktrees get their submodules updated

Summary

found by claude, checked manually with a rerun.

Classification & Testing (check all that apply and add your own)

  • Checked by a human programmer
  • Non-functional change
  • No-binary change
  • Infrastructure change (e.g. unit tests, helper scripts)
  • Automated test(s) verify changes (e.g. unit test, autotest)
  • Tested manually, description below (e.g. SITL)
  • Tested on hardware
  • Logs attached
  • Logs available on request

Description

@peterbarker peterbarker self-assigned this Nov 20, 2026
@AP-Review

AP-Review commented Nov 20, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-20)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head cfe677eb3d.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/ardupilot/35299/1.html#pr35299

The rerun guards work as described: I re-ran the changed part of the installer three times at the merge-base and at this head, and the venv, completion and Docker source lines are now each written once instead of three times. The .git check now finds worktrees from any directory. One rarely-hit edge case remains.

Minor (1)
  • install-prereqs-ubuntu.sh:640: a .git file whose gitdir can't be reached (for example a host worktree mounted into Docker or a Vagrant VM) now passes -e. git submodule update then exits 128, and set -e aborts the installer before the Docker source ~/.ardupilot_env step. Before this PR the block was skipped. Adding && git -C "$ARDUPILOT_ROOT" rev-parse --git-dir >/dev/null 2>&1 to the test would skip that case.

The earlier note about the "Non-functional change" checkbox is dropped, since the template says to check all that apply.

@peterbarker

Copy link
Copy Markdown
Contributor

@khancyr please evaluate that minor point from the AI

- check ~/.bashrc, where the completion line is written, instead of
  the login file
- only append the venv activate line and the docker
  ~/.ardupilot_env source line if not already present
- look for .git in ARDUPILOT_ROOT rather than the current directory,
  and accept a file so git worktrees get their submodules updated;
  skip it if git can't resolve it (e.g. a host worktree mounted in a
  container)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@khancyr

khancyr commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

not sure it would happens, but added as it cost pretty much nothing

@AP-Review

Copy link
Copy Markdown

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: ACCEPT

Reviewed at head 56bafaf9a8.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/ardupilot/35299/2.html#pr35299

No new issues at this head: the rerun guards still write each rc line once, and a real repo or worktree still gets its submodules updated.

The unreachable-gitdir case at install-prereqs-ubuntu.sh:640 is fixed: the installer now skips the submodule step and exits 0, where the previous head exited 128.

Not fully reviewed: a full installer run on Ubuntu, Docker or Vagrant, and CI, which was still pending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants