diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8248e33 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/libpaper_1.1.28.tar.gz diff --git a/.libpaper.metadata b/.libpaper.metadata new file mode 100644 index 0000000..8c2329d --- /dev/null +++ b/.libpaper.metadata @@ -0,0 +1 @@ +c6583fbdaebe091d11d81c4e59514e58996f22ba SOURCES/libpaper_1.1.28.tar.gz diff --git a/SOURCES/libpaper-file-leak.patch b/SOURCES/libpaper-file-leak.patch new file mode 100644 index 0000000..47b878b --- /dev/null +++ b/SOURCES/libpaper-file-leak.patch @@ -0,0 +1,22 @@ +diff -up libpaper-1.1.24+nmu5/lib/paper.c.file-leak libpaper-1.1.24+nmu5/lib/paper.c +--- libpaper-1.1.24+nmu5/lib/paper.c.file-leak 2018-03-09 16:21:01.028345956 +0100 ++++ libpaper-1.1.24+nmu5/lib/paper.c 2018-03-09 16:40:57.824279357 +0100 +@@ -140,7 +140,7 @@ char* systempapername(void) { + char* paperstr; + char* paperenv; + const char* paperdef; +- FILE* ps; ++ FILE* ps = NULL; + struct stat statbuf; + const struct paper* pp; + int c; +@@ -224,6 +224,9 @@ PAPERSIZEVAR, fall-back to the old behav + } + } + ++ if (ps) ++ fclose(ps); ++ + paperdef = defaultpapername(); + paperstr = malloc((strlen(paperdef) + 1) * sizeof(char)); + diff --git a/SOURCES/libpaper-useglibcfallback.patch b/SOURCES/libpaper-useglibcfallback.patch new file mode 100644 index 0000000..1216055 --- /dev/null +++ b/SOURCES/libpaper-useglibcfallback.patch @@ -0,0 +1,80 @@ +diff -up libpaper-1.1.24+nmu3/lib/paper.c.useglibcfallback libpaper-1.1.24+nmu3/lib/paper.c +--- libpaper-1.1.24+nmu3/lib/paper.c.useglibcfallback 2010-04-24 08:12:11.000000000 -0400 ++++ libpaper-1.1.24+nmu3/lib/paper.c 2014-04-22 15:58:33.120039001 -0400 +@@ -20,6 +20,9 @@ + + #include + ++#include ++#include ++ + #include "paper.h" + + struct paper { +@@ -108,6 +111,27 @@ in PAPERCONFVAR, fall-back to the old be + } + + const char* defaultpapername(void) { ++#if defined(LC_PAPER) && defined(_GNU_SOURCE) ++ ++#define NL_PAPER_GET(x) \ ++ ((union { char *string; unsigned int word; })nl_langinfo(x)).word ++ ++#define PT_TO_MM(v) (unsigned int)((v * 2.54 * 10 / 72) + 0.5) ++ ++ const struct paper* pp; ++ ++ unsigned int w = NL_PAPER_GET(_NL_PAPER_WIDTH); ++ unsigned int h = NL_PAPER_GET(_NL_PAPER_HEIGHT); ++ ++ for (pp = paperfirst(); pp; pp = papernext(pp)) { ++ if ( ++ PT_TO_MM(pp->pswidth) == w && ++ PT_TO_MM(pp->psheight) == h ++ ) { ++ return pp->name; ++ } ++ } ++#endif + return PAPERSIZE; + } + +diff -up libpaper-1.1.24+nmu3/man/paperconf.1.in.useglibcfallback libpaper-1.1.24+nmu3/man/paperconf.1.in +--- libpaper-1.1.24+nmu3/man/paperconf.1.in.useglibcfallback 2014-04-22 15:58:33.121038995 -0400 ++++ libpaper-1.1.24+nmu3/man/paperconf.1.in 2014-04-22 16:00:15.973428376 -0400 +@@ -48,10 +48,12 @@ looking in order at the + .B @PAPERSIZEVAR@ + environment variable, at the contents of the file specified by the + .B @PAPERCONFVAR@ +-environment variable, at the contents of ++environment variable, at the contents of the file + .B @PAPERCONF@ +-or by using +-.B letter ++, consulting the values controlled by the ++.B LC_PAPER ++locale setting, or by using ++.B @PAPERSIZE@ + as a fall-back value if none of the other alternatives are successful. + By default, width and height of the paper are printed in PostScript points. + .SH OPTIONS +diff -up libpaper-1.1.24+nmu3/src/paperconf.c.useglibcfallback libpaper-1.1.24+nmu3/src/paperconf.c +--- libpaper-1.1.24+nmu3/src/paperconf.c.useglibcfallback 2012-05-03 15:05:12.000000000 -0400 ++++ libpaper-1.1.24+nmu3/src/paperconf.c 2014-04-22 15:58:33.121038995 -0400 +@@ -13,6 +13,7 @@ + #include + + #include ++#include + + + /* needed for GNU/Hurd */ +@@ -99,6 +100,8 @@ int main(int argc, char** argv) + + const char* progname; + ++ setlocale(LC_ALL, ""); ++ + progname = strrchr(*argv, '/'); + if (progname) { + ++progname; diff --git a/SPECS/libpaper.spec b/SPECS/libpaper.spec new file mode 100644 index 0000000..92e3712 --- /dev/null +++ b/SPECS/libpaper.spec @@ -0,0 +1,250 @@ +#%%global nmu +nmu4 + +Name: libpaper +Version: 1.1.28 +Release: 4%{?dist} +Summary: Library and tools for handling papersize +License: GPLv2 +URL: http://packages.qa.debian.org/libp/libpaper.html +Source0: http://ftp.debian.org/debian/pool/main/libp/libpaper/%{name}_%{version}.tar.gz + + +# Filed upstream as: +# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=481213 +Patch2: libpaper-useglibcfallback.patch +# Memory leak +Patch3: libpaper-file-leak.patch +# memory leak found by covscan, reported to debian upstream +#Patch4: libpaper-covscan.patch + + +# gcc is no longer in buildroot by default +BuildRequires: gcc +# use git for autosetup +BuildRequires: git-core +# uses make +BuildRequires: make +BuildRequires: libtool, gettext, gawk + +%description +The paper library and accompanying files are intended to provide a +simple way for applications to take actions based on a system- or +user-specified paper size. This release is quite minimal, its purpose +being to provide really basic functions (obtaining the system paper name +and getting the height and width of a given kind of paper) that +applications can immediately integrate. + +%package devel +Summary: Headers/Libraries for developing programs that use libpaper +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains headers and libraries that programmers will need +to develop applications which use libpaper. + +%prep +%autosetup -S git +libtoolize + +%build +touch AUTHORS NEWS +aclocal +autoheader +autoconf +automake -a +%configure --disable-static +# Disable rpath +sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +%make_build + +%install +%make_install +rm $RPM_BUILD_ROOT%{_libdir}/*.la +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} +echo '# Simply write the paper name. See papersize(5) for possible values' > $RPM_BUILD_ROOT%{_sysconfdir}/papersize +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/libpaper.d +for i in cs da de es fr gl hu it ja nl pt_BR sv tr uk vi; do + mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/$i/LC_MESSAGES/; + msgfmt debian/po/$i.po -o $RPM_BUILD_ROOT%{_datadir}/locale/$i/LC_MESSAGES/%{name}.mo; +done +%find_lang %{name} + +%ldconfig_scriptlets + +%files -f %{name}.lang +%doc ChangeLog README +%license COPYING +%config(noreplace) %{_sysconfdir}/papersize +%dir %{_sysconfdir}/libpaper.d +%{_bindir}/paperconf +%{_libdir}/libpaper.so.1.1.2 +%{_libdir}/libpaper.so.1 +%{_sbindir}/paperconfig +%{_mandir}/man1/* +%{_mandir}/man5/* +%{_mandir}/man8/* + +%files devel +%{_includedir}/paper.h +%{_libdir}/libpaper.so +%{_mandir}/man3/* + +%changelog +* Mon Aug 09 2021 Mohan Boddu - 1.1.28-4 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Fri Apr 16 2021 Mohan Boddu - 1.1.28-3 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Jan 26 2021 Fedora Release Engineering - 1.1.28-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Thu Nov 05 2020 Zdenek Dohnal - 1.1.28-1 +- 1.1.28 + +* Tue Jul 28 2020 Fedora Release Engineering - 1.1.24-28 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 13 2020 Tom Stellard - 1.1.24-27 +- Use make macros +- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro + +* Wed Jan 29 2020 Fedora Release Engineering - 1.1.24-26 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Jul 25 2019 Fedora Release Engineering - 1.1.24-25 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Feb 01 2019 Fedora Release Engineering - 1.1.24-24 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Dec 03 2018 Zdenek Dohnal - 1.1.24-23 +- fixing covscan issue - memory leak + +* Fri Jul 13 2018 Fedora Release Engineering - 1.1.24-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri Mar 09 2018 Zdenek Dohnal - 1.1.24-21 +- remove nmu5 from .gitignore and sources +- fixed memory leak + +* Wed Feb 21 2018 Zdenek Dohnal - 1.1.24-20 +- gcc is no longer in buildroot by default + +* Thu Feb 08 2018 Zdenek Dohnal - 1.1.24-19 +- remove old stuff https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/MRWOMRZ6KPCV25EFHJ2O67BCCP3L4Y6N/ + +* Wed Feb 07 2018 Fedora Release Engineering - 1.1.24-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Mon Feb 05 2018 Igor Gnatenko - 1.1.24-17 +- Switch to %%ldconfig_scriptlets + +* Thu Aug 03 2017 Fedora Release Engineering - 1.1.24-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1.1.24-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 1.1.24-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Nov 11 2016 Zdenek Dohnal - 1.1.24-13 +- bump to nmu4 + +* Thu Feb 04 2016 Fedora Release Engineering - 1.1.24-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 1.1.24-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sun Aug 17 2014 Fedora Release Engineering - 1.1.24-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 1.1.24-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sat Aug 03 2013 Fedora Release Engineering - 1.1.24-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 1.1.24-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 1.1.24-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jan 13 2012 Fedora Release Engineering - 1.1.24-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue May 17 2011 Tom Callaway - 1.1.24-3 +- bump to nmu1 + +* Tue Feb 08 2011 Fedora Release Engineering - 1.1.24-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sat Apr 24 2010 Tom "spot" Callaway - 1.1.24-1 +- update to 1.1.24 + +* Thu Mar 4 2010 Tom "spot" Callaway - 1.1.23-7 +- update to 1.1.23+nmu2 + +* Fri Jul 24 2009 Fedora Release Engineering - 1.1.23-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Feb 25 2009 Fedora Release Engineering - 1.1.23-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Feb 16 2009 Tom "spot" Callaway - 1.1.23-4 +- run libtoolize to fix build with newer libtool +- disable rpath + +* Fri Aug 22 2008 Tom "spot" Callaway - 1.1.23-3 +- update to nmu1 +- apply patch to fix imprecise definition of DL format +- apply patch so that when no config is present, libpaper will fallback through + LC_PAPER before giving up and using Letter + +* Tue Feb 19 2008 Fedora Release Engineering - 1.1.23-2 +- Autorebuild for GCC 4.3 + +* Tue Feb 19 2008 Tom "spot" Callaway 1.1.23-1 +- 1.1.23 + +* Fri Aug 24 2007 Tom "spot" Callaway 1.1.22-1.1 +- missing BR: gawk + +* Thu Aug 23 2007 Tom "spot" Callaway 1.1.22-1 +- bump, no real changes of note, rebuild for ppc32 +- license fix, v2 only + +* Mon Jul 09 2007 Tom "spot" Callaway 1.1.21-1.1 +- BR: libtool + +* Mon Jul 09 2007 Tom "spot" Callaway 1.1.21-1 +- bump to 1.1.21 +- fix automake bug (bz 247458) + +* Thu Oct 05 2006 Christian Iseli 1.1.20-5 + - rebuilt for unwind info generation, broken in gcc-4.1.1-21 + +* Sat Sep 23 2006 Tom "spot" Callaway 1.1.20-4 +- remove aclocal call + +* Sat Sep 23 2006 Tom "spot" Callaway 1.1.20-3 +- fix FC-4 with aclocal call +- move man3 pages to -devel +- don't set default, just put comment in conf file +- own /etc/libpaper.d +- use debian/NEWS +- include the meager translations +- use --disable-static + +* Sat Sep 23 2006 Tom "spot" Callaway 1.1.20-2 +- nuke static lib +- own /etc/papersize +- fix mixed spaces/tabs rpmlint warning + +* Sat Sep 23 2006 Tom "spot" Callaway 1.1.20-1 +- initial package for Fedora Extras