diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2448842 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/groff-1.22.2.tar.gz diff --git a/.groff.metadata b/.groff.metadata new file mode 100644 index 0000000..c8452b3 --- /dev/null +++ b/.groff.metadata @@ -0,0 +1 @@ +37223941e25bb504bf54631daaabb01b147dc1d3 SOURCES/groff-1.22.2.tar.gz diff --git a/SOURCES/0001-missing-groff-x11-info-message-when-gxditview-not-fo.patch b/SOURCES/0001-missing-groff-x11-info-message-when-gxditview-not-fo.patch new file mode 100644 index 0000000..d6b0025 --- /dev/null +++ b/SOURCES/0001-missing-groff-x11-info-message-when-gxditview-not-fo.patch @@ -0,0 +1,30 @@ +From 103f1f6b4e4cfd007375cd127b8e69cd102d4097 Mon Sep 17 00:00:00 2001 +From: Jan Vcelak +Date: Tue, 1 Jan 2013 15:32:01 +0100 +Subject: [PATCH] missing groff-x11 info message when gxditview not found + +Adds info message that 'groff-x11' package might be missing when +executing 'groff -X' and 'gxditview' is not found. + +Resolves: #530788 +Signed-off-by: Jan Vcelak +--- + src/roff/groff/pipeline.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/roff/groff/pipeline.c b/src/roff/groff/pipeline.c +index cea7593..fce0abc 100644 +--- a/src/roff/groff/pipeline.c ++++ b/src/roff/groff/pipeline.c +@@ -486,6 +486,8 @@ int run_pipeline(int ncommands, char ***commands, int no_pipe) + execvp(commands[i][0], commands[i]); + error("couldn't exec %1: %2", + commands[i][0], strerror(errno), (char *)0); ++ if (strcmp(commands[i][0], "gxditview") == 0) ++ fprintf(stderr, "You might be missing 'groff-x11' package.\n"); + fflush(stderr); /* just in case error() doesn't */ + _exit(EXEC_FAILED_EXIT_STATUS); + } +-- +1.8.0.2 + diff --git a/SOURCES/0002-load-site-font-and-site-tmac-from-etc-groff.patch b/SOURCES/0002-load-site-font-and-site-tmac-from-etc-groff.patch new file mode 100644 index 0000000..163f784 --- /dev/null +++ b/SOURCES/0002-load-site-font-and-site-tmac-from-etc-groff.patch @@ -0,0 +1,43 @@ +From c6d8bb3e0ebc03274564d7b2c768e9932cc5f79d Mon Sep 17 00:00:00 2001 +From: Jan Vcelak +Date: Tue, 1 Jan 2013 15:33:45 +0100 +Subject: [PATCH] load site-font and site-tmac from /etc/groff + +Move site-font and site-tmac configuration from /usr/share/groff to +/etc/groff. That allows permanent custom changes. (Symlinking brought +a lot of problems with RPM. This is safer and cleaner.) + +Signed-off-by: Jan Vcelak +--- + Makefile.in | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 7534e56..d97d1b9 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -167,7 +167,7 @@ fontdir=$(datasubdir)/font + oldfontdir=$(datasubdir)/oldfont + + # `localfontdir' says where local fonts will be installed (as dev*/*). +-localfontdir=$(dataprogramdir)/site-font ++localfontdir=@sysconfdir@/groff/site-font + + # `legacyfontdir' is for compatibility with non-GNU troff. + legacyfontdir=/usr/lib/font +@@ -179,10 +179,10 @@ fontpath=$(localfontdir)$(RT_SEP)$(fontdir)$(RT_SEP)$(legacyfontdir) + tmacdir=$(datasubdir)/tmac + + # `systemtmacdir' says where to install platform-dependent macros. +-systemtmacdir=$(libprogramdir)/site-tmac ++systemtmacdir=@sysconfdir@/groff/site-tmac + + # `localtmacdir' says where local files will be installed. +-localtmacdir=$(dataprogramdir)/site-tmac ++localtmacdir=@sysconfdir@/groff/site-tmac + + # `appresdir' says where to install the application resource file for + # gxditview. +-- +1.8.0.2 + diff --git a/SOURCES/0003-various-security-fixes.patch b/SOURCES/0003-various-security-fixes.patch new file mode 100644 index 0000000..3f318ca --- /dev/null +++ b/SOURCES/0003-various-security-fixes.patch @@ -0,0 +1,227 @@ +From 8989e9e33080ed5a6e940bfbca3a4ef28b3264b5 Mon Sep 17 00:00:00 2001 +From: Jan Vcelak +Date: Tue, 1 Jan 2013 15:35:04 +0100 +Subject: [PATCH] various security fixes + +CVE-2009-5044 (#709413) +CVE-2009-5080 (#720058) +CVE-2009-5081 (#720057) + +Based on: http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/groff/groff-1.20.1-owl-tmp.diff?rev=1.2;content-type=text%2Fplain +Resolves: #709415, #720060 +Signed-off-by: Jan Vcelak +--- + contrib/eqn2graph/eqn2graph.sh | 2 ++ + contrib/gdiffmk/tests/runtests.in | 5 +++-- + contrib/grap2graph/grap2graph.sh | 2 ++ + contrib/groffer/perl/groffer.pl | 10 +++++----- + contrib/groffer/perl/roff2.pl | 2 +- + contrib/pdfmark/pdfroff.man | 5 +++-- + contrib/pic2graph/pic2graph.sh | 2 ++ + doc/fixinfo.sh | 4 +++- + doc/groff.info-2 | 6 +++--- + doc/groff.texinfo | 6 +++--- + gendef.sh | 10 +++------- + 11 files changed, 30 insertions(+), 24 deletions(-) + +diff --git a/contrib/eqn2graph/eqn2graph.sh b/contrib/eqn2graph/eqn2graph.sh +index 2f1fa56..c628423 100644 +--- a/contrib/eqn2graph/eqn2graph.sh ++++ b/contrib/eqn2graph/eqn2graph.sh +@@ -69,6 +69,8 @@ for d in "$GROFF_TMPDIR" "$TMPDIR" "$TMP" "$TEMP" /tmp; do + + tmp=$d/eqn2graph$$-$RANDOM + (umask 077 && mkdir $tmp) 2> /dev/null && break ++ ++ tmp= + done; + if test -z "$tmp"; then + echo "$0: cannot create temporary directory" >&2 +diff --git a/contrib/gdiffmk/tests/runtests.in b/contrib/gdiffmk/tests/runtests.in +index 714ce48..40a35c4 100644 +--- a/contrib/gdiffmk/tests/runtests.in ++++ b/contrib/gdiffmk/tests/runtests.in +@@ -56,8 +56,9 @@ function TestResult { + fi + } + +-tmpfile=/tmp/$$ +-trap 'rm -f ${tmpfile}' 0 1 2 3 15 ++tmpfile="`mktemp -t gdiffmk-runtests.XXXXXXXXXX`" || exit ++trap 'rm -f -- "$tmpfile"' EXIT ++trap 'trap - EXIT; rm -f -- "$tmpfile"; exit 1' HUP INT QUIT TERM + + # Run tests. + +diff --git a/contrib/grap2graph/grap2graph.sh b/contrib/grap2graph/grap2graph.sh +index 580e340..fe38041 100644 +--- a/contrib/grap2graph/grap2graph.sh ++++ b/contrib/grap2graph/grap2graph.sh +@@ -65,6 +65,8 @@ for d in "$GROFF_TMPDIR" "$TMPDIR" "$TMP" "$TEMP" /tmp; do + + tmp=$d/grap2graph$$-$RANDOM + (umask 077 && mkdir $tmp) 2> /dev/null && break ++ ++ tmp= + done; + if test -z "$tmp"; then + echo "$0: cannot create temporary directory" >&2 +diff --git a/contrib/groffer/perl/groffer.pl b/contrib/groffer/perl/groffer.pl +index 65d4cdb..fd11ab1 100755 +--- a/contrib/groffer/perl/groffer.pl ++++ b/contrib/groffer/perl/groffer.pl +@@ -1379,7 +1379,7 @@ sub _check_prog_on_list { + ######################################################################## + + sub main_temp { +- my $template = 'groffer_' . "$$" . '_XXXX'; ++ my $template = 'groffer_' . "$$" . '_XXXXXXXXXX'; + foreach ($ENV{'GROFF_TMPDIR'}, $ENV{'TMPDIR'}, $ENV{'TMP'}, $ENV{'TEMP'}, + $ENV{'TEMPDIR'}, File::Spec->catfile($ENV{'HOME'}, 'tmp')) { + if ($_ && -d $_ && -w $_) { +@@ -1410,12 +1410,12 @@ sub main_temp { + + # further argument: SUFFIX => '.sh' + if ($Debug{'KEEP'}) { +- ($fh_cat, $tmp_cat) = tempfile(',cat_XXXX', DIR => $tmpdir); +- ($fh_stdin, $tmp_stdin) = tempfile(',stdin_XXXX', DIR => $tmpdir); ++ ($fh_cat, $tmp_cat) = tempfile(',cat_XXXXXXXXXX', DIR => $tmpdir); ++ ($fh_stdin, $tmp_stdin) = tempfile(',stdin_XXXXXXXXXX', DIR => $tmpdir); + } else { +- ($fh_cat, $tmp_cat) = tempfile(',cat_XXXX', UNLINK => 1, ++ ($fh_cat, $tmp_cat) = tempfile(',cat_XXXXXXXXXX', UNLINK => 1, + DIR => $tmpdir); +- ($fh_stdin, $tmp_stdin) = tempfile(',stdin_XXXX', UNLINK => 1, ++ ($fh_stdin, $tmp_stdin) = tempfile(',stdin_XXXXXXXXXX', UNLINK => 1, + DIR => $tmpdir); + } + } # main_temp() +diff --git a/contrib/groffer/perl/roff2.pl b/contrib/groffer/perl/roff2.pl +index 0e1f17a..b9eb67e 100755 +--- a/contrib/groffer/perl/roff2.pl ++++ b/contrib/groffer/perl/roff2.pl +@@ -124,7 +124,7 @@ if ($Has_Groffer) { + last; + } + } +- my $template = $Name . '_XXXX'; ++ my $template = $Name . '_XXXXXXXXXX'; + my ($fh, $stdin); + if ($tempdir) { + ($fh, $stdin) = tempfile($template, UNLINK => 1, DIR => $tempdir) || +diff --git a/contrib/pdfmark/pdfroff.man b/contrib/pdfmark/pdfroff.man +index 3a1d705..73650a8 100644 +--- a/contrib/pdfmark/pdfroff.man ++++ b/contrib/pdfmark/pdfroff.man +@@ -529,7 +529,7 @@ defaults to + .B GROFF_TMPDIR + Identifies the directory in which + .B pdfroff +-should create temporary files. ++should create a subdirectory for its temporary files. + If + .B \%GROFF_TMPDIR + is +@@ -541,7 +541,8 @@ and + .B TEMP + are considered in turn, as possible temporary file repositories. + If none of these are set, then temporary files are created +-in the current directory. ++in a subdirectory of ++.BR /tmp . + . + .TP + .B GROFF_GHOSTSCRIPT_INTERPRETER +diff --git a/contrib/pic2graph/pic2graph.sh b/contrib/pic2graph/pic2graph.sh +index 0c45610..874aad0 100644 +--- a/contrib/pic2graph/pic2graph.sh ++++ b/contrib/pic2graph/pic2graph.sh +@@ -80,6 +80,8 @@ for d in "$GROFF_TMPDIR" "$TMPDIR" "$TMP" "$TEMP" /tmp; do + tmp=$d/pic2graph$$-$RANDOM + (umask 077 && mkdir $tmp) 2> /dev/null \ + && break ++ ++ tmp= + done; + if test -z "$tmp"; then + echo "$0: cannot create temporary directory" >&2 +diff --git a/doc/fixinfo.sh b/doc/fixinfo.sh +index 2c853f8..a0e8295 100644 +--- a/doc/fixinfo.sh ++++ b/doc/fixinfo.sh +@@ -22,7 +22,9 @@ + # groff.texinfo macro code. Hopefully, a new texinfo version makes it + # unnecessary. + +-t=${TMPDIR-.}/gro$$.tmp ++t="`mktemp -t groff-fixinfo.XXXXXXXXXX`" || exit ++trap 'rm -f -- "$t"' EXIT ++trap 'trap - EXIT; rm -f -- "$t"; exit 1' HUP INT QUIT TERM + + cat $1 | sed ' + 1 { +diff --git a/doc/groff.info-2 b/doc/groff.info-2 +index 3e169ec..e964dd6 100644 +--- a/doc/groff.info-2 ++++ b/doc/groff.info-2 +@@ -1957,9 +1957,9 @@ not there, `groff' would not know when to stop. + + + .sy perl -e 'printf ".nr H %d\\n.nr M %d\\n.nr S %d\\n",\ +- (localtime(time))[2,1,0]' > /tmp/x\n[$$] +- .so /tmp/x\n[$$] +- .sy rm /tmp/x\n[$$] ++ (localtime(time))[2,1,0]' > timefile\n[$$] ++ .so timefile\n[$$] ++ .sy rm timefile\n[$$] + \nH:\nM:\nS + + Note that this works by having the `perl' script (run by `sy') +diff --git a/doc/groff.texinfo b/doc/groff.texinfo +index bf77e95..914ba8b 100644 +--- a/doc/groff.texinfo ++++ b/doc/groff.texinfo +@@ -13660,9 +13660,9 @@ into a document: + @pindex perl + @Example + .sy perl -e 'printf ".nr H %d\\n.nr M %d\\n.nr S %d\\n",\ +- (localtime(time))[2,1,0]' > /tmp/x\n[$$] +-.so /tmp/x\n[$$] +-.sy rm /tmp/x\n[$$] ++ (localtime(time))[2,1,0]' > timefile\n[$$] ++.so timefile\n[$$] ++.sy rm timefile\n[$$] + \nH:\nM:\nS + @endExample + +diff --git a/gendef.sh b/gendef.sh +index ad4ccb2..c25e2d4 100644 +--- a/gendef.sh ++++ b/gendef.sh +@@ -34,11 +34,9 @@ do + #define $def" + done + +-# Use $TMPDIR if defined. Default to cwd, for non-Unix systems +-# which don't have /tmp on each drive (we are going to remove +-# the file before we exit anyway). Put the PID in the basename, +-# since the extension can only hold 3 characters on MS-DOS. +-t=${TMPDIR-.}/gro$$.tmp ++t="`mktemp -t groff-gendef.XXXXXXXXXX`" || exit ++trap 'rm -f -- "$t"' EXIT ++trap 'trap - EXIT; rm -f -- "$t"; exit 1' HUP INT QUIT TERM + + sed -e 's/=/ /' >$t < +Date: Tue, 23 Jul 2013 14:09:50 +0200 +Subject: [PATCH] don't use /usr/bin/env in shebang + +There might be an issue that the script is executed with unwanted version of + if that language is provided by enabled dynamic software collection. + +Resolves: #987069 +--- + contrib/chem/chem.pl | 2 +- + contrib/groffer/perl/groffer.pl | 2 +- + contrib/groffer/perl/roff2.pl | 2 +- + src/roff/grog/grog.pl | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/contrib/chem/chem.pl b/contrib/chem/chem.pl +index dacf8b4..932606a 100755 +--- a/contrib/chem/chem.pl ++++ b/contrib/chem/chem.pl +@@ -1,4 +1,4 @@ +-#! /usr/bin/env perl ++#! /usr/bin/perl + + # chem - a groff preprocessor for producing chemical structure diagrams + +diff --git a/contrib/groffer/perl/groffer.pl b/contrib/groffer/perl/groffer.pl +index f56fbfc..d0352d0 100755 +--- a/contrib/groffer/perl/groffer.pl ++++ b/contrib/groffer/perl/groffer.pl +@@ -1,4 +1,4 @@ +-#! /usr/bin/env perl ++#! /usr/bin/perl + + # groffer - display groff files + +diff --git a/contrib/groffer/perl/roff2.pl b/contrib/groffer/perl/roff2.pl +index cf95f95..9ba6860 100755 +--- a/contrib/groffer/perl/roff2.pl ++++ b/contrib/groffer/perl/roff2.pl +@@ -1,4 +1,4 @@ +-#! /usr/bin/env perl ++#! /usr/bin/perl + + # roff2* - transform roff files into other formats + +diff --git a/src/roff/grog/grog.pl b/src/roff/grog/grog.pl +index 3f33d86..77adf78 100644 +--- a/src/roff/grog/grog.pl ++++ b/src/roff/grog/grog.pl +@@ -1,4 +1,4 @@ +-#! /usr/bin/env perl ++#! /usr/bin/perl + # grog - guess options for groff command + # Inspired by doctype script in Kernighan & Pike, Unix Programming + # Environment, pp 306-8. +-- +1.7.11.7 + diff --git a/SPECS/groff.spec b/SPECS/groff.spec new file mode 100644 index 0000000..1c912b3 --- /dev/null +++ b/SPECS/groff.spec @@ -0,0 +1,905 @@ +%{!?with_x:%global with_x 1} + +Summary: A document formatting system +Name: groff +Version: 1.22.2 +Release: 8%{?dist} +License: GPLv3+ and GFDL and BSD and MIT +Group: Applications/Publishing +URL: http://www.gnu.org/software/groff/ +Source: ftp://ftp.gnu.org/gnu/groff/groff-%{version}.tar.gz + +# resolves: #530788 +Patch0: 0001-missing-groff-x11-info-message-when-gxditview-not-fo.patch +Patch1: 0002-load-site-font-and-site-tmac-from-etc-groff.patch +# resolves: #709413, #720058, #720057 +Patch2: 0003-various-security-fixes.patch +# resolves: #987069 +Patch3: 0004-don-t-use-usr-bin-env-in-shebang.patch + +Requires: coreutils, /sbin/install-info, groff-base = %{version}-%{release} +Requires(post): info +Requires(preun): info +BuildRequires: git, netpbm-progs, psutils, ghostscript +Provides: nroff-i18n = %{version}-%{release} + +%description +Groff is a document formatting system. Groff takes standard text and +formatting commands as input and produces formatted output. The +created documents can be shown on a display or printed on a printer. +Groff's formatting commands allow you to specify font type and size, +bold type, italic type, the number and size of columns on a page, and +more. + +Groff can also be used to format man pages. If you are going to use +groff with the X Window System, you will also need to install the +groff-x11 package. + +%package base +Summary: Parts of the groff formatting system required to display manual pages +Group: Applications/Publishing + +%description base +The groff-base package contains only necessary parts of groff formatting +system which are required to display manual pages, and the groff's default +display device (PostScript). + +%package perl +Summary: Parts of the groff formatting system that require Perl +Group: Applications/Publishing +Requires: groff-base = %{version}-%{release} + +%description perl +The groff-perl package contains the parts of the groff text processor +package that require Perl. These include the afmtodit (font processor +for creating PostScript font files), groffer (tool for displaying groff +files), grog (utility that can be used to automatically determine groff +command-line options), chem (groff preprocessor for producing chemical +structure diagrams), mmroff (reference preprocessor) and roff2dvi +roff2html roff2pdf roff2ps roff2text roff2x (roff code converters). + +%if %{with_x} +%package x11 +Summary: Parts of the groff formatting system that require X Windows System +Group: Applications/Publishing +Requires: groff-base = %{version}-%{release} +BuildRequires: libXaw-devel, libXmu-devel +Provides: groff-gxditview = %{version}-%{release} +Obsoletes: groff-gxditview < 1.20.1 + +%description x11 +The groff-x11 package contains the parts of the groff text processor +package that require X Windows System. These include gxditview (display +groff intermediate output files on X Window System display) and +xtotroff (converts X font metrics into groff font metrics). +%endif + +%package doc +Summary: Documentation for groff document formatting system +Group: Documentation +BuildArch: noarch +Requires: groff = %{version}-%{release} +Requires(post): info +Requires(preun): info + +%description doc +The groff-doc package includes additional documentation for groff +text processor package. It contains examples, documentation for PIC +language and documentation for creating PDF files. + +%prep +%setup -q +git init +git config user.email groff-owner@fedoraproject.org +git config user.name "groff owner" +git add . +git commit -n -m "release %{version}" +git am %{patches} + +for file in NEWS src/devices/grolbp/grolbp.man doc/{groff.info*,webpage.ms} \ + contrib/mm/*.man contrib/mom/examples/{README.txt,*.mom,mom.vim}; do + iconv -f iso-8859-1 -t utf-8 < "$file" > "${file}_" + mv "${file}_" "$file" +done + +%build +%configure \ + --docdir=%{_docdir}/%{name}-%{version} \ + --with-appresdir=%{_datadir}/X11/app-defaults \ + --with-grofferdir=%{_datadir}/%{name}/%{version}/groffer +make %{?_smp_mflags} + +%install +make install DESTDIR=%{buildroot} + +# some binaries need alias with 'g' or 'z' prefix +for file in g{nroff,troff,tbl,pic,eqn,neqn,refer,lookbib,indxbib,soelim} zsoelim; do + ln -s ${file#?} %{buildroot}%{_bindir}/${file} + ln -s ${file#?}.1.gz %{buildroot}%{_mandir}/man1/${file}.1.gz +done + +# fix absolute symlink to relative symlink +rm -f %{buildroot}%{_docdir}/%{name}-%{version}/pdf/mom-pdf.pdf +ln -s ../examples/mom/mom-pdf.pdf %{buildroot}%{_docdir}/%{name}-%{version}/pdf/mom-pdf.pdf + +# rename groff downloadable postscript fonts to meet Fedora Font Packaging guidelines, +# as these files are more PS instructions, than general-purpose fonts (bz #477394) +for file in $(find %{buildroot}%{_datadir}/%{name}/%{version}/font/devps -name "*.pfa"); do + mv ${file} ${file}_ +done +sed --in-place 's/\.pfa$/.pfa_/' %{buildroot}%{_datadir}/%{name}/%{version}/font/devps/download + +# remove unnecessary files +rm -f %{buildroot}%{_infodir}/dir + +# fix privileges +chmod 755 %{buildroot}%{_datadir}/groff/%{version}/groffer/version.sh +chmod 755 %{buildroot}%{_datadir}/groff/%{version}/font/devlj4/generate/special.awk + +# remove CreationDate from documentation +pushd %{buildroot}%{_docdir}/%{name}-%{version} + find -name "*.html" | xargs sed -i "/^