[hplip/f16] Some more CUPS filters using the wrong temporary directory
Tim Waugh
twaugh at fedoraproject.org
Wed Oct 17 10:21:39 UTC 2012
commit 35ea8a6bc20b407a319966933c343f0e7350fb8a
Author: Tim Waugh <twaugh at redhat.com>
Date: Wed Oct 17 10:05:04 2012 +0100
Some more CUPS filters using the wrong temporary directory
(bug #865603).
Resolves: rhbz#865603
hplip-logdir.patch | 84 ++++++++++++++++++++++++++++++++++++++++++++++-----
hplip.spec | 6 +++-
2 files changed, 80 insertions(+), 10 deletions(-)
---
diff --git a/hplip-logdir.patch b/hplip-logdir.patch
index cde0e21..abf7bdf 100644
--- a/hplip-logdir.patch
+++ b/hplip-logdir.patch
@@ -1,6 +1,18 @@
+diff -up hplip-3.12.10a/fax/backend/hpfax.py.logdir hplip-3.12.10a/fax/backend/hpfax.py
+--- hplip-3.12.10a/fax/backend/hpfax.py.logdir 2012-10-17 09:56:43.979656073 +0100
++++ hplip-3.12.10a/fax/backend/hpfax.py 2012-10-17 09:57:33.286890599 +0100
+@@ -244,7 +244,7 @@ else:
+ input_fd = 0
+
+ # REVISIT:
+- tmp_dir = '/var/log/hp/tmp'
++ tmp_dir = os.environ.get ('TMPDIR', '/var/log/hp/tmp')
+
+
+ pipe_name = os.path.join(tmp_dir, "hpfax-pipe-%d" % job_id)
diff -up hplip-3.12.10a/logcapture.py.logdir hplip-3.12.10a/logcapture.py
--- hplip-3.12.10a/logcapture.py.logdir 2012-10-10 07:14:21.000000000 +0100
-+++ hplip-3.12.10a/logcapture.py 2012-10-16 11:32:41.969953758 +0100
++++ hplip-3.12.10a/logcapture.py 2012-10-17 09:56:29.396578082 +0100
@@ -39,7 +39,7 @@ CUPS_BACKUP_FILE='/etc/cups/cupsd.conf_o
LOG_FOLDER_PATH='./'
LOG_FOLDER_NAME='hplip_troubleshoot_logs'
@@ -19,9 +31,22 @@ diff -up hplip-3.12.10a/logcapture.py.logdir hplip-3.12.10a/logcapture.py
if File_list:
sts,out = utils.run('cp -f %s %s'%(File_list_str, LOG_FILES))
if sts != 0:
+diff -up hplip-3.12.10a/prnt/filters/hplipjs.c.logdir hplip-3.12.10a/prnt/filters/hplipjs.c
+--- hplip-3.12.10a/prnt/filters/hplipjs.c.logdir 2012-10-17 09:58:20.298135510 +0100
++++ hplip-3.12.10a/prnt/filters/hplipjs.c 2012-10-17 09:58:47.431276326 +0100
+@@ -275,7 +275,8 @@ int main (int argc, char **argv)
+ {
+ fprintf (stderr, "DEBUG: HPLIPJS: argv[%d] = %s\n", i, argv[i]);
+ }
+- snprintf(szPSFile, sizeof(szPSFile), "%s/output.ps","/var/log/hp/tmp");
++ snprintf(szPSFile, sizeof(szPSFile), "%s/output.ps",
++ getenv ("TMPDIR") ? : "/var/log/hp/tmp");
+
+ HPFp = fopen (szPSFile, "w");
+ #endif
diff -up hplip-3.12.10a/prnt/hpcups/HPCupsFilter.cpp.logdir hplip-3.12.10a/prnt/hpcups/HPCupsFilter.cpp
---- hplip-3.12.10a/prnt/hpcups/HPCupsFilter.cpp.logdir 2012-10-16 11:32:41.964953739 +0100
-+++ hplip-3.12.10a/prnt/hpcups/HPCupsFilter.cpp 2012-10-16 11:32:41.969953758 +0100
+--- hplip-3.12.10a/prnt/hpcups/HPCupsFilter.cpp.logdir 2012-10-17 09:56:29.391578055 +0100
++++ hplip-3.12.10a/prnt/hpcups/HPCupsFilter.cpp 2012-10-17 09:56:29.397578087 +0100
@@ -31,16 +31,24 @@
\*****************************************************************************/
@@ -74,7 +99,7 @@ diff -up hplip-3.12.10a/prnt/hpcups/HPCupsFilter.cpp.logdir hplip-3.12.10a/prnt/
cups_header.cupsColorSpace == CUPS_CSPACE_RGB)
diff -up hplip-3.12.10a/prnt/hpcups/LJZjStream.cpp.logdir hplip-3.12.10a/prnt/hpcups/LJZjStream.cpp
--- hplip-3.12.10a/prnt/hpcups/LJZjStream.cpp.logdir 2012-10-10 07:08:46.000000000 +0100
-+++ hplip-3.12.10a/prnt/hpcups/LJZjStream.cpp 2012-10-16 11:32:41.969953758 +0100
++++ hplip-3.12.10a/prnt/hpcups/LJZjStream.cpp 2012-10-17 09:56:29.397578087 +0100
@@ -42,9 +42,12 @@
#include "LJZjStream.h"
#include "Utils.h"
@@ -105,7 +130,7 @@ diff -up hplip-3.12.10a/prnt/hpcups/LJZjStream.cpp.logdir hplip-3.12.10a/prnt/hp
return NO_ERROR;
diff -up hplip-3.12.10a/prnt/hpcups/SystemServices.cpp.logdir hplip-3.12.10a/prnt/hpcups/SystemServices.cpp
--- hplip-3.12.10a/prnt/hpcups/SystemServices.cpp.logdir 2012-10-10 07:08:46.000000000 +0100
-+++ hplip-3.12.10a/prnt/hpcups/SystemServices.cpp 2012-10-16 11:32:41.969953758 +0100
++++ hplip-3.12.10a/prnt/hpcups/SystemServices.cpp 2012-10-17 09:56:29.397578087 +0100
@@ -30,14 +30,17 @@
#include "CommonDefinitions.h"
@@ -128,7 +153,7 @@ diff -up hplip-3.12.10a/prnt/hpcups/SystemServices.cpp.logdir hplip-3.12.10a/prn
}
diff -up hplip-3.12.10a/prnt/hpijs/hpcupsfax.cpp.logdir hplip-3.12.10a/prnt/hpijs/hpcupsfax.cpp
--- hplip-3.12.10a/prnt/hpijs/hpcupsfax.cpp.logdir 2012-10-10 07:08:50.000000000 +0100
-+++ hplip-3.12.10a/prnt/hpijs/hpcupsfax.cpp 2012-10-16 11:33:03.827023620 +0100
++++ hplip-3.12.10a/prnt/hpijs/hpcupsfax.cpp 2012-10-17 09:56:29.397578087 +0100
@@ -29,6 +29,7 @@
POSSIBILITY OF SUCH DAMAGE.
\*****************************************************************************/
@@ -178,8 +203,8 @@ diff -up hplip-3.12.10a/prnt/hpijs/hpcupsfax.cpp.logdir hplip-3.12.10a/prnt/hpij
fdFax = mkstemp (hpFileName);
if (fdFax < 0)
diff -up hplip-3.12.10a/prnt/hpijs/hpijs.cpp.logdir hplip-3.12.10a/prnt/hpijs/hpijs.cpp
---- hplip-3.12.10a/prnt/hpijs/hpijs.cpp.logdir 2012-10-16 11:32:41.961953728 +0100
-+++ hplip-3.12.10a/prnt/hpijs/hpijs.cpp 2012-10-16 11:32:41.970953762 +0100
+--- hplip-3.12.10a/prnt/hpijs/hpijs.cpp.logdir 2012-10-17 09:56:29.390578050 +0100
++++ hplip-3.12.10a/prnt/hpijs/hpijs.cpp 2012-10-17 09:56:29.398578093 +0100
@@ -29,6 +29,7 @@
POSSIBILITY OF SUCH DAMAGE.
\*****************************************************************************/
@@ -232,7 +257,7 @@ diff -up hplip-3.12.10a/prnt/hpijs/hpijs.cpp.logdir hplip-3.12.10a/prnt/hpijs/hp
#endif
diff -up hplip-3.12.10a/prnt/hpijs/hpijsfax.cpp.logdir hplip-3.12.10a/prnt/hpijs/hpijsfax.cpp
--- hplip-3.12.10a/prnt/hpijs/hpijsfax.cpp.logdir 2012-10-10 07:08:50.000000000 +0100
-+++ hplip-3.12.10a/prnt/hpijs/hpijsfax.cpp 2012-10-16 11:32:41.970953762 +0100
++++ hplip-3.12.10a/prnt/hpijs/hpijsfax.cpp 2012-10-17 09:56:29.398578093 +0100
@@ -31,6 +31,7 @@
#ifdef HAVE_LIBHPIP
@@ -259,3 +284,44 @@ diff -up hplip-3.12.10a/prnt/hpijs/hpijsfax.cpp.logdir hplip-3.12.10a/prnt/hpijs
pFaxStruct = new HPIJSFax ();
+diff -up hplip-3.12.10a/prnt/hpps/hppsfilter.c.logdir hplip-3.12.10a/prnt/hpps/hppsfilter.c
+--- hplip-3.12.10a/prnt/hpps/hppsfilter.c.logdir 2012-10-17 10:00:07.937687485 +0100
++++ hplip-3.12.10a/prnt/hpps/hppsfilter.c 2012-10-17 10:02:28.968378061 +0100
+@@ -48,13 +48,14 @@
+ #define BOD_PJL "@PJL DMINFO ASCIIHEX=\"%s%s\"\012"
+ #define BOD_DATETIME_FORMAT "%04d%02d%02d%02d%02d%02d"
+ #define DBG_PSFILE "hpps_job"
+-#define DBG_TMP_FOLDER "/var/log/hp/tmp/"
+
+ #define LINE_SIZE 258
+ #define FILE_NAME_SIZE 128
+
+ #define SAVE_PS_FILE 2
+
++static char *env_tmpdir;
++
+ /* save final output ps file: in cupsd.conf file value #hpLogLevel 15 */
+ static int g_savepsfile = 0;
+
+@@ -94,7 +95,7 @@ void open_dbg_outfile(char* szjob_id)
+ if (g_savepsfile & SAVE_PS_FILE)
+ {
+ char sfile_name[FILE_NAME_SIZE] = {0};
+- sprintf(sfile_name, "%s/%s_%d.out",DBG_TMP_FOLDER,DBG_PSFILE, szjob_id);
++ sprintf(sfile_name, "%s/%s_%d.out",env_tmpdir,DBG_PSFILE, szjob_id);
+ g_fp_outdbgps= fopen(sfile_name, "w");
+ chmod(sfile_name, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ }
+@@ -163,7 +164,11 @@ int main (int argc, char **argv)
+ {
+ cups_file_t *fp_input = NULL; /* input file: stdin or physical file */
+ char line[LINE_SIZE] = {0};
+-
++
++ env_tmpdir = getenv ("TMPDIR");
++ if (!env_tmpdir)
++ env_tmpdir = "/var/log/hp/tmp/";
++
+ get_LogLevel();
+ setbuf (stderr, NULL);
+ fprintf (stderr, "HP PS filter starting : %s \n", *argv);
diff --git a/hplip.spec b/hplip.spec
index e8c15a6..8d6af20 100644
--- a/hplip.spec
+++ b/hplip.spec
@@ -3,7 +3,7 @@
Summary: HP Linux Imaging and Printing Project
Name: hplip
Version: 3.12.10
-Release: 3.%{posttag}%{?dist}
+Release: 4.%{posttag}%{?dist}
License: GPLv2+ and MIT
Group: System Environment/Daemons
@@ -526,6 +526,10 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
%postun libs -p /sbin/ldconfig
%changelog
+* Wed Oct 17 2012 Tim Waugh <twaugh at redhat.com> 3.12.10-4.a
+- Some more CUPS filters using the wrong temporary directory
+ (bug #865603).
+
* Tue Oct 16 2012 Tim Waugh <twaugh at redhat.com> 3.12.10-3.a
- CUPS filters should use TMPDIR when available (bug #865603).
More information about the scm-commits
mailing list