New Issue: IO module: potential changes to opentmp

20147, "lydia-duncan", "IO module: potential changes to opentmp", "2022-07-01T20:20:28Z"

This function has the syntax:

 proc opentmp(hints: iohints = IOHINT_NONE): file throws

We think it should be renamed. Some options we came up with:

  • openTmp
  • openTemp
  • openTmpFile
  • openTempFile
  • openTemporaryFile

The documentation for this function also has a TODO to switch to file creation style cwrx when it is implemented (see #20134). But that leads to the question of what should happen when trying to create a temporary file exclusively that already exists? Should that result in a thrown error? Or should the function retry?

If we throw an error, that could be considered a breaking change (as now code will need to catch that error in scenarios that wouldn't have thrown an error before). However, ensuring that a temporary file is only created if it didn't already exist does solve the security risk, so maybe that would be acceptable. Retrying, on the other hand, wouldn't alert the user that someone was potentially messing with their system and that might be a bad thing. C's tmpfile itself will generate an EEXIST error, but there isn't any indication of if that happens immediately or after a couple of tries.

This function's documentation should be updated similarly to how open's documentation gets updated in #20139, as it throws a strict subset of those errors