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

ocamlc should delete the excecutable before writing it #8354

Closed
vicuna opened this issue Oct 31, 2003 · 1 comment
Closed

ocamlc should delete the excecutable before writing it #8354

vicuna opened this issue Oct 31, 2003 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Oct 31, 2003

Original bug ID: 1911
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

I just had the following terminal dialogue:

lobus:/tmp> rm foo
lobus:/tmp> touch foo
lobus:/tmp> ls -l foo
-rw-rw-r-- 1 tim tim 0 Oct 31 09:45 foo
lobus:/tmp> cat foo.ml
let _ = Format.printf "Hi!\n@?";;
lobus:/tmp> /usr/bin/ocamlc foo.ml -o foo
lobus:/tmp> ls -l foo
-rw-rw-r-- 1 tim tim 56642 Oct 31 09:45 foo
^^^^^^^^^^ Wrong permissions
lobus:/tmp> ./foo
./foo: Permission denied. <<<Wrong, the program should run.
lobus:/tmp> rm foo
lobus:/tmp> /usr/bin/ocamlc foo.ml -o foo
lobus:/tmp> ./foo
Hi!
lobus:/tmp>

I think ocamlc should set the permissions on its executable output
file before writing it so it isn't confused by the permissions on the
output file if it already exists. For comparison, gcc apparently does
this:

lobus:/tmp> rm foo
lobus:/tmp> touch foo
lobus:/tmp> ls -l foo
-rw-rw-r-- 1 tim tim 0 Oct 31 09:47 foo
lobus:/tmp> cat foo.c
/* stdio.h is for printf. /
#include <stdio.h>
int main () {
printf "Hi!\n";
return 0;
}
lobus:/tmp> cc foo.c -o foo
lobus:/tmp> ls -l foo
-rwxrwxr-x 1 tim tim 5153 Oct 31 09:47 foo

^^^^^^^^^^ Right permissions.
lobus:/tmp> ./foo
Hi! <<< Right, the program runs.
lobus:/tmp>

--
Tim Freeman tim@fungible.com
GPG public key fingerprint ECDF 46F8 3B80 BB9E 575D 7180 76DF FE00 34B1 5C78
Computers don't like it when you anthropomorphize them. -- Chris Phoenix

@vicuna
Copy link
Author

vicuna commented Jul 2, 2004

Comment author: administrator

Done 2004-07-02 by XL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant