Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

doesn't work at compile time #9

Closed
timotheecour opened this issue Nov 30, 2018 · 3 comments
Closed

doesn't work at compile time #9

timotheecour opened this issue Nov 30, 2018 · 3 comments

Comments

@timotheecour
Copy link

timotheecour commented Nov 30, 2018

a few issues:

  • mkstemp can't be used because we can't fopen a file at CT
  • mktemp can be used but is marked deprecated, however:
  • existsFile can't be used at CT
  • the random name returned at CT is "FFFFFFFF", ie not random

other points

potential solution

on posix: use mktemp + gorgeEx (ie execute shell cmd at CT)
on windows: ?

eg use case:

nimterop/nimterop#27 where I need a rand file at CT

@ba0f3
Copy link
Collaborator

ba0f3 commented Nov 30, 2018

mktemp marked as deprecated because of no real file created, it may causes security issues, I will make it private soon.

I will take a look on CT when I have spare time. Thank you!

@timotheecour
Copy link
Author

it may causes security issues, I will make it private soon.

meh, then just call it mktempUnsafe to make it clear to users; but there are useful use cases (where security is not a concern) for returning a path to a not-yet-created file (even if it could theoretically fail in adversarial circumstances); nim is a systems programming language, so should allow that IMO

@ba0f3
Copy link
Collaborator

ba0f3 commented Nov 30, 2018

greate idea, I will make some changes soon

ba0f3 added a commit that referenced this issue Dec 2, 2018
@ba0f3 ba0f3 closed this as completed in 1e64c88 Dec 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants