Skip to content

fix(install_config): replace cp -nv with explicit file existence check#4897

Merged
dgibbs64 merged 3 commits intodevelopfrom
fix/install-config-cp-portability
Apr 19, 2026
Merged

fix(install_config): replace cp -nv with explicit file existence check#4897
dgibbs64 merged 3 commits intodevelopfrom
fix/install-config-cp-portability

Conversation

@dgibbs64
Copy link
Copy Markdown
Member

@dgibbs64 dgibbs64 commented Apr 19, 2026

Description

Newer versions of coreutils (Ubuntu 24.04+, Debian 13+, Rocky Linux 9+) changed the behaviour of cp -n, either emitting a portability warning or rejecting the --update argument entirely, breaking the config file copy step during install.

  • Replace all cp -nv calls in install_config.sh with an explicit [ ! -f dest ] existence check before copying
  • Preserves the same OK/SKIP/FAIL output behaviour
  • Portable across all supported distros

Fixes #4700

Type of change

  • Bug fix (a change which fixes an issue).
  • New feature (a change which adds functionality).
  • New Server (new server added).
  • Refactor (restructures existing code).
  • Comment update (typo, spelling, explanation, examples, etc).

Checklist

PR will not be merged until all steps are complete.

  • This pull request links to an issue.
  • This pull request uses the develop branch as its base.
  • This pull request subject follows the Conventional Commits standard.
  • This code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have checked that this code is commented where required.
  • I have provided a detailed enough description of this PR.
  • I have checked if documentation needs updating.

Documentation

If documentation does need updating either update it by creating a PR (preferred) or request a documentation update.

Thank you for your Pull Request!

Newer coreutils (Ubuntu 24.04+, Debian 13+) emit a portability warning
when using cp -n: 'behavior of -n is non-portable and may change in future'.

Replace all cp -nv usages with an explicit [ ! -f dest ] guard, which is
portable across all distros and preserves the same OK/SKIP/FAIL behaviour.
Copilot AI review requested due to automatic review settings April 19, 2026 10:03
Copy link
Copy Markdown
Contributor

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 the LinuxGSM config installation flow to avoid coreutils warnings emitted by cp -n, which were breaking mid-line OK/SKIP/FAIL formatting during config copy output.

Changes:

  • Replaced cp -nv usage in remote default-config installs with an explicit destination existence check plus a plain cp.
  • Preserved OK/SKIP/FAIL printing by setting changes only when a copy occurs and leaving it empty when skipping.

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

Comment thread lgsm/modules/install_config.sh Outdated
Comment thread lgsm/modules/install_config.sh Outdated
Comment thread lgsm/modules/install_config.sh Outdated
Comment thread lgsm/modules/install_config.sh Outdated
Using only -f missed broken symlinks (-e returns false for them but
-L returns true). Use both checks to match the skip behaviour of cp -n.
@dgibbs64 dgibbs64 added this to the v26.1.0 milestone Apr 19, 2026
@dgibbs64 dgibbs64 merged commit 9dfbb8e into develop Apr 19, 2026
4 of 5 checks passed
@dgibbs64 dgibbs64 deleted the fix/install-config-cp-portability branch April 19, 2026 10: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