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

exception -> seg fault #8161

Closed
vicuna opened this issue Jun 4, 2003 · 3 comments
Closed

exception -> seg fault #8161

vicuna opened this issue Jun 4, 2003 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 4, 2003

Original bug ID: 1702
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Je viens de découvrir ça:
(sur Linux)
$ /usr/local/adm/src/caml/bin/cashr
Objective Caml version 3.06+34 (2003-05-21)

   Camlp4s Parsing version 3.06+34

Cash.host_info_name "dixie";

Segmentation fault
(Sur Linux, Solaris, Dec alpha)
3 /usr/local/bin/cashr (version moins récente de cash)
Objective Caml version 3.06

   Camlp4 Parsing version 3.06

Cash.host_info_name "dixie";

Segmentation fault
Comme dixie n'est pas dans le DNS, ça lève une exception
Cash.Netdb_error HOST_NOT_FOUND
qui semble provoquer le seg fault quand ocamlrun tente de l'imprimer ?
(Un try autour de l'appel à host_info_name fonctionne très bien).

Ce que je ne comprend pas du tout: j'ai observé ça dans un script cash (en
compilé byte-code, c'est pareil). Hors j'ai un autre script auquel il
manquait aussi un try autour de host_info_name, et ça imprimait parfaitement
l'exception (mais il est peut-être suffisant de reproduire le seg fault
ci-dessus ?)

Bruno.

PS: gdb ne me donne pas beaucoup d'info:
3 gdb /usr/local/adm/src/caml/csl/byterun/ocamlrund core

warning: core file may not match specified executable file.
Core was generated by `/usr/local/adm/src/caml/csl/byterun/ocamlrund /usr/local/adm/src/cash/cashrtop'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from [un paquet de .so]...done.
#0 0x0805f87b in obj_tag (arg=134540081) at obj.c:51
51 return Val_int(Tag_val(arg));
gdb:bt
#0 0x0805f87b in obj_tag (arg=134540081) at obj.c:51
#1 0x08066878 in interprete (prog=0x11, prog_size=100) at interp.c:846

@vicuna
Copy link
Author

vicuna commented Jun 16, 2003

Comment author: administrator

Je viens de découvrir ça:
(sur Linux)
$ /usr/local/adm/src/caml/bin/cashr
Objective Caml version 3.06+34 (2003-05-21)

 Camlp4s Parsing version 3.06+34

Cash.host_info_name "dixie";

Segmentation fault
Comme dixie n'est pas dans le DNS, ça lève une exception
Cash.Netdb_error HOST_NOT_FOUND
qui semble provoquer le seg fault quand ocamlrun tente de l'imprimer ?
(Un try autour de l'appel à host_info_name fonctionne très bien).

Oui, l'argument de l'exception Netdb_error est mal formé.
Le problème semble être dans ton code (fichier cash-prims.c):

CAMLprim value get_h_errno (value syscall)
{
int i, herr;

for (herr = h_errno, i = 0; i < (sizeof (h_errno_values) / sizeof (int)); i++)
{
if (herr == h_errno_values[i])
return Int_val (i);
^^^^^^^

Ça devrait plutôt être Val_int, non?

Amitiés,

  • Xavier

@vicuna
Copy link
Author

vicuna commented Jun 16, 2003

Comment author: administrator

Bug in user C code.

@vicuna vicuna closed this as completed Jun 16, 2003
@vicuna
Copy link
Author

vicuna commented Jun 16, 2003

Comment author: administrator

Désolé de t'avoir fait déboguer mon code. J'ai dû me laisser distraire par
le fait que j'ai vu au moins une fois l'exception correctement imprimée.
Bien qu'à la réflexion ça n'incitait pas plus à croire en un bug du
run-time Caml qu'à me méfier et relire mon code... :-(

Merci,
Bruno.

@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant