Accepting request 638718 from LibreOffice:Factory

OBS-URL: https://build.opensuse.org/request/show/638718
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/foma?expand=0&rev=2
This commit is contained in:
Dominique Leuenberger 2018-10-02 17:40:37 +00:00 committed by Git OBS Bridge
commit d0e05c44b4
6 changed files with 80 additions and 15 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2dbdd391a45d3733f7515f1ab4d8a62a96ce5ff8c57926d76fc186e4d5a0167e
size 135360

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:80855b348f534f9fb026b043d14e501d07b13c5edc1ea5ba52a1e9572c215fb4
size 136220

16
foma-fix-sizeof.patch Normal file
View File

@ -0,0 +1,16 @@
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);
}

29
foma-harden-build.patch Normal file
View File

@ -0,0 +1,29 @@
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

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Thu Sep 27 09:00:24 UTC 2018 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add foma-fix-sizeof.patch to fix segfault on 32-bit (boo#1109949)
-------------------------------------------------------------------
Thu Sep 27 07:28:30 UTC 2018 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to add some linker hardening:
* foma-harden-build.patch
-------------------------------------------------------------------
Thu Sep 27 06:32:24 UTC 2018 - tchvatal@suse.com
- Update to version 0.9.18+git20180511.bad2f09:
* Various small fixes
-------------------------------------------------------------------
Wed May 17 09:33:31 UTC 2017 - tchvatal@suse.com

View File

@ -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 @@ Finite-state C library development files and headers for %{name}.
%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 @@ rm -rf %{buildroot}%{_libdir}/*.a
%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