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

Compiler.Common.tmpName should not use tmpnam #149

Open
wchresta opened this issue Oct 31, 2019 · 1 comment
Open

Compiler.Common.tmpName should not use tmpnam #149

wchresta opened this issue Oct 31, 2019 · 1 comment

Comments

@wchresta
Copy link

The module Compiler.Common exposes the tmpName function creating a new temporary file.

https://github.com/edwinb/Idris2/blob/65db4fbf961cbdd36f10a9a75e7c3311b91f5585/src/Compiler/Common.idr#L116-L119

According to GNU manpage 3 for tmpnam(3), this function should never be used:

Never use this function. Use mkstemp(3) or tmpfile(3) instead.

Expected Behavior

Compiler.Common.tmpName is not implemented using tmpnam

Observed Behavior

Compiler.Common.tmpName is implemented using tmpnam

@youlam
Copy link

youlam commented Mar 16, 2020

tmpnam also appears in dist/idris2.c, line 239664 in my distribution. Gave me this warning

clang   idris2.c -o idris2 -I rts -L rts -lidris_rts -lgmp -lm
    idris2.c:239664:22: warning: 'tmpnam' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead.
[-Wdeprecated-declarations]
RVAL = MKSTR(vm, tmpnam(GETPTR(LOC(1))));
                 ^
/usr/include/stdio.h:277:7: note: 'tmpnam' has been explicitly marked deprecated here

char *tmpnam(char *);`

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

2 participants