From d2e5f66588d1af0d0c6624bfb724cb8551268523 Mon Sep 17 00:00:00 2001 From: Tupone Alfredo Date: Sun, 2 Dec 2018 22:05:34 +0100 Subject: dev-tcltk/snack: Stabilize and fix tests Signed-off-by: Alfredo Tupone Package-Manager: Portage-2.3.51, Repoman-2.3.11 --- .../snack/files/snack-2.2.10-debian-args.patch | 154 +++++++++++++++++++++ dev-tcltk/snack/files/snack-2.2.10-test.patch | 22 +++ dev-tcltk/snack/snack-2.2.10-r8.ebuild | 100 +++++++++++++ 3 files changed, 276 insertions(+) create mode 100644 dev-tcltk/snack/files/snack-2.2.10-debian-args.patch create mode 100644 dev-tcltk/snack/files/snack-2.2.10-test.patch create mode 100644 dev-tcltk/snack/snack-2.2.10-r8.ebuild (limited to 'dev-tcltk') diff --git a/dev-tcltk/snack/files/snack-2.2.10-debian-args.patch b/dev-tcltk/snack/files/snack-2.2.10-debian-args.patch new file mode 100644 index 000000000000..1f306d612669 --- /dev/null +++ b/dev-tcltk/snack/files/snack-2.2.10-debian-args.patch @@ -0,0 +1,154 @@ +Patch by Sergei Golovan fixes several cases of access beyond array boundaries. + +--- a/generic/jkFilterIIR.c ++++ b/generic/jkFilterIIR.c +@@ -125,6 +125,12 @@ + return TCL_ERROR; + } + ++ if (arg + 1 == objc) { ++ Tcl_AppendResult(interp, "No argument given for ", ++ optionStrings[index], " option", (char *) NULL); ++ return TCL_ERROR; ++ } ++ + switch ((enum options) index) { + /* size of triangular dithering on output */ + case DITHER: +--- a/generic/jkPitchCmd.c ++++ b/generic/jkPitchCmd.c +@@ -850,7 +850,7 @@ + + for (arg = 2; arg < objc; arg += 2) { + char *opt = Tcl_GetStringFromObj(objv[arg], NULL); +- char *val = Tcl_GetStringFromObj(objv[arg+1], NULL); ++ char *val = (arg + 1 == objc) ? "" : Tcl_GetStringFromObj(objv[arg+1], NULL); + + if ((strcmp("-method", opt) == 0) && (strcasecmp("esps", val) == 0)) { + Get_f0(s, interp, objc, objv); +--- a/generic/jkSoundEdit.c ++++ b/generic/jkSoundEdit.c +@@ -291,6 +291,12 @@ + string = Tcl_GetStringFromObj(objv[arg], &len); + + if (strncmp(string, "-units", len) == 0) { ++ if (arg + 1 == objc) { ++ Tcl_AppendResult(interp, "No argument given for ", ++ string, " option", (char *) NULL); ++ return TCL_ERROR; ++ } ++ + string = Tcl_GetStringFromObj(objv[arg+1], &len); + if (strncasecmp(string, "seconds", len) == 0) type = 1; + if (strncasecmp(string, "samples", len) == 0) type = 0; +@@ -1152,6 +1158,12 @@ + return TCL_ERROR; + } + ++ if (arg + 1 == objc) { ++ Tcl_AppendResult(interp, "No argument given for ", ++ subOptionStrings[index], " option", (char *) NULL); ++ return TCL_ERROR; ++ } ++ + switch ((enum subOptions) index) { + case RATE: + case FREQUENCY: +--- a/generic/shape.c ++++ b/generic/shape.c +@@ -103,6 +103,12 @@ + "option", 0, &index) != TCL_OK) { + return TCL_ERROR; + } ++ if (arg + 1 == objc) { ++ Tcl_AppendResult(interp, "No argument given for ", ++ subOptionStrings[index], " option", (char *) NULL); ++ return TCL_ERROR; ++ } ++ + switch ((enum subOptions) index) { + case START: + { +@@ -155,6 +161,12 @@ + "option", 0, &index) != TCL_OK) { + return TCL_ERROR; + } ++ if (arg + 1 == objc) { ++ Tcl_AppendResult(interp, "No argument given for ", ++ subOptionStrings[index], " option", (char *) NULL); ++ return TCL_ERROR; ++ } ++ + switch ((enum subOptions) index) { + case START: + { +@@ -384,6 +396,12 @@ + "option", 0, &index) != TCL_OK) { + return TCL_ERROR; + } ++ if (arg + 1 == objc) { ++ Tcl_AppendResult(interp, "No argument given for ", ++ subOptionStrings[index], " option", (char *) NULL); ++ return TCL_ERROR; ++ } ++ + switch ((enum subOptions) index) { + case START: + { +--- /dev/null ++++ b/tests/zargs.test +@@ -0,0 +1,54 @@ ++# Tests cover lack of command arguments ++ ++package require -exact snack 2.2 ++ ++if {[lsearch [namespace children] ::tcltest] == -1} { ++ package require tcltest ++ namespace import ::tcltest::* ++} ++ ++test zargs-1.1 {pitch command, with missing argument for -start option} { ++ set s [snack::sound snd -load ex1.wav] ++ catch {$s pitch -start} msg ++ $s destroy ++ set msg ++} {No argument given for -start option} ++ ++test zargs-1.2 {length command, with missing argument for -units option} { ++ set s [snack::sound snd -load ex1.wav] ++ catch {$s length 10 10 -units} msg ++ $s destroy ++ set msg ++} {No argument given for -units option} ++ ++test zargs-1.3 {convert command, with missing argument for -rate option} { ++ set s [snack::sound snd -load ex1.wav] ++ catch {$s convert -rate 1 -rate} msg ++ $s destroy ++ set msg ++} {No argument given for -rate option} ++ ++test zargs-1.4 {iir filter, with missing argument for -denominator option} { ++ set s [snack::sound snd -load ex1.wav] ++ catch {snack::filter iir -denominator} msg ++ $s destroy ++ set msg ++} {No argument given for -denominator option} ++ ++test zargs-1.5 {shape command, with missing argument for -start option} { ++ set s [snack::sound snd -load ex1.wav] ++ catch {$s shape -start 0 -start} msg ++ $s destroy ++ set msg ++} {No argument given for -start option} ++ ++test zargs-1.6 {datasamples command, with missing argument for -start option} { ++ set s [snack::sound snd -load ex1.wav] ++ catch {$s datasamples -start 0 -start} msg ++ $s destroy ++ set msg ++} {No argument given for -start option} ++ ++# cleanup ++::tcltest::cleanupTests ++return diff --git a/dev-tcltk/snack/files/snack-2.2.10-test.patch b/dev-tcltk/snack/files/snack-2.2.10-test.patch new file mode 100644 index 000000000000..724ccd686fc7 --- /dev/null +++ b/dev-tcltk/snack/files/snack-2.2.10-test.patch @@ -0,0 +1,22 @@ +--- a/tests/pitch.test 2018-12-02 21:56:08.315195566 +0100 ++++ b/tests/pitch.test 2018-12-02 21:54:19.853964344 +0100 +@@ -28,7 +28,7 @@ + set res [$s pitch -method ESPS] + $s destroy + set res +-} {{0.0 0.0 0.0 0.7046} {0.0 0.0 773.75 0.65552} {0.0 0.0 818.19 0.24061} {0.0 0.0 813.11 0.56787} {0.0 0.0 808.38 0.51307} {0.0 0.0 826.19 0.49327} {0.0 0.0 856.39 0.9469} {0.0 0.0 851.94 0.0} {0.0 0.0 869.07 0.48861} {0.0 0.0 842.5 0.39768} {0.0 0.0 839.18 0.4009} {0.0 0.0 820.35 0.81465} {0.0 0.0 833.41 0.95806} {0.0 0.0 855.43 0.89539} {0.0 0.0 853.1 0.28335} {0.0 0.0 889.35 0.59169} {0.0 0.0 1070.4 0.68884} {0.0 0.0 878.07 0.5143} {0.0 0.0 893.05 0.3997} {0.0 0.0 873.35 0.68623} {0.0 0.0 965.28 0.57252} {0.0 0.0 882.13 0.49351} {0.0 0.0 1196.0 0.70511} {209.81 1.0 3310.1 0.88756} {162.78 1.0 3659.8 0.99115} {161.92 1.0 3512.8 0.99646} {158.92 1.0 3547.8 0.99354} {155.91 1.0 3468.3 0.98505} {149.48 1.0 3284.6 0.99364} {143.31 1.0 3007.4 0.98736} {133.77 1.0 2823.2 0.94805} {126.48 1.0 2640.0 0.98759} {119.94 1.0 2332.5 0.9852} {112.98 1.0 2040.0 0.95218} {109.81 1.0 2122.5 0.9571} {107.68 1.0 2418.8 0.92161} {106.6 1.0 2507.1 0.95998} {105.57 1.0 2478.7 0.95695} {105.43 1.0 2671.9 0.96458} {106.74 1.0 2706.4 0.98918} {109.0 1.0 2755.5 0.99448} {111.84 1.0 2716.9 0.97564} {115.73 1.0 2274.5 0.87201} {99.183 1.0 920.17 0.60726} {120.34 1.0 860.54 0.84981} {150.88 1.0 2140.9 0.93803} {136.25 1.0 2838.7 0.98336} {141.73 1.0 2877.0 0.99704} {145.06 1.0 2894.6 0.98906} {146.54 1.0 2748.1 0.98797} {149.82 1.0 2700.2 0.94096} {149.23 1.0 2838.5 0.98879} {146.53 1.0 2629.4 0.95378} {141.86 1.0 2179.6 0.97326} {133.37 1.0 1887.6 0.85003} {124.99 1.0 1659.4 0.94212} {117.97 1.0 1442.7 0.96375} {109.74 1.0 1090.7 0.96917} {103.63 1.0 915.58 0.92499} {111.49 1.0 852.97 0.69573} {107.37 1.0 786.45 0.86455} {93.37 1.0 815.31 0.81332} {123.3 1.0 804.19 0.61468} {84.033 1.0 762.64 0.74945} {121.1 1.0 725.97 0.5574} {114.08 1.0 700.18 0.82347} {101.78 1.0 704.91 0.57994} {103.43 1.0 695.82 0.75774} {101.42 1.0 699.76 0.79472} {105.86 1.0 714.6 0.70127} {0.0 0.0 745.64 0.828} {0.0 0.0 736.29 0.64289} {0.0 0.0 696.31 0.40449} {0.0 0.0 684.55 0.44551} {0.0 0.0 639.39 0.38997} {0.0 0.0 561.58 0.0} {0.0 0.0 628.03 0.34976} {0.0 0.0 717.81 0.38937} {0.0 0.0 748.32 0.41932} {0.0 0.0 750.33 0.86962} {0.0 0.0 783.32 0.82826} {0.0 0.0 761.07 0.20038} {0.0 0.0 809.66 0.35076} {0.0 0.0 831.98 0.7714} {0.0 0.0 872.36 0.67117} {0.0 0.0 826.35 0.6413} {0.0 0.0 717.04 0.0} {0.0 0.0 723.39 0.54415} {0.0 0.0 751.84 0.33728} {0.0 0.0 818.29 0.31209} {0.0 0.0 837.27 0.4341} {0.0 0.0 849.58 0.3289} {0.0 0.0 862.31 0.28854} {0.0 0.0 845.67 0.68362} {0.0 0.0 868.24 0.74526}} ++} {{0.0 0.0 0.0 0.7046} {0.0 0.0 773.7 0.65552} {0.0 0.0 818.08 0.24061} {0.0 0.0 813.13 0.56787} {0.0 0.0 808.39 0.51307} {0.0 0.0 826.01 0.49327} {0.0 0.0 856.56 0.9469} {0.0 0.0 851.72 0.0} {0.0 0.0 869.15 0.48861} {0.0 0.0 842.57 0.39768} {0.0 0.0 839.14 0.4009} {0.0 0.0 820.39 0.81465} {0.0 0.0 833.47 0.95806} {0.0 0.0 855.33 0.89539} {0.0 0.0 852.97 0.28335} {0.0 0.0 889.07 0.59169} {0.0 0.0 1070.5 0.68884} {0.0 0.0 878.41 0.5143} {0.0 0.0 892.74 0.3997} {0.0 0.0 873.53 0.68623} {0.0 0.0 965.13 0.57252} {0.0 0.0 882.69 0.49351} {0.0 0.0 1193.0 0.70511} {209.81 1.0 3304.3 0.88756} {162.78 1.0 3660.9 0.99115} {161.92 1.0 3512.7 0.99646} {158.92 1.0 3547.9 0.99354} {155.91 1.0 3468.7 0.98505} {149.48 1.0 3285.3 0.99364} {143.31 1.0 3008.2 0.98736} {133.77 1.0 2823.7 0.94805} {126.48 1.0 2640.8 0.98759} {119.94 1.0 2333.7 0.9852} {112.98 1.0 2040.5 0.95218} {109.81 1.0 2121.6 0.9571} {107.68 1.0 2418.1 0.92161} {106.6 1.0 2507.3 0.95998} {105.57 1.0 2478.0 0.95695} {105.43 1.0 2671.9 0.96458} {106.74 1.0 2706.6 0.98918} {109.0 1.0 2755.4 0.99448} {111.84 1.0 2717.5 0.97564} {115.73 1.0 2277.5 0.87201} {99.183 1.0 924.36 0.60726} {120.34 1.0 859.79 0.84981} {150.88 1.0 2136.3 0.93803} {136.25 1.0 2838.1 0.98336} {141.73 1.0 2877.0 0.99704} {145.06 1.0 2894.6 0.98906} {146.54 1.0 2749.1 0.98797} {149.82 1.0 2699.5 0.94096} {149.23 1.0 2838.4 0.98879} {146.53 1.0 2630.6 0.95378} {141.86 1.0 2181.0 0.97326} {133.37 1.0 1888.3 0.85003} {124.99 1.0 1660.0 0.94212} {117.97 1.0 1443.6 0.96375} {109.74 1.0 1091.7 0.96917} {103.63 1.0 915.75 0.92499} {111.49 1.0 853.13 0.69573} {107.37 1.0 786.42 0.86455} {93.37 1.0 815.44 0.81332} {123.3 1.0 804.05 0.61468} {84.033 1.0 762.98 0.74945} {121.1 1.0 725.91 0.5574} {114.08 1.0 700.22 0.82347} {101.78 1.0 704.95 0.57994} {103.43 1.0 695.87 0.75774} {101.42 1.0 699.81 0.79472} {105.86 1.0 714.47 0.70127} {0.0 0.0 745.7 0.828} {0.0 0.0 736.31 0.64289} {0.0 0.0 696.35 0.40449} {0.0 0.0 684.65 0.44551} {0.0 0.0 639.58 0.38997} {0.0 0.0 561.77 0.0} {0.0 0.0 627.65 0.34976} {0.0 0.0 717.62 0.38937} {0.0 0.0 748.27 0.41932} {0.0 0.0 750.33 0.86962} {0.0 0.0 783.3 0.82826} {0.0 0.0 761.05 0.20038} {0.0 0.0 809.51 0.35076} {0.0 0.0 831.97 0.7714} {0.0 0.0 872.22 0.67117} {0.0 0.0 826.62 0.6413} {0.0 0.0 717.3 0.0} {0.0 0.0 723.3 0.54415} {0.0 0.0 751.75 0.33728} {0.0 0.0 818.03 0.31209} {0.0 0.0 837.29 0.4341} {0.0 0.0 849.53 0.3289} {0.0 0.0 862.33 0.28854} {0.0 0.0 845.65 0.68362} {0.0 0.0 868.25 0.74526}} + + test pitch-2.1 {pitch command, with missing argument for -start option} { + set s [snack::sound snd -load ex1.wav] +--- a/tests/power.test 2018-12-02 21:58:19.319057755 +0100 ++++ b/tests/power.test 2018-12-02 21:56:48.303543173 +0100 +@@ -14,7 +14,7 @@ + set res [$s power] + $s destroy + set res +-} {57.668 58.916 57.992 58.647 58.462 58.415 58.353 58.948 58.897 59.02 58.761 58.745 58.248 58.595 59.158 58.846 58.467 61.37 59.153 59.315 58.301 60.035 59.451 58.963 71.281 71.387 71.13 71.213 71.01 70.635 69.845 68.822 68.986 68.525 67.103 66.664 67.365 67.627 66.72 67.337 67.657 68.365 68.854 68.204 58.26 58.141 66.927 69.789 69.122 69.601 69.076 68.909 69.337 68.621 67.11 65.266 64.678 64.223 61.751 60.287 59.447 57.811 58.444 58.209 57.645 57.279 56.377 56.572 56.467 56.796 57.045 57.735 57.858 57.081 56.943 56.421 54.929 56.202 57.349 57.643 57.477 58.207 57.706 58.385 58.601 59.228 58.694 57.176 57.423 57.733 58.599 58.614 58.771 59.005 58.651 59.077 59.001 58.113 58.374} ++} {57.668 58.916 57.992 58.647 58.463 58.415 58.353 58.948 58.897 59.02 58.761 58.745 58.248 58.595 59.158 58.846 58.467 61.37 59.153 59.315 58.301 60.035 59.451 58.963 71.281 71.387 71.13 71.213 71.01 70.635 69.845 68.822 68.986 68.525 67.103 66.664 67.365 67.627 66.72 67.337 67.657 68.365 68.854 68.204 58.26 58.141 66.927 69.789 69.122 69.601 69.076 68.909 69.337 68.621 67.11 65.266 64.678 64.223 61.751 60.287 59.447 57.811 58.444 58.209 57.645 57.279 56.377 56.572 56.467 56.796 57.045 57.735 57.858 57.081 56.943 56.421 54.929 56.202 57.349 57.643 57.477 58.207 57.706 58.385 58.601 59.228 58.694 57.176 57.423 57.733 58.599 58.614 58.771 59.005 58.651 59.077 59.001 58.113 58.374} + + test power-1.2 {power command} { + set s [snack::sound snd -load ex1.wav] diff --git a/dev-tcltk/snack/snack-2.2.10-r8.ebuild b/dev-tcltk/snack/snack-2.2.10-r8.ebuild new file mode 100644 index 000000000000..773eb22926a0 --- /dev/null +++ b/dev-tcltk/snack/snack-2.2.10-r8.ebuild @@ -0,0 +1,100 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 pypy ) + +inherit autotools distutils-r1 multilib virtualx + +DESCRIPTION="The Snack Sound Toolkit (Tcl)" +HOMEPAGE="http://www.speech.kth.se/snack/" +SRC_URI="http://www.speech.kth.se/snack/dist/${PN}${PV}.tar.gz" + +LICENSE="GPL-2" +KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos" +SLOT="0" +IUSE="alsa examples python vorbis" + +DEPEND=" + dev-lang/tcl:0= + dev-lang/tk:0= + alsa? ( media-libs/alsa-lib ) + python? ( ${PYTHON_DEPS} ) + vorbis? ( media-libs/libvorbis )" +RDEPEND="${DEPEND}" + +S="${WORKDIR}/${PN}${PV}/unix" + +PATCHES=( + "${FILESDIR}"/alsa-undef-sym.patch + "${FILESDIR}"/${P}-CVE-2012-6303-fix.patch + "${FILESDIR}"/${P}-debian-args.patch + "${FILESDIR}"/${P}-test.patch +) + +HTML_DOCS="${WORKDIR}/${PN}${PV}/doc/*" + +src_prepare() { + # adds -install_name (soname on Darwin) + [[ ${CHOST} == *-darwin* ]] && PATCHES+=( "${FILESDIR}"/${P}-darwin.patch ) + + sed \ + -e "s:ar cr:$(tc-getAR) cr:g" \ + -e "s:-O:${CFLAGS}:g" \ + -i Makefile.in || die + + cd .. + + default + + sed \ + -e 's|^\(#define roundf(.*\)|//\1|' \ + -i generic/jkFormatMP3.c || die + rm tests/{play,record}.test || die +} + +src_configure() { + local myconf="" + + use alsa && myconf+=" --enable-alsa" + + if use vorbis; then + myconf+=" --with-ogg-include="${EPREFIX}"/usr/include" + myconf+=" --with-ogg-lib="${EPREFIX}"/usr/$(get_libdir)" + fi + + econf \ + --libdir="${EPREFIX}"/usr/$(get_libdir) \ + --includedir="${EPREFIX}"/usr/include \ + --with-tcl="${EPREFIX}"/usr/$(get_libdir) \ + --with-tk="${EPREFIX}"/usr/$(get_libdir) \ + $myconf +} + +src_compile() { + default +} + +src_test() { + TCLLIBPATH=${S} virtx default | grep FAILED && die +} + +src_install() { + default + + if use python ; then + cd "${S}"/../python || die + distutils-r1_src_install + fi + + cd "${S}"/.. || die + + if use examples ; then + docinto examples + sed -i -e 's/wish[0-9.]+/wish/g' demos/tcl/* || die + dodoc -r demos/tcl + + use python && dodoc -r demos/python + fi +} -- cgit v1.2.3-18-g5258