cli/command/container: use local copy of pkg/system.IsAbs#5697
cli/command/container: use local copy of pkg/system.IsAbs#5697thaJeztah merged 1 commit intodocker:masterfrom
Conversation
thaJeztah
commented
Dec 16, 2024
- relates to Decouple pkg/archive from pkg/system moby/moby#49072
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5697 +/- ##
=======================================
Coverage 59.51% 59.52%
=======================================
Files 346 346
Lines 29379 29381 +2
=======================================
+ Hits 17486 17488 +2
Misses 10923 10923
Partials 970 970 |
| // IsAbs is a platform-agnostic wrapper for filepath.IsAbs. | ||
| // | ||
| // On Windows, golang filepath.IsAbs does not consider a path \windows\system32 | ||
| // as absolute as it doesn't start with a drive-letter/colon combination. However, | ||
| // in docker we need to verify things such as WORKDIR /windows/system32 in | ||
| // a Dockerfile (which gets translated to \windows\system32 when being processed | ||
| // by the daemon). This SHOULD be treated as absolute from a docker processing | ||
| // perspective. | ||
| func isAbs(path string) bool { | ||
| return filepath.IsAbs(path) || strings.HasPrefix(path, string(os.PathSeparator)) | ||
| } |
There was a problem hiding this comment.
Actually wondering now if we should share the implementation from the compose-loader, which has a more comprehensive implementation adopted from go stdlib;
cli/cli/compose/loader/windows_path.go
Lines 8 to 27 in 91d097e
There was a problem hiding this comment.
Don't think we can currently consolidate those as they have slightly different semantics (compose allows C:\some-path, C:/some-path, but not /some-path or \\some-path), but possibly something to look into