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

Incorrectly using path.Join? #136

Closed
joe-elliott opened this issue Jul 9, 2020 · 2 comments · Fixed by #338
Closed

Incorrectly using path.Join? #136

joe-elliott opened this issue Jul 9, 2020 · 2 comments · Fixed by #338

Comments

@joe-elliott
Copy link
Member

filepath.Join => path.Join

@dgzlopes
Copy link
Member

Researched this a little.

path.Join uses / as separator regardless of the operating system. And well, that can be a problem!

For example, in Windows, some paths use \ as separators.

Source code:

func Join(elem ...string) string {
	for i, e := range elem {
		if e != "" {
			return Clean(strings.Join(elem[i:], "/"))
		}
	}
	return ""
}

On the other hand, filepath.Join uses OS-specific separators.

@joe-elliott
Copy link
Member Author

This is the least defined issue ever :). Thank you for doing some research on this. There are definitely a few places where we should correct this behavior:

tempodb/backend/diskcache/disk_cache.go
tempodb/wal/wal.go

tempodb/backend/local/local.go should probably be changed as well, but i'm wondering why it's not using tempodb/backend/util/util.go
@annanay25 any ideas?

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 a pull request may close this issue.

2 participants