pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/48462: Programs in OCaml crashes when calling gethostbyname



>Number:         48462
>Category:       pkg
>Synopsis:       Programs in OCaml crashes when calling gethostbyname
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 20 10:05:00 +0000 2013
>Originator:     Germain Le Chapelain
>Release:        HEAD
>Organization:
>Environment:
bash-4.2# uname -a
NetBSD germ 6.99.26 NetBSD 6.99.26 (germ) #0: Fri Nov 15 23:43:33 UTC 2013  
german@germ:/usr/obj/sys/arch/amd64/compile/germ amd64

>Description:
Programs in OCaml (such as mldonkey) crashes when calling gethostbyname.

I didn't completely understand, but it seems like there is a function 
gethostbyname_r that ocaml config script checks for.
NetBSD seems to have the function defined, but not declared, which I am 
assuming silently detect the first gethostbyname_r checked for, and use the 
implicit declaration of it when building ocaml,

I am on amd64.  This started breaking recently, probably after upgrading to 6.
>How-To-Repeat:
This program

open Unix

let () =
  let resolve name =
    try
      let he = gethostbyname name in
      Printf.printf "%d %d %s\n%!" (Array.length he.h_aliases) (Array.length 
he.h_addr_list) name
    with Not_found ->
      Printf.printf "- - %s\n%!" name
  in
  List.iter resolve ["www.google.com"; "www.free.fr"]


would crash for me in AllocEntry().
>Fix:
I have added this to patch-configure

@@ -1141,6 +1150,7 @@ if sh ./hasgot pwrite; then
   echo "#define HAS_PWRITE" >> s.h
 fi
 
+if test "$system" != "netbsd"
 nargs=none
 for i in 5 6; do
   if sh ./trycompile -DNUM_ARGS=${i} gethostbyname.c; then nargs=$i; break; fi
@@ -1158,6 +1168,7 @@ if test $nargs != "none"; then
   echo "gethostbyaddr_r() found (with ${nargs} arguments)."
   echo "#define HAS_GETHOSTBYADDR_R $nargs" >> s.h
 fi
+fi
 
 # Determine if the debugger is supported
 



Home | Main Index | Thread Index | Old Index