Package: release.debian.org
Severity: normal
Tags: stretch
User: release.debian....@packages.debian.org
Usertags: pu

The current liquidsoap package in stable segfaults imediately on run.
Details are in bug #812591. The segfault is due to Ocaml version 4.02
which is present in stable. The fix upstream has been applied here
(sourced from Ubuntu where it has been working since 17.10). It is part
of the version currently in buster and unstable.

I have tested it within a stable chroot (install and execution of simple
scripts).

Please accept the attached patch if possible. I have someone willing to
sponsor the upload.

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_ZA.UTF-8, LC_CTYPE=en_ZA.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_ZA:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru liquidsoap-1.1.1/debian/changelog liquidsoap-1.1.1/debian/changelog
--- liquidsoap-1.1.1/debian/changelog   2016-11-29 21:37:34.000000000 +0000
+++ liquidsoap-1.1.1/debian/changelog   2018-12-01 18:41:23.000000000 +0000
@@ -1,3 +1,9 @@
+liquidsoap (1.1.1-7.2+deb9u1) stretch; urgency=medium
+
+  * Fix compilation with Ocaml 4.02 (Closes: #812591)
+  * Added new uploader
+
+ -- Kyle Robbertze <krobber...@gmail.com>  Sat, 01 Dec 2018 20:41:23 +0200
+
 liquidsoap (1.1.1-7.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru liquidsoap-1.1.1/debian/control liquidsoap-1.1.1/debian/control
--- liquidsoap-1.1.1/debian/control     2016-11-29 21:35:41.000000000 +0000
+++ liquidsoap-1.1.1/debian/control     2018-12-01 18:38:23.000000000 +0000
@@ -3,6 +3,7 @@
 Priority: optional
 Maintainer: Debian OCaml Maintainers <debian-ocaml-ma...@lists.debian.org>
 Uploaders:
+ Kyle Robbertze <krobber...@gmail.com>,
  Romain Beauxis <to...@rastageeks.org>,
  Samuel Mimram <smim...@debian.org>
 Build-Depends:
diff -Nru liquidsoap-1.1.1/debian/files liquidsoap-1.1.1/debian/files
--- liquidsoap-1.1.1/debian/files       2016-11-29 21:37:34.000000000 +0000
+++ liquidsoap-1.1.1/debian/files       1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-liquidsoap_1.1.1-7.2_source.buildinfo sound optional
diff -Nru 
liquidsoap-1.1.1/debian/patches/bf0640779b2e7095e01755d3660c7e3f0865171d.patch 
liquidsoap-1.1.1/debian/patches/bf0640779b2e7095e01755d3660c7e3f0865171d.patch
--- 
liquidsoap-1.1.1/debian/patches/bf0640779b2e7095e01755d3660c7e3f0865171d.patch  
    1970-01-01 00:00:00.000000000 +0000
+++ 
liquidsoap-1.1.1/debian/patches/bf0640779b2e7095e01755d3660c7e3f0865171d.patch  
    2018-12-01 18:37:32.000000000 +0000
@@ -0,0 +1,456 @@
+From bf0640779b2e7095e01755d3660c7e3f0865171d Mon Sep 17 00:00:00 2001
+From: Romain Beauxis <to...@rastageeks.org>
+Date: Thu, 14 May 2015 14:38:40 -0500
+Subject: [PATCH] More stuff to compile with 3.12.1 -> 4.03.0
+
+---
+ src/Makefile                     |  2 +-
+ src/decoder/decoder.ml           |  6 +--
+ src/decoder/image_decoder.ml     |  2 +-
+ src/decoder/ogg_decoder.ml       |  2 +-
+ src/encoder/encoder.ml           |  2 +-
+ src/encoder/taglib_id3v2.ml      |  2 +-
+ src/lang/lang_builtins.ml        |  8 ++--
+ src/lang/lang_encoders.ml        | 86 ++++++++++++++++++++--------------------
+ src/lang/lang_pp.ml              |  2 +-
+ src/lang/lang_types.ml           |  2 +-
+ src/operators/frei0r_op.ml       |  2 +-
+ src/operators/setvol.ml          |  2 +-
+ src/outputs/harbor_output.camlp4 |  2 +-
+ src/outputs/harbor_output.ml     |  6 +--
+ src/outputs/icecast2.ml          |  2 +-
+ src/playlists/playlist_basic.ml  |  2 +-
+ src/protocols/mpd.ml             |  2 +-
+ src/request.ml                   |  2 +-
+ src/stream/frame.ml              |  2 +-
+ src/tools/harbor.camlp4          | 12 +++---
+ src/tools/harbor.ml              | 17 +++++---
+ src/tools/http.ml                |  8 ++--
+ src/tools/plug.ml                |  4 +-
+ src/tools/utils.ml               | 60 ++++++++++++++++++++++++++--
+ 24 files changed, 147 insertions(+), 90 deletions(-)
+
+Index: liquidsoap-1.1.1/src/Makefile
+===================================================================
+--- liquidsoap-1.1.1.orig/src/Makefile
++++ liquidsoap-1.1.1/src/Makefile
+@@ -173,7 +173,7 @@ $(call conditional_compilation,io,$(W_OS
+ $(call conditional_compilation,io,$(W_PULSEAUDIO),io/pulseaudio_io.ml)
+ $(call conditional_compilation,io,$(W_PORTAUDIO),io/portaudio_io.ml)
+ 
+-tools = tools/stdlib.ml tools/doc.ml tools/plug.ml tools/utils.ml \
++tools = tools/stdlib.ml tools/doc.ml tools/utils.ml tools/plug.ml \
+       $(if $(W_DYNLINK),tools/dyntools.ml) \
+       tools/rqueue.ml \
+       $(if $(W_LAME_DYN),tools/lame_dynlink.ml) \
+Index: liquidsoap-1.1.1/src/decoder/decoder.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/decoder/decoder.ml
++++ liquidsoap-1.1.1/src/decoder/decoder.ml
+@@ -277,7 +277,7 @@ let get_image_file_decoder filename =
+   with
+   | Pervasives.Exit -> !ans
+ 
+-exception Exit of stream_decoder
++exception Exit_decoder of stream_decoder
+ 
+ let get_stream_decoder mime kind =
+   try
+@@ -287,13 +287,13 @@ let get_stream_decoder mime kind =
+          match try decoder mime kind with _ -> None with
+            | Some f ->
+                log#f 3 "Method %S accepted %S." name mime ;
+-               raise (Exit f)
++               raise (Exit_decoder f)
+            | None -> ()) (get_decoders conf_stream_decoders
+                                        stream_decoders);
+     log#f 3 "Unable to decode stream of type %S!" mime ;
+     None
+   with
+-    | Exit f -> Some f
++    | Exit_decoder f -> Some f
+ 
+ (** {1 Helpers for defining decoders} *)
+ 
+Index: liquidsoap-1.1.1/src/decoder/ogg_decoder.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/decoder/ogg_decoder.ml
++++ liquidsoap-1.1.1/src/decoder/ogg_decoder.ml
+@@ -167,7 +167,7 @@ let create_decoder ?(merge_tracks=false)
+         let metas = Hashtbl.create 10 in
+         List.iter 
+           (fun (x,y) -> 
+-            Hashtbl.add metas (String.lowercase x) y)
++            Hashtbl.add metas (Utils.StringCompat.lowercase_ascii x) y)
+             m;
+         Hashtbl.add metas "vendor" v;
+         Generator.add_metadata buffer metas
+Index: liquidsoap-1.1.1/src/encoder/encoder.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/encoder/encoder.ml
++++ liquidsoap-1.1.1/src/encoder/encoder.ml
+@@ -53,7 +53,7 @@ module Meta :
+     let export_metadata m =
+       let ret = Hashtbl.create 10 in
+       let l = conf_export_metadata#get in
+-      Hashtbl.iter (fun x y -> if List.mem (String.lowercase x) l then
++      Hashtbl.iter (fun x y -> if List.mem 
(Utils.StringCompat.lowercase_ascii x) l then
+                                Hashtbl.add ret x y) m;
+     ret
+     let to_metadata m = m
+Index: liquidsoap-1.1.1/src/encoder/taglib_id3v2.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/encoder/taglib_id3v2.ml
++++ liquidsoap-1.1.1/src/encoder/taglib_id3v2.ml
+@@ -35,7 +35,7 @@ let render m =
+     try
+       Hashtbl.iter
+         (fun k x ->
+-          if (String.uppercase l) = (String.uppercase k) then
++          if (Utils.StringCompat.uppercase_ascii l) = 
(Utils.StringCompat.uppercase_ascii k) then
+            raise (Found x)) m ;
+      t
+     with
+Index: liquidsoap-1.1.1/src/lang/lang_builtins.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/lang/lang_builtins.ml
++++ liquidsoap-1.1.1/src/lang/lang_builtins.ml
+@@ -810,9 +810,9 @@ let () =
+        let string = Lang.to_string (List.assoc "" p) in
+        Lang.string
+          (if lower then
+-           String.lowercase(string)
++           Utils.StringCompat.lowercase_ascii string
+           else
+-           String.uppercase(string)))
++           Utils.StringCompat.uppercase_ascii string))
+ 
+ let () =
+   add_builtin "string.capitalize" ~cat:String
+@@ -830,9 +830,9 @@ let () =
+        let string = Lang.to_string (List.assoc "" p) in
+        let f s =
+            if cap then
+-             String.capitalize(s)
++             Utils.StringCompat.capitalize_ascii s
+            else
+-             String.uncapitalize(s)
++             Utils.StringCompat.uncapitalize_ascii s
+       in
+       Lang.string
+       (if space_sensitive then
+Index: liquidsoap-1.1.1/src/lang/lang_pp.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/lang/lang_pp.ml
++++ liquidsoap-1.1.1/src/lang/lang_pp.ml
+@@ -386,7 +386,7 @@ let expand_define tokenizer =
+       (
+         match tokenizer lexbuf with
+         | Lang_parser.VAR x ->
+-          if x <> String.uppercase x then raise Parsing.Parse_error;
++          if x <> Utils.StringCompat.uppercase_ascii x then raise 
Parsing.Parse_error;
+           (
+             match tokenizer lexbuf with
+             | Lang_parser.INT _
+Index: liquidsoap-1.1.1/src/lang/lang_types.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/lang/lang_types.ml
++++ liquidsoap-1.1.1/src/lang/lang_types.ml
+@@ -200,7 +200,7 @@ let repr ?(filter_out=fun _->false) ?(ge
+           try
+             Hashtbl.find evars i
+           with Not_found ->
+-            let name = String.uppercase (name (counter ())) in
++            let name = Utils.StringCompat.uppercase_ascii (name (counter ())) 
in
+               Hashtbl.add evars i name ;
+               name
+         in
+Index: liquidsoap-1.1.1/src/operators/frei0r_op.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/operators/frei0r_op.ml
++++ liquidsoap-1.1.1/src/operators/frei0r_op.ml
+@@ -308,7 +308,7 @@ let register_plugin fname =
+   in
+   let explanation =
+     let e = info.Frei0r.explanation in
+-    let e = String.capitalize e in
++    let e = Utils.StringCompat.capitalize_ascii e in
+     let e = Pcre.substitute ~pat:"@" ~subst:(fun _ -> "(at)") e in
+     if e = "" then e else
+       if e.[String.length e - 1] = '.' then
+Index: liquidsoap-1.1.1/src/operators/setvol.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/operators/setvol.ml
++++ liquidsoap-1.1.1/src/operators/setvol.ml
+@@ -86,5 +86,5 @@ let () =
+        let c = Lang.to_float_getter (Lang.assoc "" 1 p) in
+        let s = Lang.to_source (Lang.assoc "" 2 p) in
+        let o = Lang.to_string (Lang.assoc "override" 1 p) in
+-       let o = if o = "" then None else Some (String.lowercase o) in
++       let o = if o = "" then None else Some 
(Utils.StringCompat.lowercase_ascii o) in
+          new amplify ~kind s o c)
+Index: liquidsoap-1.1.1/src/outputs/icecast2.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/outputs/icecast2.ml
++++ liquidsoap-1.1.1/src/outputs/icecast2.ml
+@@ -243,7 +243,7 @@ class output ~kind p =
+            "ISO-8859-1"
+          else
+            "UTF-8"
+-      | s -> String.uppercase s
++      | s -> Utils.StringCompat.uppercase_ascii s
+   in
+ 
+   let source = Lang.assoc "" 2 p in
+Index: liquidsoap-1.1.1/src/playlists/playlist_basic.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/playlists/playlist_basic.ml
++++ liquidsoap-1.1.1/src/playlists/playlist_basic.ml
+@@ -77,7 +77,7 @@ let parse_scpls ?pwd string =
+   test_text string ;
+   let string = Pcre.replace ~pat:"#[^\\r\\n]*[\\n\\r]+" string in
+   (* Format check, raise Not_found if invalid *)
+-  ignore(Pcre.exec ~pat:"^[\\r\\n\\s]*\\[playlist\\]" (String.lowercase 
string)) ;
++  ignore(Pcre.exec ~pat:"^[\\r\\n\\s]*\\[playlist\\]" 
(Utils.StringCompat.lowercase_ascii string)) ;
+   let lines = split_lines string in
+   let urls =
+     List.map
+Index: liquidsoap-1.1.1/src/request.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/request.ml
++++ liquidsoap-1.1.1/src/request.ml
+@@ -351,7 +351,7 @@ let local_check t =
+                      let ans = resolver name in
+                        List.iter
+                          (fun (k,v) ->
+-                           let k = String.lowercase k in
++                           let k = Utils.StringCompat.lowercase_ascii k in
+                            if conf_override_metadata#get || get_metadata t k 
= None then
+                              Hashtbl.replace indicator.metadata
+                               k (cleanup v))
+Index: liquidsoap-1.1.1/src/tools/harbor.camlp4
+===================================================================
+--- liquidsoap-1.1.1.orig/src/tools/harbor.camlp4
++++ liquidsoap-1.1.1/src/tools/harbor.camlp4
+@@ -95,7 +95,7 @@ type verb = [
+ ]
+ 
+ let verb_of_string s =
+-  match (String.uppercase s) with
++  match (Utils.StringCompat.uppercase_ascii s) with
+     | "GET"     -> `Get
+     | "POST"    -> `Post
+     | "PUT"     -> `Put
+@@ -105,7 +105,7 @@ let verb_of_string s =
+     | _ -> raise Not_found
+ 
+ let verb_or_source_of_string s =
+-  match (String.uppercase s) with
++  match (Utils.StringCompat.uppercase_ascii s) with
+     | "SOURCE"  -> `Source
+     | _         -> verb_of_string s
+ 
+@@ -158,7 +158,7 @@ exception Assoc of string
+ let assoc_uppercase x y =
+   try
+     List.iter
+-      (fun (l,v) -> if String.uppercase l = x then
++      (fun (l,v) -> if Utils.StringCompat.uppercase_ascii l = x then
+                      raise (Assoc v)) y ;
+     raise Not_found
+   with
+@@ -210,7 +210,7 @@ let parse_http_request_line r =
+    duppy_return
+      (protocol,
+       List.nth data 1,
+-     (match (String.uppercase (List.nth data 2)) with
++     (match (Utils.StringCompat.uppercase_ascii (List.nth data 2)) with
+         | "HTTP/1.0" -> `Http_10
+         | "HTTP/1.1" -> `Http_11
+         | "ICE/1.0"  -> `Ice_10
+@@ -232,7 +232,7 @@ let parse_headers headers =
+     with
+       | Not_found -> l
+   in
+-  let f x = String.uppercase x in
++  let f x = Utils.StringCompat.uppercase_ascii x in
+   let headers = List.fold_right split_header headers [] in
+   let display_headers =
+     List.filter
+@@ -449,7 +449,7 @@ let handle_http_request ~hmethod ~hproto
+                let in_enc =
+                 try
+                  let enc = 
+-                   match String.uppercase (Hashtbl.find args "charset") with
++                   match Utils.StringCompat.uppercase_ascii (Hashtbl.find 
args "charset") with
+                      | "LATIN1" -> "ISO-8859-1"
+                      | s        -> s
+                  in
+Index: liquidsoap-1.1.1/src/tools/harbor.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/tools/harbor.ml
++++ liquidsoap-1.1.1/src/tools/harbor.ml
+@@ -82,7 +82,7 @@ type verb =
+   ]
+ 
+ let verb_of_string s =
+-  match String.uppercase s with
++  match Utils.StringCompat.uppercase_ascii s with
+   | "GET" -> `Get
+   | "POST" -> `Post
+   | "PUT" -> `Put
+@@ -92,7 +92,9 @@ let verb_of_string s =
+   | _ -> raise Not_found
+   
+ let verb_or_source_of_string s =
+-  match String.uppercase s with | "SOURCE" -> `Source | _ -> verb_of_string s
++  match Utils.StringCompat.uppercase_ascii s with
++  | "SOURCE" -> `Source
++  | _ -> verb_of_string s
+   
+ let string_of_verb =
+   function
+@@ -139,7 +141,9 @@ let assoc_uppercase x y =
+   try
+     (List.iter
+        (fun (l, v) ->
+-          if (String.uppercase l) = x then raise (Assoc v) else ())
++          if (Utils.StringCompat.uppercase_ascii l) = x
++          then raise (Assoc v)
++          else ())
+        y;
+      raise Not_found)
+   with | Assoc s -> s
+@@ -193,7 +197,7 @@ let parse_http_request_line r =
+     in
+       Duppy.Monad.return
+         (protocol, (List.nth data 1),
+-         (match String.uppercase (List.nth data 2) with
++         (match Utils.StringCompat.uppercase_ascii (List.nth data 2) with
+           | "HTTP/1.0" -> `Http_10
+           | "HTTP/1.1" -> `Http_11
+           | "ICE/1.0" -> `Ice_10
+@@ -211,7 +215,7 @@ let parse_headers headers =
+       let sub = Pcre.exec ~rex h
+       in ((Pcre.get_substring sub 1), (Pcre.get_substring sub 2)) :: l
+     with | Not_found -> l in
+-  let f x = String.uppercase x in
++  let f x = Utils.StringCompat.uppercase_ascii x in
+   let headers = List.fold_right split_header headers [] in
+   let display_headers =
+     List.filter
+@@ -417,7 +421,8 @@ let handle_http_request ~hmethod ~hproto
+                                     let in_enc =
+                                       try
+                                         let enc =
+-                                          match String.uppercase
++                                          match Utils.StringCompat.
++                                                  uppercase_ascii
+                                                   (Hashtbl.find args
+                                                      "charset")
+                                           with
+Index: liquidsoap-1.1.1/src/tools/plug.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/tools/plug.ml
++++ liquidsoap-1.1.1/src/tools/plug.ml
+@@ -32,7 +32,7 @@ object (self)
+   val mutable aliases : (string*'a) list = []
+ 
+   method register plugin ?plugin_aliases ?doc ?sdoc v =
+-    let plugin = if insensitive then String.uppercase plugin else plugin in
++    let plugin = if insensitive then Utils.StringCompat.uppercase_ascii 
plugin else plugin in
+     let doc = match doc,sdoc with
+       | (Some d), _ -> d
+       | _, None -> Doc.trivial "(no doc)"
+@@ -64,7 +64,7 @@ object (self)
+     List.iter (fun (k,v) -> f k v) plugins
+   method get_all = plugins
+   method get plugin =
+-    let plugin = if insensitive then String.uppercase plugin else plugin in
++    let plugin = if insensitive then Utils.StringCompat.uppercase_ascii 
plugin else plugin in
+       try
+         Some (List.assoc plugin plugins)
+       with
+Index: liquidsoap-1.1.1/src/tools/utils.ml
+===================================================================
+--- liquidsoap-1.1.1.orig/src/tools/utils.ml
++++ liquidsoap-1.1.1/src/tools/utils.ml
+@@ -96,7 +96,59 @@ let hashtbl_get : ('a,'b) Hashtbl.t -> '
+   fun h k ->
+     try Some (Hashtbl.find h k) with Not_found -> None
+ 
+-(** Unescapt a string. *)
++(* Backward-compatible API.. *)
++
++module LazyCompat =
++struct
++  let from_fun f = lazy (f ())
++  let from_val v = lazy v
++  (* Make compiler happy.. *)
++  let () =
++    ignore(from_fun (fun () -> ()));
++    ignore(from_val ())
++  include Lazy
++end
++
++exception Not_implemented
++
++module type StringWrapper =
++sig
++  include module type of String
++  val capitalize : string -> string
++  val uncapitalize : string -> string
++  val lowercase : string -> string
++  val uppercase : string -> string
++end
++
++module StringWrapper : StringWrapper =
++struct
++  let capitalize _ = raise Not_implemented
++  let uncapitalize _ = raise Not_implemented
++  let lowercase _ = raise Not_implemented
++  let uppercase _ = raise Not_implemented
++  let () =
++    let e f = try ignore(f "") with Not_implemented -> () in
++    e capitalize; e uncapitalize;
++    e lowercase; e uppercase
++  include String
++end
++
++module StringCompat =
++struct
++  let capitalize_ascii = StringWrapper.capitalize
++  let uncapitalize_ascii = StringWrapper.uncapitalize
++  let lowercase_ascii = StringWrapper.lowercase
++  let uppercase_ascii = StringWrapper.uppercase
++
++  let () =
++    let e f = try ignore(f "") with Not_implemented -> () in
++    e capitalize_ascii; e uncapitalize_ascii;
++    e lowercase_ascii; e uppercase_ascii
++
++  include String
++end
++
++(** Unescape a string. *)
+ let unescape s =
+   try
+     Scanf.sscanf s "%S" (fun u -> u)
+@@ -568,7 +620,7 @@ let get_ext s =
+  try
+   let rex = Pcre.regexp "\\.([a-zA-Z0-9]+)[^.]*$" in
+   let ret = Pcre.exec ~rex s in
+-  String.lowercase (Pcre.get_substring ret 1)
++  StringCompat.lowercase_ascii (Pcre.get_substring ret 1)
+  with
+    | _ -> raise Not_found
+ 
+@@ -604,7 +656,7 @@ let normalize_parameter_string s =
+   let s = Pcre.substitute ~pat:" +$" ~subst:(fun _ -> "") s in
+   let s = Pcre.substitute ~pat:"( +|/+|-+)" ~subst:(fun _ -> "_") s in
+   let s = Pcre.substitute ~pat:"\"" ~subst:(fun _ -> "") s in
+-  let s = String.lowercase s in
++  let s = StringCompat.lowercase_ascii s in
+   (* Identifiers cannot begin with a digit. *)
+   let s = if Pcre.pmatch ~pat:"^[0-9]" s then "_"^s else s in
+   s
diff -Nru liquidsoap-1.1.1/debian/patches/series 
liquidsoap-1.1.1/debian/patches/series
--- liquidsoap-1.1.1/debian/patches/series      2016-01-10 10:51:34.000000000 
+0000
+++ liquidsoap-1.1.1/debian/patches/series      2018-12-01 18:37:52.000000000 
+0000
@@ -1,3 +1,4 @@
 fdkaad-dynlink.patch
 shine_abi_3
 0001-Stop-tracking-files-generated-by-camlp4.patch
+bf0640779b2e7095e01755d3660c7e3f0865171d.patch

Reply via email to