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

Consider replacing GetTempFileName with GetTempPath and GetRandomFileName #8439

Closed
jbagga opened this issue Jun 23, 2017 · 3 comments
Closed
Assignees
Milestone

Comments

@jbagga
Copy link

jbagga commented Jun 23, 2017

dotnet-install.ps1 uses GetTempFileName, however

The GetTempFileName method will raise an IOException if it is used to create more than 65535 files without deleting previous temporary files.

See https://github.com/aspnet/Coherence-Signed/issues/510 for more information.

cc @Eilon

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@msftgits msftgits added this to the 2.1.3xx milestone Jan 31, 2020
@birbilis
Copy link

Maybe should consider fixing GetTempFileName? The average programmer wouldn't expect it bombs at 65535 files

@birbilis
Copy link

birbilis commented Dec 1, 2020

seeing the fix at https://github.com/dotnet/cli/blob/f0ee1e44114f161ce9268103d18ce32d2a995d0f/scripts/obtain/dotnet-install.ps1#L631 and at another line in there - copying the url here since the dotnet/aspnetcore-internal link above is not public or is broken link

@birbilis
Copy link

birbilis commented Dec 1, 2020

note that the original code was creating an empty temp file (that is the behaviour of GetTempFilename). For a replacement function that tries to do that (doesn't try it in a loop to avoid infinite recursion if one can't write to temp folder for anyother reason) see https://dotnetfiddle.net/bmFVSX

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

No branches or pull requests

4 participants