Compare commits

..

No commits in common. "c10" and "c8s" have entirely different histories.
c10 ... c8s

8 changed files with 180 additions and 209 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
libpaper-2.1.1.tar.gz SOURCES/libpaper_1.1.24+nmu4.tar.gz
/libpaper_1.1.24+nmu4.tar.gz

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tedude.validation}

16
libpaper-covscan.patch Normal file
View File

@ -0,0 +1,16 @@
diff --git a/lib/paper.c b/lib/paper.c
index 57db599..8817aea 100644
--- a/lib/paper.c
+++ b/lib/paper.c
@@ -211,7 +211,10 @@ PAPERSIZEVAR, fall-back to the old behaviour.
fclose(ps);
paperstr = malloc((strlen(papername) + 1) * sizeof(char));
- if (! paperstr) return 0;
+ if (! paperstr) {
+ free(papername);
+ return 0;
+ }
strcpy(paperstr, papername);
free(papername);

22
libpaper-file-leak.patch Normal file
View File

@ -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));

View File

@ -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 <unistd.h>
+#include <locale.h>
+#include <langinfo.h>
+
#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 <errno.h>
#include <paper.h>
+#include <locale.h>
/* 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;

View File

@ -1,204 +1,93 @@
%global nmu +nmu4
Name: libpaper Name: libpaper
Version: 2.1.1 Version: 1.1.24
Release: 7%{?dist} Release: 22%{?dist}
# Needed to replace separate paper package
Epoch: 1
Summary: Library and tools for handling papersize Summary: Library and tools for handling papersize
# libpaper is LGPL-2.1+ License: GPLv2
# bundled libgnu is LGPL-2.1+, LGPL-2+ and GPL-3+ URL: http://packages.qa.debian.org/libp/libpaper.html
# paperspecs is Public Domain Source0: http://ftp.debian.org/debian/pool/main/libp/libpaper/%{name}_%{version}%{nmu}.tar.gz
# localepaper.c is FSFAP # Filed upstream as:
License: LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND GPL-3.0-or-later AND LGPL-2.0-or-later AND FSFAP # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=481213
URL: https://github.com/rrthomas/libpaper/ Patch2: libpaper-useglibcfallback.patch
Source0: https://github.com/rrthomas/libpaper/archive/v%{version}/%{name}-%{version}.tar.gz # Memory leak
# Pulled from paper Patch3: libpaper-file-leak.patch
Source1: localepaper.c # 1606989 - Please review important issues found by covscan in "libpaper-1.1.24-21.el8+7" package
Patch4: libpaper-covscan.patch
# gcc is no longer in buildroot by default # gcc is no longer in buildroot by default
BuildRequires: gcc BuildRequires: gcc
# use git for autosetup BuildRequires: libtool, gettext, gawk
BuildRequires: git-core
# uses make
BuildRequires: make
BuildRequires: libtool, gettext, gawk, autoconf, automake
BuildRequires: help2man, tar, gnupg2, perl-interpreter
Provides: bundled(gnulib)
%description %description
The libpaper package enables users to indicate their preferred paper The paper library and accompanying files are intended to provide a
size and specifies system-wide and per-user paper size catalogues, which can simple way for applications to take actions based on a system- or
also be used directly (see paperspecs(5)). 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 %package devel
Summary: Headers/Libraries for developing programs that use libpaper Summary: Headers/Libraries for developing programs that use libpaper
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} Requires: %{name} = %{version}-%{release}
%description devel %description devel
This package contains headers and libraries that programmers will need This package contains headers and libraries that programmers will need
to develop applications which use libpaper. to develop applications which use libpaper.
%package -n paper
Summary: Print paper size information
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
# This is licensed differently from libpaper.
# paper.c is GPL-3.0-or-later
# paperconf.c is GPL 2.0 only
# localepaper.c is FSFAP (except it is missing the warranty disclaimer... but the intent is clear)
License: GPL-3.0-or-later AND FSFAP AND GPL-2.0-only
%description -n paper
The paper(1) utility can be used to find the user's preferred
default paper size and give information about known sizes.
%prep %prep
%autosetup -S git %setup -q -n %{name}-%{version}%{nmu}
cp %{SOURCE1} src/ %patch2 -p1 -b .useglibcfallback
%patch3 -p1 -b .file-leak
%if 0 %patch4 -p1 -b .covscan
sed -i 's|gnulib_tool=$gnulib_path/gnulib-tool|gnulib_tool=%{_bindir}/gnulib-tool|g' bootstrap libtoolize
sed -i 's|./gnulib/gnulib-tool|%{_bindir}/gnulib-tool|g' bootstrap.conf
sed -i '/doc\/INSTALL/d' bootstrap
./bootstrap --gnulib-srcdir=%{_datadir}/gnulib/ --skip-git
%endif
%build %build
touch AUTHORS NEWS
aclocal
autoconf
automake -a
%configure --disable-static %configure --disable-static
%make_build # Disable rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
# localepaper sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
pushd src make %{?_smp_mflags}
%{__cc} %{optflags} -I.. -Ilibgnu -o localepaper localepaper.c libgnu/.libs/libgnupaper.a %{_hardening_ldflags}
popd
%check
# No upstream tests
echo "Testing localepaper tool"
locale width height > expected
./src/localepaper | tr ' ' "\n" > got
diff -u expected got
# No real way to test the paper tool
%install %install
%make_install make DESTDIR=$RPM_BUILD_ROOT install
rm $RPM_BUILD_ROOT%{_libdir}/*.la rm $RPM_BUILD_ROOT%{_libdir}/*.la
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
# maybe someday the translations will return echo '# Simply write the paper name. See papersize(5) for possible values' > $RPM_BUILD_ROOT%{_sysconfdir}/papersize
%if 0 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 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/; 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; msgfmt debian/po/$i.po -o $RPM_BUILD_ROOT%{_datadir}/locale/$i/LC_MESSAGES/%{name}.mo;
done done
%find_lang %{name} %find_lang %{name}
%endif
mkdir %{buildroot}%{_libexecdir}
install -m0755 src/localepaper %{buildroot}%{_libexecdir}
%ldconfig_scriptlets %ldconfig_scriptlets
%files %files -f %{name}.lang
%doc ChangeLog README %doc ChangeLog README
%license COPYING %license COPYING
%config(noreplace) %{_sysconfdir}/paperspecs %config(noreplace) %{_sysconfdir}/papersize
%{_libdir}/libpaper.so.2* %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 %files devel
%{_includedir}/paper.h %{_includedir}/paper.h
%{_libdir}/libpaper.so %{_libdir}/libpaper.so
%{_mandir}/man3/*
%files -n paper
%{_bindir}/paper
%{_bindir}/paperconf
%{_libexecdir}/localepaper
%{_mandir}/man1/*
%{_mandir}/man5/*
%changelog %changelog
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1:2.1.1-7 * Mon Dec 03 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.1.24-22
- Bump release for October 2024 mass rebuild: - 1606989 - Please review important issues found by covscan in "libpaper-1.1.24-21.el8+7" package
Resolves: RHEL-64018
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1:2.1.1-6
- Bump release for June 2024 mass rebuild
* Mon May 13 2024 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.1.1-5
- remove gnulib dependency and use bundled one
* Tue Apr 23 2024 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.1.1-4
- RHEL-33500 - apply hardening ldflags for localepaper
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Jul 25 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.1.1-1
- 2.1.1
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri Apr 14 2023 Tom Callaway <spot@fedoraproject.org> - 1:2.1.0-1
- update to 2.1.0
* Fri Mar 3 2023 Tom Callaway <spot@fedoraproject.org> - 1:2.0.10-1
- update to 2.0.10
* Thu Feb 23 2023 Tom Callaway <spot@fedoraproject.org> - 1:2.0.9-1
- update to 2.0.9
* Tue Feb 14 2023 Tom Callaway <spot@fedoraproject.org> - 1:2.0.8-1
- update to 2.0.8
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Jan 9 2023 Tom Callaway <spot@fedoraproject.org> - 2.0.4-2
- move /etc/paperspecs to libpaper to ensure proper functionality in cases where paper subpackage
is not installed
- fix Requires to include epoch
* Sun Jan 8 2023 Tom Callaway <spot@fedoraproject.org> - 2.0.4-1
- update to 2.0.4
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.28-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.28-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.28-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.28-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Nov 05 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.1.28-1
- 1.1.28
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.24-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 1.1.24-27
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.24-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.24-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.24-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Dec 03 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.1.24-23
- fixing covscan issue - memory leak
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.24-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Mar 09 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.1.24-21 * Fri Mar 09 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.1.24-21
- remove nmu5 from .gitignore and sources - remove nmu5 from .gitignore and sources

View File

@ -1,44 +0,0 @@
/*
* localepaper: print the dimensions in mm of the current locale's
* paper size, if possible.
*
* Based on a patch by Caolan McNamara:
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=481213
*
* Copyright (C) Reuben Thomas <rrt@sc3d.org>, 2013.
*
* Copying and distribution of this file, with or without modification,
* are permitted in any medium without royalty provided the copyright
* notice and this notice are preserved.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#if defined LC_PAPER && defined _GNU_SOURCE
#include <langinfo.h>
#endif
#include "progname.h"
int main(int argc, char *argv[])
{
set_program_name(argv[0]);
argc = argc; /* Avoid a compiler warning. */
#if defined LC_PAPER && defined _GNU_SOURCE
setlocale(LC_ALL, "");
#define NL_PAPER_GET(x) \
((union { char *string; unsigned word; })nl_langinfo(x)).word
printf("%d %d\n", NL_PAPER_GET(_NL_PAPER_WIDTH), NL_PAPER_GET(_NL_PAPER_HEIGHT));
return EXIT_SUCCESS;
#else
printf("%s: locale paper size information is not supported on this system", program_name);
return EXIT_FAILURE;
#endif
}

View File

@ -1 +1 @@
SHA512 (libpaper-2.1.1.tar.gz) = 90fabb586115d99c9fb4d4ecee87ac0d1b2ac17ddf0c89287eb82e21834b0a2bc7cd5049fb73f3e20e4b494c374413c388b28c3274ceb278ce81928e17fde288 SHA512 (libpaper_1.1.24+nmu4.tar.gz) = 4412139ffab7b9658f186a825c7d4ae3ba397ff32852a66decccef7b74647dd365573b9f00145fe2fa95dd16e30c280a8aeeac90a14006ed140f5b85e2f0e508