[racket-dev] Unexpected make-temporary-file behavior

From: Casey Klein (clklein at eecs.northwestern.edu)
Date: Wed Dec 8 16:06:55 EST 2010

On Wed, Dec 8, 2010 at 12:23 PM, Casey Klein
<clklein at eecs.northwestern.edu> wrote:
> The documentation for `make-temporary-file' says, "The `template'
> argument must be a format string suitable for use with `format' and
> one additional string argument (where the string contains only
> digits)."
>
> I take that to mean that the following expression should always produce true:
>
> (regexp-match?
>  #px"^\\d*$"
>  (file-name-from-path (make-temporary-file "~a")))
>
> It does not, though:
>
>> (make-temporary-file "~a")
> #<path:/var/folders/WG/WGoR46pDFjWocHBRaeWetk+++TI/-Tmp-/1291832518-952637879>
>
> Is this a bug, or am I misunderstanding the documentation?
>

After looking at the code, it's a bug. The "-952637879" comes from
(current-milliseconds), which is currently negative on my machine.

http://git.racket-lang.org/plt/blob/HEAD:/collects/racket/file.rkt#l88

I'll push a fix.


Posted on the dev mailing list.