Handle .old file normalization #18
Merged
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.
Description
This PR adds
.oldfile normalization to handle cases whereos.Executable()returns a path ending with.oldafter a previous update on some systems.normalizeExecutablePath()function to strip.oldsuffix and leading dots from base filenamesgetPath()to normalize executable paths before useMotivation and Context
After a self-update operation, some systems may report the current executable path with a
.oldextension (e.g.,/path/to/.minio.old). This can cause issues when the updatertries to determine the target path for the next update.
The implementation addresses:
.oldextension from executable paths (lines 244-246).minio.old→minio(lines 248-250).oldextension (lines 254)The normalization handles:
.oldsuffix are normalized (lines 262-265).oldare normalized (lines 266-269, 270-273).old(lines 274-281)How to test this PR?
Run the test suite:
go test -v -run TestNormalizeExecutablePathSee other tests downstream in
eoshere: https://github.com/miniohq/eos/actions/runs/18663370987/job/53209192041The failures are unrelated and are being discussed with @vadmeste in https://github.com/miniohq/eos/issues/1956
Types of changes
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Optimization (provides speedup with no functional changes)
[ ] Cleanup/Maintenance (no functional changes)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[ ] Fixes a regression (If yes, please add commit-id or PR # here)
[x] Unit tests added/updated
[ ] Internal documentation updated
[ ] Create a documentation update request