Bug#614257: texlive-bin: try_open_mode sometimes fails to pass mode to open
Package: texlive-bin
Version: 2009-8
Severity: important
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch natty
texlive-bin failed to build on Ubuntu ppc64 (still an experimental port,
but this doesn't seem to be architecture-specific - I suspect that it
only shows up as a compile-time error at -O3):
In file included from /usr/include/fcntl.h:252:0,
from /usr/include/sys/file.h:25,
from ../../../texk/xdvik/util.c:33:
In function 'open',
inlined from 'try_open_mode.clone.1' at ../../../texk/xdvik/util.c:276:5,
inlined from 'xdvi_temp_fd' at ../../../texk/xdvik/util.c:869:5:
/usr/include/bits/fcntl2.h:51:24: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT in second argument needs 3 arguments
This seems to be a genuine bug that could cause files to be created with
undefined modes in the EMFILE/ENFILE error handling path. Here's a
patch:
* In try_open_mode, pass the mode on to open even in the EMFILE/ENFILE
case.
diff -u texlive-bin-2009/debian/patches/series texlive-bin-2009/debian/patches/series
--- texlive-bin-2009/debian/patches/series
+++ texlive-bin-2009/debian/patches/series
@@ -35,0 +36 @@
+try-open-mode-fix
only in patch2:
unchanged:
--- texlive-bin-2009.orig/debian/patches/try-open-mode-fix
+++ texlive-bin-2009/debian/patches/try-open-mode-fix
@@ -0,0 +1,18 @@
+Description: Pass mode on to open even in EMFILE/ENFILE case
+Author: Colin Watson <cjwatson@ubuntu.com>
+Forwarded: no
+Last-Update: 2011-02-20
+
+Index: b/texk/xdvik/util.c
+===================================================================
+--- a/texk/xdvik/util.c
++++ b/texk/xdvik/util.c
+@@ -273,7 +273,7 @@
+ int fd = open(fname, flags, mode);
+ if (fd < 0 && (errno == EMFILE || errno == ENFILE)) {
+ close_a_file();
+- fd = open(fname, flags);
++ fd = open(fname, flags, mode);
+ }
+ return fd;
+ }
Thanks,
--
Colin Watson [cjwatson@ubuntu.com]
Reply to: