Skip to content

Use the "sh" package where applicable#341

Merged
kke merged 3 commits into
mainfrom
use-sh
May 8, 2026
Merged

Use the "sh" package where applicable#341
kke merged 3 commits into
mainfrom
use-sh

Conversation

@kke
Copy link
Copy Markdown
Contributor

@kke kke commented May 8, 2026

There were several places there rig didn't "dogfood" on the sh package for building commands.

Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates several remote command invocations to “dogfood” the internal sh package for safer/cleaner command construction instead of manual fmt.Sprintf(...) + shell-escaping.

Changes:

  • Replaced several fmt.Sprintf(...)-built commands in PosixFS with sh.Command(...) (e.g., chmod, install, mkdir, printenv).
  • Reworked PosixFile dd calls to use sh.Command(...) rather than formatting a single shell string.
  • Updated Upstart “disable service” to write the override file using tee with stdin instead of shell redirection.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
remotefs/posixfs.go Migrates multiple filesystem operations to sh.Command(...) and changes Getenv to printenv.
remotefs/posixfile.go Migrates dd-based read/write/copy operations to sh.Command(...).
initsystem/upstart.go Removes manual shell escaping and writes override files via tee + stdin.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread remotefs/posixfs.go
Comment thread remotefs/posixfs.go
Comment thread remotefs/posixfile.go
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
@kke kke requested a review from Copilot May 8, 2026 11:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread remotefs/posixfs.go
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@kke kke marked this pull request as ready for review May 8, 2026 12:09
@kke kke merged commit 97adfa0 into main May 8, 2026
15 checks passed
@kke kke deleted the use-sh branch May 8, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants