Skip to content

Conversation

crazy-max
Copy link
Collaborator

@crazy-max crazy-max commented Jan 24, 2024

@crazy-max
Copy link
Collaborator Author

Ok so a bunch of tests look to fail on Windows runner: https://github.com/tonistiigi/fsutil/actions/runs/7642673575/job/20822858671?pr=173#step:4:21

I'm more worried about:

--- FAIL: TestInternalReadFile (0.00s)
    followlinks_test.go:198: 
        	Error Trace:	D:/a/fsutil/fsutil/followlinks_test.go:198
        	Error:      	Received unexpected error:
        	            	expected single entry "\\" but got "dir"
        	            	github.com/tonistiigi/fsutil.statFile.func1
        	            		D:/a/fsutil/fsutil/followlinks.go:150
        	            	github.com/tonistiigi/fsutil.(*fs).Walk.func1
        	            		D:/a/fsutil/fsutil/fs.go:80
        	            	path/filepath.walkDir
        	            		C:/hostedtoolcache/windows/go/1.20.12/x64/src/path/filepath/path.go:438
        	            	path/filepath.walkDir
        	            		C:/hostedtoolcache/windows/go/1.20.12/x64/src/path/filepath/path.go:460
        	            	path/filepath.WalkDir
        	            		C:/hostedtoolcache/windows/go/1.20.12/x64/src/path/filepath/path.go:528
        	            	github.com/tonistiigi/fsutil.(*fs).Walk
        	            		D:/a/fsutil/fsutil/fs.go:49
        	            	github.com/tonistiigi/fsutil.statFile
        	            		D:/a/fsutil/fsutil/followlinks.go:145
        	            	github.com/tonistiigi/fsutil.TestInternalReadFile
        	            		D:/a/fsutil/fsutil/followlinks_test.go:197
        	            	testing.tRunner
        	            		C:/hostedtoolcache/windows/go/1.20.12/x64/src/testing/testing.go:1576
        	            	runtime.goexit
        	            		C:/hostedtoolcache/windows/go/1.20.12/x64/src/runtime/asm_amd64.s:1598
        	Test:       	TestInternalReadFile
--- FAIL: TestInternalReadDir (0.00s)
    followlinks_test.go:234: 
        	Error Trace:	D:/a/fsutil/fsutil/followlinks_test.go:234
        	Error:      	Received unexpected error:
        	            	expected to read parent entry "\\" before child "dir"
        	            	github.com/tonistiigi/fsutil.readDir.func1
        	            		D:/a/fsutil/fsutil/followlinks.go:189
        	            	github.com/tonistiigi/fsutil.(*fs).Walk.func1
        	            		D:/a/fsutil/fsutil/fs.go:80
        	            	path/filepath.walkDir
        	            		C:/hostedtoolcache/windows/go/1.20.12/x64/src/path/filepath/path.go:438
        	            	path/filepath.walkDir
        	            		C:/hostedtoolcache/windows/go/1.20.12/x64/src/path/filepath/path.go:460
        	            	path/filepath.WalkDir
        	            		C:/hostedtoolcache/windows/go/1.20.12/x64/src/path/filepath/path.go:528
        	            	github.com/tonistiigi/fsutil.(*fs).Walk
        	            		D:/a/fsutil/fsutil/fs.go:49
        	            	github.com/tonistiigi/fsutil.readDir
        	            		D:/a/fsutil/fsutil/followlinks.go:177
        	            	github.com/tonistiigi/fsutil.TestInternalReadDir
        	            		D:/a/fsutil/fsutil/followlinks_test.go:233
        	            	testing.tRunner
        	            		C:/hostedtoolcache/windows/go/1.20.12/x64/src/testing/testing.go:1576
        	            	runtime.goexit
        	            		C:/hostedtoolcache/windows/go/1.20.12/x64/src/runtime/asm_amd64.s:1598
        	Test:       	TestInternalReadDir

Which seems related to #167 (cc @jedevc)

@crazy-max

This comment was marked as resolved.

@crazy-max crazy-max requested a review from tonistiigi January 29, 2024 07:43
@crazy-max crazy-max marked this pull request as ready for review January 29, 2024 08:02
Comment on lines +140 to +141
root = filepath.FromSlash(filepath.Clean(root))
if root == string(filepath.Separator) || root == "." {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It changes the behavior introduced in #174 related to docker/buildx#2207 to be aligned with os separator. cc @gabriel-samfira.

@gabriel-samfira
Copy link
Contributor

Hi @crazy-max

Will have a look today. I had a couple of old PRs that tried to do this a while back 😄. Glad to see this happening. Apologies for the delay.

@crazy-max
Copy link
Collaborator Author

Hi @crazy-max

Will have a look today. I had a couple of old PRs that tried to do this a while back 😄. Glad to see this happening. Apologies for the delay.

No worries! I will carry your commit from #148 and add back my few changes so you can have a better look. 🙏

@crazy-max crazy-max force-pushed the ci-windows branch 2 times, most recently from cb02be4 to b7a2e86 Compare January 29, 2024 09:26
Copy link
Contributor

@gabriel-samfira gabriel-samfira left a comment

Choose a reason for hiding this comment

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

Looks good. Just one tiny comment. Changes are mostly mechanic and deal with path separators.

@@ -138,7 +139,7 @@ func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, fil
return err
}
if f1.stat.IsDir() && !f2copy.stat.IsDir() {
rmdir = f1.path + string(os.PathSeparator)
rmdir = f1.path + string(filepath.Separator)
Copy link
Collaborator

@thaJeztah thaJeztah Jan 29, 2024

Choose a reason for hiding this comment

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

(Just picked a random line); is all code always executed in the "native" environment, or are there also code-paths executed on non-matching platforms (client-side code running on Linux/mac on behalf of a daemon running on Windows, and vice-versa?)

Also note that / is accepted in various situations on Windows, so users may use / to specify paths on Windows, so in some cases both / and \ may have to be taken into account (if not normalised)

edit: e.g. https://github.com/docker/cli/blob/6dcf285ff155594711038668aa4f7a856435b050/cli/compose/loader/windows_path.go#L12-L27

which was taken from https://github.com/golang/go/blob/1d0e94b1e13d5e8a323a63cd1cc1ef95290c9c36/src/path/filepath/path_windows.go#L12-L65

Copy link
Owner

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

Looks like freebsd has actual test failures

@crazy-max
Copy link
Collaborator Author

crazy-max commented Feb 7, 2024

Looks like freebsd has actual test failures

This is not related to changes here I think but #172 (comment). Looks flaky.

@crazy-max
Copy link
Collaborator Author

Looks like freebsd has actual test failures

This is not related to changes here I think but #172 (comment). Looks flaky.

Should be good now if you want to merge this one first: #172

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
tonistiigi
tonistiigi previously approved these changes Feb 7, 2024
@tonistiigi tonistiigi self-requested a review February 7, 2024 18:11
@tonistiigi tonistiigi dismissed their stale review February 7, 2024 18:11

more checks

@@ -96,7 +96,7 @@ func NewFilterFS(fs FS, opt *FilterOpt) (FS, error) {
}

patternChars := "*[]?^"
if os.PathSeparator != '\\' {
if filepath.Separator != '\\' {
Copy link
Owner

Choose a reason for hiding this comment

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

Not sure if this can be easily fixed but FS should not be platform-specific, so these filters should also not depend on the current os.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hum I think this is based on user input if I'm not mistaken (cc @jedevc)

Copy link
Owner

Choose a reason for hiding this comment

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

We can leave this for follow-up

Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to come from #121.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@tonistiigi tonistiigi merged commit d68510a into tonistiigi:master Feb 8, 2024
@crazy-max crazy-max deleted the ci-windows branch February 8, 2024 17:13
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.

5 participants