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 #30

Closed
edwinb opened this issue May 20, 2020 · 2 comments
Closed

Compiler.Common.tmpName should not use tmpnam #30

edwinb opened this issue May 20, 2020 · 2 comments

Comments

@edwinb
Copy link
Collaborator

edwinb commented May 20, 2020

Issue by wchresta
Thursday Oct 31, 2019 at 01:49 GMT
Originally opened as edwinb/Idris2-boot#149


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

@edwinb
Copy link
Collaborator Author

edwinb commented May 20, 2020

Comment by youlam
Monday Mar 16, 2020 at 14:01 GMT


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 *);`

@edwinb
Copy link
Collaborator Author

edwinb commented May 20, 2020

I finally dealt with this while porting to Idris 2.

@edwinb edwinb closed this as completed May 20, 2020
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

1 participant