install-info: use create-tmp-then-rename pattern because of OSTree

This commit is contained in:
Vitezslav Crhonek 2016-06-22 15:09:54 +02:00
parent 4cd12d4a3f
commit 43b7806719
2 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,44 @@
diff -up texinfo-6.1/install-info/install-info.c.orig texinfo-6.1/install-info/install-info.c
--- texinfo-6.1/install-info/install-info.c.orig 2016-06-22 09:49:38.766013018 +0200
+++ texinfo-6.1/install-info/install-info.c 2016-06-22 14:11:58.673780736 +0200
@@ -973,18 +973,23 @@ output_dirfile (char *dirfile, int dir_n
int n_entries_added = 0;
int i;
FILE *output;
+ char *dirfile_tmp = NULL;
+
+ asprintf (&dirfile_tmp, "%s.tmp", dirfile);
+ if (!dirfile_tmp)
+ xalloc_die ();
if (compression_program)
{
- char *command = concat (compression_program, ">", dirfile);
+ char *command = concat (compression_program, ">", dirfile_tmp);
output = popen (command, "w");
}
else
- output = fopen (dirfile, "w");
+ output = fopen (dirfile_tmp, "w");
if (!output)
{
- perror (dirfile);
+ perror (dirfile_tmp);
exit (EXIT_FAILURE);
}
@@ -1095,6 +1100,13 @@ output_dirfile (char *dirfile, int dir_n
pclose (output);
else
fclose (output);
+
+ if (rename (dirfile_tmp, dirfile) < 0)
+ {
+ perror (dirfile_tmp);
+ exit (EXIT_FAILURE);
+ }
+ free (dirfile_tmp);
}
/* Read through the input LINES, to find the section names and the

View File

@ -3,7 +3,7 @@
Summary: Tools needed to create Texinfo format documentation files
Name: texinfo
Version: 6.1
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv3+
Group: Applications/Publishing
Url: http://www.gnu.org/software/texinfo/
@ -17,6 +17,8 @@ Patch0: texinfo-4.12-zlib.patch
Patch1: texinfo-6.0-disable-failing-info-test.patch
# Patch2: rhbz#1309702, already upstream
Patch2: texinfo-6.1-texi2dvi-fix.patch
# Patch3: rhbz#1348671, because of OSTree
Patch3: texinfo-6.1-install-info-use-create-tmp-then-rename-pattern.patch
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
Requires: perl >= 5.7.3, perl(Text::Unidecode)
@ -68,6 +70,7 @@ for printing using TeX.
%patch0 -p1 -b .zlib
%patch1 -p1 -b .disable-failing-info-test
%patch2 -p1 -b .texi2dvi-fix
%patch3 -p1 -b .orig
%build
%configure --with-external-Text-Unidecode \
@ -170,6 +173,11 @@ fi
%{_mandir}/man1/pdftexi2dvi.1*
%changelog
* Wed Jun 22 2016 Vitezslav Crhonek <vcrhonek@redhat.com> - 6.1-3
- install-info: use create-tmp-then-rename pattern because of OSTree
(patch by Colin Walters)
Resolves: #1348671
* Wed Feb 24 2016 Vitezslav Crhonek <vcrhonek@redhat.com> - 6.1-2
- Fix texi2dvi exits without completing the task
Resolves: #1309702