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

[Agent] Join path logic for install hooks is incorrect on windows. #17449

Closed
ph opened this issue Apr 2, 2020 · 1 comment · Fixed by #17461
Closed

[Agent] Join path logic for install hooks is incorrect on windows. #17449

ph opened this issue Apr 2, 2020 · 1 comment · Fixed by #17461
Assignees
Labels
bug Ingest Management:alpha1 Group issues for ingest management alpha1

Comments

@ph
Copy link
Contributor

ph commented Apr 2, 2020

in #17445

I've found out a bug on windows, the way we handle absolute path is incorrect.
On windows they will never be absolute path they do not have any volumes names.

		// (Windows issue) See issue:
		//"windows": {
		//	{"/", "a", "\\a", true},
		//	{"/a", "b", "\\a\\b", true},
		//	{"/a", "b/c", "\\a\\b\\c", true},
		//	//
		//	{"/a/b", "/a/c", "\\a\\c", false},
		//	{"/a/b", "/a/b/../c", "\\a\\c", false},
		//	{"/a/b", "../c", "\\a\\c", false},
		//	{"/a", "/a/b/c", "\\a\\b\\c", true},
		//	{"/a", "/A/b/c", "\\a\\b\\c", true},
		//},

failed tests:

 --- FAIL: TestIsSubpath/[windows]'/a/b-/a/c' (0.00s)

[2020-04-02T17:37:59.293Z]         steps_test.go:62: 
[2020-04-02T17:37:59.294Z]             	Error Trace:	steps_test.go:62
[2020-04-02T17:37:59.294Z]             	Error:      	Not equal: 
[2020-04-02T17:37:59.294Z]             	            	expected: "\\a\\c"
[2020-04-02T17:37:59.294Z]             	            	actual  : "\\a\\b\\a\\c"
[2020-04-02T17:37:59.294Z]             	            	
[2020-04-02T17:37:59.294Z]             	            	Diff:
[2020-04-02T17:37:59.294Z]             	            	--- Expected
[2020-04-02T17:37:59.294Z]             	            	+++ Actual
[2020-04-02T17:37:59.294Z]             	            	@@ -1 +1 @@
[2020-04-02T17:37:59.294Z]             	            	-\a\c
[2020-04-02T17:37:59.294Z]             	            	+\a\b\a\c
[2020-04-02T17:37:59.294Z]             	Test:       	TestIsSubpath/[windows]'/a/b-/a/c'
[2020-04-02T17:37:59.294Z]         steps_test.go:63: 
[2020-04-02T17:37:59.294Z]             	Error Trace:	steps_test.go:63
[2020-04-02T17:37:59.294Z]             	Error:      	Not equal: 
[2020-04-02T17:37:59.294Z]             	            	expected: false
[2020-04-02T17:37:59.294Z]             	            	actual  : true
[2020-04-02T17:37:59.294Z]             	Test:       	TestIsSubpath/[windows]'/a/b-/a/c'
[2020-04-02T17:37:59.294Z]     --- FAIL: TestIsSubpath/[windows]'/a/b-/a/b/../c' (0.00s)
[2020-04-02T17:37:59.294Z]         steps_test.go:62: 
[2020-04-02T17:37:59.294Z]             	Error Trace:	steps_test.go:62
[2020-04-02T17:37:59.294Z]             	Error:      	Not equal: 
[2020-04-02T17:37:59.294Z]             	            	expected: "\\a\\c"
[2020-04-02T17:37:59.294Z]             	            	actual  : "\\a\\b\\a\\c"
[2020-04-02T17:37:59.294Z]             	            	
[2020-04-02T17:37:59.294Z]             	            	Diff:
[2020-04-02T17:37:59.294Z]             	            	--- Expected
[2020-04-02T17:37:59.294Z]             	            	+++ Actual
[2020-04-02T17:37:59.294Z]             	            	@@ -1 +1 @@
[2020-04-02T17:37:59.294Z]             	            	-\a\c
[2020-04-02T17:37:59.294Z]             	            	+\a\b\a\c
[2020-04-02T17:37:59.294Z]             	Test:       	TestIsSubpath/[windows]'/a/b-/a/b/../c'
[2020-04-02T17:37:59.294Z]         steps_test.go:63: 
[2020-04-02T17:37:59.294Z]             	Error Trace:	steps_test.go:63
[2020-04-02T17:37:59.294Z]             	Error:      	Not equal: 
[2020-04-02T17:37:59.294Z]             	            	expected: false
[2020-04-02T17:37:59.294Z]             	            	actual  : true
[2020-04-02T17:37:59.294Z]             	Test:       	TestIsSubpath/[windows]'/a/b-/a/b/../c'
[2020-04-02T17:37:59.294Z]     --- PASS: TestIsSubpath/[windows]'/a/b-../c' (0.00s)
[2020-04-02T17:37:59.294Z]     --- FAIL: TestIsSubpath/[windows]'/a-/a/b/c' (0.00s)
[2020-04-02T17:37:59.294Z]         steps_test.go:62: 
[2020-04-02T17:37:59.294Z]             	Error Trace:	steps_test.go:62
[2020-04-02T17:37:59.294Z]             	Error:      	Not equal: 
[2020-04-02T17:37:59.294Z]             	            	expected: "\\a\\b\\c"
[2020-04-02T17:37:59.294Z]             	            	actual  : "\\a\\a\\b\\c"
[2020-04-02T17:37:59.294Z]             	            	
[2020-04-02T17:37:59.294Z]             	            	Diff:
[2020-04-02T17:37:59.294Z]             	            	--- Expected
[2020-04-02T17:37:59.294Z]             	            	+++ Actual
[2020-04-02T17:37:59.294Z]             	            	@@ -1 +1 @@
[2020-04-02T17:37:59.294Z]             	            	-\a\b\c
[2020-04-02T17:37:59.294Z]             	            	+\a\a\b\c
[2020-04-02T17:37:59.294Z]             	Test:       	TestIsSubpath/[windows]'/a-/a/b/c'
[2020-04-02T17:37:59.294Z]     --- FAIL: TestIsSubpath/[windows]'/a-/A/b/c' (0.00s)
[2020-04-02T17:37:59.294Z]         steps_test.go:62: 
[2020-04-02T17:37:59.294Z]             	Error Trace:	steps_test.go:62
[2020-04-02T17:37:59.294Z]             	Error:      	Not equal: 
[2020-04-02T17:37:59.294Z]             	            	expected: "\\a\\b\\c"
[2020-04-02T17:37:59.294Z]             	            	actual  : "\\a\\A\\b\\c"
[2020-04-02T17:37:59.294Z]             	            	
[2020-04-02T17:37:59.294Z]             	            	Diff:
[2020-04-02T17:37:59.294Z]             	            	--- Expected
[2020-04-02T17:37:59.294Z]             	            	+++ Actual
[2020-04-02T17:37:59.294Z]             	            	@@ -1 +1 @@
[2020-04-02T17:37:59.294Z]             	            	-\a\b\c
[2020-04-02T17:37:59.294Z]             	            	+\a\A\b\c
[2020-04-02T17:37:59.294Z]             	Test:       	TestIsSubpath/[windows]'/a-/A/b/c'

@ph ph added bug Team:Ingest Management Ingest Management:alpha1 Group issues for ingest management alpha1 labels Apr 2, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Ingest Management:alpha1 Group issues for ingest management alpha1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants