Hello community, here is the log from the commit of package foma for openSUSE:Factory checked in at 2018-10-02 19:40:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/foma (Old) and /work/SRC/openSUSE:Factory/.foma.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "foma" Tue Oct 2 19:40:37 2018 rev:2 rq:638718 version:0.9.18+git20180511.bad2f09 Changes: -------- --- /work/SRC/openSUSE:Factory/foma/foma.changes 2017-05-18 20:47:24.235018714 +0200 +++ /work/SRC/openSUSE:Factory/.foma.new/foma.changes 2018-10-02 19:40:43.230272107 +0200 @@ -1,0 +2,17 @@ +Thu Sep 27 09:00:24 UTC 2018 - Bernhard Wiedemann <[email protected]> + +- Add foma-fix-sizeof.patch to fix segfault on 32-bit (boo#1109949) + +------------------------------------------------------------------- +Thu Sep 27 07:28:30 UTC 2018 - Tomáš Chvátal <[email protected]> + +- Add patch to add some linker hardening: + * foma-harden-build.patch + +------------------------------------------------------------------- +Thu Sep 27 06:32:24 UTC 2018 - [email protected] + +- Update to version 0.9.18+git20180511.bad2f09: + * Various small fixes + +------------------------------------------------------------------- Old: ---- foma-0.9.18+git20170507.07bb944.tar.xz New: ---- foma-0.9.18+git20180511.bad2f09.tar.xz foma-fix-sizeof.patch foma-harden-build.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ foma.spec ++++++ --- /var/tmp/diff_new_pack.e5OZqm/_old 2018-10-02 19:40:43.714271389 +0200 +++ /var/tmp/diff_new_pack.e5OZqm/_new 2018-10-02 19:40:43.718271383 +0200 @@ -1,7 +1,7 @@ # # spec file for package foma # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,21 +12,24 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define libname libfoma0 Name: foma -Version: 0.9.18+git20170507.07bb944 +Version: 0.9.18+git20180511.bad2f09 Release: 0 Summary: Finite-state compiler and C library License: Apache-2.0 Group: Productivity/Text/Utilities -Url: https://fomafst.github.io/ +URL: https://fomafst.github.io/ # Source must be from git tarball has different license than git, no idea why Source0: foma-%{version}.tar.xz -BuildRequires: flex bison +Patch0: foma-harden-build.patch +Patch1: foma-fix-sizeof.patch +BuildRequires: bison +BuildRequires: flex BuildRequires: ncurses-devel BuildRequires: pkgconfig BuildRequires: readline-devel @@ -61,12 +64,15 @@ %prep %setup -q -n %{name}-%{version}/%{name} +%patch0 -p2 +%patch1 -p2 +sed -i '/^CFLAGS/c\CFLAGS = %{optflags} -Wl,--as-needed -D_GNU_SOURCE -std=c99 -fvisibility=hidden -fPIC' Makefile +sed -i '/^LDFLAGS/c\LDFLAGS = -lreadline -lz -lreadline -fpic' Makefile +sed -i '/^FLOOKUPLDFLAGS/c\FLOOKUPLDFLAGS = libfoma.a -lz -fpic' Makefile %build # hand written Makefile that gets to be quite PITA -make -j1 \ - CFLAGS="%{optflags} -D_GNU_SOURCE -std=c99 -fPIC" \ - LDFLAGS="-lreadline -lz" +make -j1 %install %make_install \ @@ -78,20 +84,17 @@ %postun -n %{libname} -p /sbin/ldconfig %files -%defattr(-,root,root) -%doc COPYING %{_bindir}/cgflookup %{_bindir}/flookup %{_bindir}/foma %files devel -%defattr(-,root,root) %{_includedir}/fomalib.h %{_includedir}/fomalibconf.h %{_libdir}/libfoma.so %files -n %{libname} -%defattr(-,root,root) +%license COPYING %{_libdir}/libfoma.so.* %changelog ++++++ foma-0.9.18+git20170507.07bb944.tar.xz -> foma-0.9.18+git20180511.bad2f09.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/foma-0.9.18+git20170507.07bb944/foma/docs/examples/finnish-ot-verification.foma new/foma-0.9.18+git20180511.bad2f09/foma/docs/examples/finnish-ot-verification.foma --- old/foma-0.9.18+git20170507.07bb944/foma/docs/examples/finnish-ot-verification.foma 2017-05-08 05:04:49.000000000 +0200 +++ new/foma-0.9.18+git20180511.bad2f09/foma/docs/examples/finnish-ot-verification.foma 2018-05-11 19:04:08.000000000 +0200 @@ -37,7 +37,7 @@ ####################################################################### # MH: Part 1: compiles LK's "traditional" analysis with minor changes # -# creating a transducer called "Karttunen" # +# creating a transducer called "Karttunen" (section 7.1.2) # ####################################################################### def HighV [u | y | i]; # LK: High vowel @@ -130,10 +130,10 @@ def KarttunenCollapsed [Karttunen .o. %(|%) -> 0 .o. Collapse .o. "." -> 0].l; ################################################################### -# MH: Part 2: compiles three OT analyses # +# MH: Part 2: compiles three OT analyses (section 7.1.3) # # (1) Kiparsky # # (2) Elenbaas # -# (3) OtNew = fixed version of Elenbaas # +# (3) OtNew = fixed version of Elenbaas (7.1.4) # ################################################################### # MH: The ranking for all are the same. They only differ in one constraint. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/foma-0.9.18+git20170507.07bb944/foma/docs/examples/hixkaryana-ot-verification.foma new/foma-0.9.18+git20180511.bad2f09/foma/docs/examples/hixkaryana-ot-verification.foma --- old/foma-0.9.18+git20170507.07bb944/foma/docs/examples/hixkaryana-ot-verification.foma 2017-05-08 05:04:49.000000000 +0200 +++ new/foma-0.9.18+git20180511.bad2f09/foma/docs/examples/hixkaryana-ot-verification.foma 2018-05-11 19:04:08.000000000 +0200 @@ -21,6 +21,7 @@ # The first analysis is the rule-based one presented in Kager's # "Optimality Theory" (1999), p. 149: +# See also, section 7.2.1 in Phonology article # Step 1: Syllabify. # Step 2: Mark the final syllable of each word as extrametrical. # Step 3: Assign iambs {(L[H]),(L[L]),([H])} iteratively from left to right. [] is stressed @@ -106,7 +107,7 @@ # This fix produces equivalence with the rule-based account. # def UnevenIamb [%( Light "." Light %) | %( Heavy %) ] -> ... {*} ; -# "Feet are parsed by feet" (Kager, p. 153) +# "Syllables are parsed by feet" (Kager, p. 153) def ParseSyl Syllable -> ... {*} || E _ E; # Worsener helper for All-Feet-Left diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/foma-0.9.18+git20170507.07bb944/foma/interface.l new/foma-0.9.18+git20180511.bad2f09/foma/interface.l --- old/foma-0.9.18+git20170507.07bb944/foma/interface.l 2017-05-08 05:04:49.000000000 +0200 +++ new/foma-0.9.18+git20180511.bad2f09/foma/interface.l 2018-05-11 19:04:08.000000000 +0200 @@ -250,7 +250,7 @@ ^{SP}*(test{SP}+null|tnu) { iface_test_null(); } ^{SP}*(test{SP}+lower-universal|tlu) { iface_test_lower_universal(); } ^{SP}*(test{SP}+sequential|tseq) { iface_test_sequential(); } -^{SP}*(test{SP}+upper-univesal|tuu) { iface_test_upper_universal(); } +^{SP}*(test{SP}+upper-universal|tuu) { iface_test_upper_universal(); } ^{SP}*tu(rn?)?({SP}+st(a(ck?)?)?)? { iface_turn(); } ^{SP}*(twosided{SP}+flag-diacritics|tfd) { iface_twosided_flags(); } ^{SP}*und(e(f(i(ne?)?)?)?)?{SP}+ {BEGIN(UNDEFINE);} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/foma-0.9.18+git20170507.07bb944/foma/python/README.md new/foma-0.9.18+git20180511.bad2f09/foma/python/README.md --- old/foma-0.9.18+git20170507.07bb944/foma/python/README.md 2017-05-08 05:04:49.000000000 +0200 +++ new/foma-0.9.18+git20180511.bad2f09/foma/python/README.md 2018-05-11 19:04:08.000000000 +0200 @@ -7,3 +7,29 @@ ## attapply.py This is a stand-alone Python utility for reading AT\&T files and applying transductions. Useful for minimizing dependencies. Also supports weighted transducers, in which case `apply()` returns output strings in least-cost order. + +## phonrule.py + +This is a simple helper tool for debugging foma-scripts that are sequences of phonological rules meant to apply in a certain order. +It assumes a grammar is written as a sequence of define-statements and ordered rewrite-rules combined with a chain-statement (simulating composition of the rules). It then passes words from STDIN through the sequence of transducers and prints a decorated output to STDOUT where rules that fire are shown between brackets. + +Example: + +``` +# myscript.foma +def ARule a -> b || c _ d; # Rule one +def BRule b -> c || _ d; # Rule two +chain ARule, BRule +``` + +We can now run the following, passing the word `cad` through the two transducers and tracing the rule actions: + +``` +$echo "cad" | python phonrule.py myscript.foma +``` + +and the output is + +``` +cad[ARule|Rule one]cbd[BRule|Rule two]ccd +``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/foma-0.9.18+git20170507.07bb944/foma/python/foma.py new/foma-0.9.18+git20180511.bad2f09/foma/python/foma.py --- old/foma-0.9.18+git20170507.07bb944/foma/python/foma.py 2017-05-08 05:04:49.000000000 +0200 +++ new/foma-0.9.18+git20180511.bad2f09/foma/python/foma.py 2018-05-11 19:04:08.000000000 +0200 @@ -17,7 +17,7 @@ # See the License for the specific language governing permissions and # # limitations under the License. # -from sys import maxint +from sys import maxsize from ctypes import * from ctypes.util import find_library @@ -222,7 +222,7 @@ if self.fsthandle.contents.pathcount == -1: # CYCLIC raise ValueError("FSM is cyclic") if self.fsthandle.contents.pathcount == -2: # OVERFLOW - return maxint + return maxsize return self.fsthandle.contents.pathcount else: raise ValueError("FSM not defined") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/foma-0.9.18+git20170507.07bb944/foma/python/phonrule.py new/foma-0.9.18+git20180511.bad2f09/foma/python/phonrule.py --- old/foma-0.9.18+git20170507.07bb944/foma/python/phonrule.py 1970-01-01 01:00:00.000000000 +0100 +++ new/foma-0.9.18+git20180511.bad2f09/foma/python/phonrule.py 2018-05-11 19:04:08.000000000 +0200 @@ -0,0 +1,123 @@ +""" +This is a simple helper tool for debugging foma-scripts +that are sequences of phonological rules meant to apply +in a certain order. It assumes a grammar is written as a +sequence of define-statements and ordered rewrite-rules +combined with a chain-statement (simulating composition +of the rules). It then passes words from STDIN through +the sequence of transducers and prints a decorated output +to STDOUT where rules that fire are shown between brackets. + +Example: + +----myscript.foma---- +def ARule a -> b || c _ d; # Rule one +def BRule b -> c || _ d; # Rule two +chain ARule, BRule +---------------------- + +Now, + +$echo "cad" | python phonrule.py myscript.foma + +produces the output + +cad[ARule|Rule one]cbd[BRule|Rule two]ccd + +Author: Mans Hulden +License: Apache (Version 2.0) +Last Update: 11/07/2016 +""" + +import sys +import re +from foma import * + +import codecs + +class Ruleset: + + def __init__(self): + self.rules = {} + self.comments = {} + self.rc = [] + self.zerosymbols = ['"\u00b7"'] # Special symbols that behave like 0 in rules + + def rule_add(self, rulename, rule, commentline): + """Compiles a rule, adds it to defined FSMs and stores a comment line + and a rule name.""" + + if '->' in rule: + zeroes = '|'.join(self.zerosymbols) + rule = '[~$[' + zeroes + '] .o. [' + rule + ']]/[' + zeroes + ']' + + FST.define(rule, rulename) + myrule = FST(rule) + self.rules[rulename] = myrule + self.comments[rulename] = commentline + + def readrules(self, fomalines): + """Reads foma rules either as define statements, or chain statements. + The input lines may also consist of comments following a hash, e.g. + define Crule C -> 0 || _ C C # Delete first of three C's + define Vrule V -> 0 || _ V V # Delete first of three V's + chain Crule, Vrule + """ + for lineno, l in enumerate(fomalines): + if 'define' in l or 'def ' in l: + rulecom = l.split(' #') + r = re.findall("(defi?n?e?)\s+(\S+)\s+([^;]+)", rulecom[0]) + if len(r[0]) != 3: + print "Syntax error on line %i" % lineno + (_, rulename, rule) = r[0] + if len(rulecom) > 1: + commentline = rulecom[1].strip() + else: + commentline = '' + self.rule_add(rulename, rule, commentline) + if 'chain' in l: + l = l.replace(';','') + chain = re.findall('chain\s+(.*)', l) + rc = chain[0].replace(' ','').split(',') + self.rc = rc + + def applyrules(self, word, printall = True): + """Apply a list of rules simulating composition. + returns a string representation of the derivation.""" + output = [word] + s = output[0] + for rulename in self.rc: + try: + transducer = self.rules[rulename] + except KeyError, e: + key = rulename.decode("utf-8").encode("utf-8") + print 'KeyError: Rule "%s" not found!' % key + raise KeyError('Key not found: '+key); + comment = self.comments[rulename] + newoutput = transducer[output[0]] + if newoutput[0] != output[0] or printall == True: + if comment != '': + s += "[" + rulename + "|" + comment + "]" + else: + s += "[" + rulename + "]" + s += newoutput[0] + output = newoutput + return s + +def main(argv): + if len(sys.argv) < 2: + print "Usage: phonrule.py [foma script]\n" + sys.exit(1) + fomafile = sys.argv[1] + fomalines = [line.rstrip() for line in open(fomafile)] + r = Ruleset() + r.readrules(fomalines) + if len(sys.argv) > 2: + print r.applyrules(sys.argv[2], printall = False) + else: + for w in iter(sys.stdin.readline, ''): + print r.applyrules(w.rstrip(), printall = False) + sys.exit(1) + +if __name__ == "__main__": + main(sys.argv[1:]) ++++++ foma-fix-sizeof.patch ++++++ https://bugzilla.opensuse.org/show_bug.cgi?id=1109949 https://github.com/mhulden/foma/pull/78 Index: foma-0.9.18+git20170507.07bb944/foma/rewrite.c =================================================================== --- foma-0.9.18+git20170507.07bb944.orig/foma/rewrite.c +++ foma-0.9.18+git20170507.07bb944/foma/rewrite.c @@ -103,7 +103,7 @@ struct fsm *fsm_rewrite(struct rewrite_s rb = xxcalloc(1, sizeof(struct rewrite_batch)); rb->rewrite_set = all_rules; rb->num_rules = num_rules; - rb->namestrings = xxmalloc(sizeof rb->namestrings * num_rules); + rb->namestrings = xxmalloc(sizeof *rb->namestrings * num_rules); for (i = 0; i < rb->num_rules; i++) { sprintf(rb->namestrings[i], "@#%04i@", i+1); } ++++++ foma-harden-build.patch ++++++ diff -Naur foma-0fa48dbacfe39509577ae6741054be7c05a19aac.orig/foma/Makefile foma-0fa48dbacfe39509577ae6741054be7c05a19aac/foma/Makefile --- foma-0fa48dbacfe39509577ae6741054be7c05a19aac.orig/foma/Makefile 2015-06-13 19:50:43.000000000 +0300 +++ foma-0fa48dbacfe39509577ae6741054be7c05a19aac/foma/Makefile 2018-08-05 13:48:07.836080649 +0300 @@ -23,13 +23,13 @@ all: libfoma foma flookup cgflookup foma: $(FOMAOBJS) $(LIBOBJS) - $(CC) $(CFLAGS) $(FOMAOBJS) $(LIBOBJS) $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) -pie -Wl,-z,now $(FOMAOBJS) $(LIBOBJS) $(LDFLAGS) -o $@ flookup: flookup.o libfoma - $(CC) $(CFLAGS) flookup.o $(FLOOKUPLDFLAGS) -o $@ + $(CC) $(CFLAGS) -pie -Wl,-z,now flookup.o $(FLOOKUPLDFLAGS) -o $@ cgflookup: cgflookup.o libfoma - $(CC) $(CFLAGS) cgflookup.o $(FLOOKUPLDFLAGS) -o $@ + $(CC) $(CFLAGS) -pie -Wl,-z,now cgflookup.o $(FLOOKUPLDFLAGS) -o $@ STATICLIB = libfoma.a @@ -68,7 +68,7 @@ $(SHAREDLIBV): $(LIBOBJS) $(AR) $(ARFLAGS) $(STATICLIB) $(LIBOBJS) $(RANLIB) $(STATICLIB) - $(CC) $(CFLAGS) -shared -Wl,$(DFLAG),$(SHAREDLIBM) -o $(SHAREDLIBV) $(LIBOBJS) $(LDFLAGS) + $(CC) $(CFLAGS) -shared -Wl,-z,now,$(DFLAG),$(SHAREDLIBM) -o $(SHAREDLIBV) $(LIBOBJS) $(LDFLAGS) install: foma libfoma -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
