Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning thrown in update script regarding non-portable flag usage in cp #6197

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from

Conversation

JessStingray
Copy link

Contribution Guidelines

What does this PR include?

Short Description

This is a minor fix to the update script. Currently, "cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead" is thrown when dealing with SSL certificates. This commit replaces -n with the correct flag, removing the warning.

Affected Containers

None; affects only the update script

Did you run tests?

What did you tested?

I commented out the "new version check" part of the script on my install to ensure the change wasn't overwritten, and then ran the update script.

What were the final results? (Awaited, got)

Results were as expected - the warning no longer shows, and certificates were copied/left alone as they should be.

DerLinkman and others added 2 commits November 15, 2024 16:21
Currently, "cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead" is thrown when dealing with SSL certificates. This commit replaces -n with the correct flag.
@JessStingray JessStingray changed the title Fix/cp portable warning Fix warning thrown in update script regarding non-portable flag usage in cp Dec 4, 2024
@DerLinkman
Copy link
Member

Yes, also read this a few days prior. Did you tested if this is also working on a few other mailcow supported OS?

The -n flag deprecation is only present in coreutils >= 9.3, and the replacement flag is only present in versions older than this. A conditional is added to ensure that the new version of the command only runs on systems with coreutils of an appropriate version, using the original on older systems.
@JessStingray
Copy link
Author

Good call to double check that - seems I had a testing version of Debian, with current stable having an older version.

I've added a new commit that checks the currently available version of cp to make sure it's newer than 9.3, the version that made this change - older systems (e.g. Debian, CentOS etc) will fall back to the -n behaviour while newer systems will use the new flag to avoid warnings.

I've now tested this on Ubuntu 24.04, Debian Bookworm and Sid, and Fedora 40, all of which behave as expected, though I don't have an Alma or Rocky VM available to test with at the moment.

@Habetdin
Copy link
Contributor

Habetdin commented Dec 5, 2024

If the cp --update=none works both in old and new versions of coreutils, is there any point of making complex code with two branches instead of a single command? There would be no need for additional version_greater_or_equal function in the latter case.

@JessStingray
Copy link
Author

--update doesn't allow arguments prior to 9.3, so the new version of the command fails (as in Debian Bookworm):

image

In these cases the -n flag is still needed, which throws the warning in newer versions, so the check is unfortunately necessary.

@DerLinkman
Copy link
Member

Can confirm not working on Alma 8 (supported from us) so this must be fiddled around somehow to make it work.

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.

3 participants