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

Highly misleading error message #4788

Closed
vicuna opened this issue May 8, 2009 · 3 comments
Closed

Highly misleading error message #4788

vicuna opened this issue May 8, 2009 · 3 comments
Labels
Milestone

Comments

@vicuna
Copy link

@vicuna vicuna commented May 8, 2009

Original bug ID: 4788
Reporter: sacerdot
Status: closed (set by @xavierleroy on 2015-12-11T18:21:24Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11.0
Target version: 4.01.0+dev
Fixed in version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #3928
Monitored by: @hcarty db

Bug description

Debug symbols for executables compiled with -g are read directly from the executable file, but the latter is searched in the current directory. Thus,
if the program does a Sys.chdir to another directory, the executable is not found. The very misleading error message the user gets is "(Program not linked with -g, cannot print stack backtrace)" in place of "Executable program not found in $CURRENTDIR". Obviously, an even better solution would be to always look for the executable in the path the program was launched.

The program in attachment shows the problem (unless you run it from /tmp, of course :-)

File attachments

@vicuna
Copy link
Author

@vicuna vicuna commented May 8, 2009

Comment author: db

Really? My impression was that under Linux bytecode full path is taken on startup from /proc/self/exe. Other OSes search system $PATH for argv[0]. In both cases current directory should not affect the process. But I agree that something like "Bytecode file not found, cannot print stack backtrace" would be better.

@vicuna
Copy link
Author

@vicuna vicuna commented May 15, 2009

Comment author: @damiendoligez

The executable file is looked up in the PATH, except of course when it's invoked without using the PATH (for example, as ./a.out).

We need to fix the error message, but we can't do much to get rid of the error itself.

@vicuna
Copy link
Author

@vicuna vicuna commented Aug 2, 2013

Comment author: @damiendoligez

I've changed the error message in case the executable file is not found (branch 4.01, rev 13966 and 13967).

The solution is not perfect, because when the current directory contains another a.out compiled by OCaml with symbols, you get a bogus backtrace instead of an error message. Backtraces are for debugging, so I guess we can live with this.

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

Successfully merging a pull request may close this issue.

None yet
1 participant