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

(#23249) Normalize tidy paths #2141

Conversation

joshcooper
Copy link
Contributor

Previously, a tidy resource could create a duplicate file resource due to a
mismatch between back and forward slashes on Windows.

This commit munges the tidy path parameter using File.expand_path, so on
Windows, C:\dir becomes C:/dir. When that is File.join'ed with a file
needing to be tidy'ed, the resulting path contains only forward slashes,
which is consistent with the path parameter for the file type.

Previously, a tidy resource could create a duplicate file resource due to a
mismatch between back and forward slashes on Windows.

This commit munges the tidy path parameter using File.expand_path, so on
Windows, `C:\dir` becomes `C:/dir`. When that is File.join'ed with a file
needing to be tidy'ed, the resulting path contains only forward slashes,
which is consistent with the path parameter for the file type.
@ferventcoder
Copy link
Contributor

@joshcooper any thoughts why the below is happening?

 expected: "c:/directory"
 got: "/home/travis/build/puppetlabs/puppet/c:\\directory"

@ferventcoder
Copy link
Contributor

@joshcooper Wasn't there also an issue with case as well? So c:/bob is different than c:/Bob?

I'm not sure how to address this exactly though as I believe the user would want the directory/file created in exactly the case that they specify.

Perhaps we can do some more normalization of the resource title to all lowercase and add set the path in the case that the user specifies?

@puppetcla
Copy link

CLA signed by all contributors.

@joshcooper
Copy link
Contributor Author

When running on non-windows, the as_platform block redefines File::SEPARATOR and File::ALT_SEPARATOR to be as expected, '/' and '\' on windows. I assumed that File.expand_path would use those constants, but it doesn't since it calls into native code, where those constants are not redefined by the as_platform block. I will need to redo this PR.

@joshcooper joshcooper closed this Dec 11, 2013
@joshcooper joshcooper deleted the ticket/master/23249-normalize-tidy-paths branch March 21, 2019 16:04
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.

None yet

3 participants