Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 May 2014 16:46:51 +0300
From:      =?ISO-8859-1?Q?T=F6r=F6k_Edwin?= <edwin@skylable.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/189710: ocamlbuild doesn't handle SIGPIPE
Message-ID:  <5370D0CB.3060704@skylable.com>
Resent-Message-ID: <201405121350.s4CDo1xY036249@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         189710
>Category:       ports
>Synopsis:       ocamlbuild doesn't handle SIGPIPE
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 12 13:50:01 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     edwin
>Release:        FreeBSD 10.0-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD freebsd10.home.lan 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014 root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64



>Description:
        If ocamlfind prints a warning during build then ocamlbuild fails like this:
        /usr/local/bin/ocamlfind ocamlc -where > /usr/ports/devel/ocaml-pcre/work/pcre-ocaml-7.0.4/_build/ocamlc.where
        Command got signal -8.

        If I run the ocamlfind command manually it works, but it prints a warning too:
        ocamlfind: [WARNING] Cannot read directory /usr/ports/devel/ocaml-pcre/work/stage/usr/local/lib/ocaml/site-lib/pcre which is mentioned in ld.conf

        That warnings causes a SIGPIPE in ocamlbuild or somewhere, which causes the signal -8 message to be printed:
        You can use 'truss -f make' to confirm:
        75895: write(2,"ocamlfind: [WARNING] Cannot read"...,146) ERR#32 'Broken pipe'
        75895: SIGNAL 13 (SIGPIPE)
        75895: process exit, rval = 0
        75889: wait4(75895,{ SIGNALED,sig=SIGPIPE },0x0,0x0) = 75895 (0x12877)
        75889: write(1,"\r\^[[K",4)                      = 4 (0x4)
        + ocamlfind ocamlc -where > /usr/ports/textproc/ocaml-text/work/ocaml-text-0.6/_build/ocamlc.where
        75889: write(1,"+ ocamlfind ocamlc -where > /usr"...,103) = 103 (0x67)
        75889: close(4)                                  = 0 (0x0)
        75889: write(3,"+ ocamlfind ocamlc -where > /usr"...,150) = 150 (0x96)
        75889: close(3)                                  = 0 (0x0)
        75889: gettimeofday({1399897227.200087 },0x0)    = 0 (0x0)
        Command got signal -8.

        This is not related to a particular OCaml package, I got this on ocaml-pcre or ocaml-text, but others have encountered this issue elsewhere:
        https://bugzilla.skylable.com/show_bug.cgi?id=470#c3
        https://github.com/the-lambda-church/merlin/issues/193
        https://github.com/the-lambda-church/merlin/issues/183

        I don't know if this is related to GCC or Clang (my system seems to use Clang), but this appears to be a
        FreeBSD-specific problem with ocamlbuild (on Linux I've never seen this error).

>How-To-Repeat:
        Install the ocaml compiler (from source, see other PR as binary package seems to be missing):
        # cd /usr/ports/lang/ocaml
        # make install
        # cd /usr/ports/textproc/ocaml-text
        # make install
        [...]

        Oh this wants to build PCRE, but there's a binary package, ... interrupt the build!
        [..]
        ^C

        Install pcre binary package
        # pkg install pcre

        OK lets resume
        # make install
        [....]
        + /usr/local/bin/ocamlfind ocamlc -where > /usr/ports/devel/ocaml-pcre/work/pcre-ocaml-7.0.4/_build/ocamlc.where
        Command got signal -8.

        Expected behaviour:
        ocamlbuild should print the error message from ocamlfind's stderr, instead of dieing on SIGPIPE!

>Fix:
        Run 'ocamlfind ocamlc -where' manually
        Edit /usr/local/lib/ocaml/ld.conf and remove the lines it complained about
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5370D0CB.3060704>