Merge branch 'f18'

This commit is contained in:
Tim Waugh 2012-10-16 11:39:32 +01:00
commit 173d4189f2
2 changed files with 269 additions and 1 deletions

261
hplip-logdir.patch Normal file
View File

@ -0,0 +1,261 @@
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
@@ -39,7 +39,7 @@ CUPS_BACKUP_FILE='/etc/cups/cupsd.conf_o
LOG_FOLDER_PATH='./'
LOG_FOLDER_NAME='hplip_troubleshoot_logs'
LOG_FILES=LOG_FOLDER_PATH + LOG_FOLDER_NAME
-TMP_DIR='/var/log/hp/tmp'
+TMP_DIR='/var/spool/cups/tmp'
############ enable_log() function ############
#This function changes CUPS conf log level to debug and restarts CUPS service.
@@ -268,7 +268,7 @@ if os.path.exists('/var/log/cups/error_l
log.error("Failed to capture %s log file."%("/var/log/cups/error_log"))
-File_list, File_list_str = utils.expand_list('/var/log/hp/*.log')
+File_list, File_list_str = utils.expand_list('%s/*.log'%TMP_DIR)
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/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
@@ -31,16 +31,24 @@
\*****************************************************************************/
#include "HPCupsFilter.h"
+#include <limits.h>
#include <signal.h>
+#include <stdlib.h>
#include <sys/wait.h>
#include <sys/utsname.h>
#include <time.h>
#define HP_FILE_VERSION_STR "03.09.08.0"
+char *env_tmpdir = NULL;
+
static HPCupsFilter filter;
int main (int argc, char *argv[])
{
+ env_tmpdir = getenv ("TMPDIR");
+ if (!env_tmpdir)
+ env_tmpdir = "/var/log/hp/tmp";
+
openlog("hpcups", LOG_PID, LOG_DAEMON);
if (argc < 6 || argc > 7) {
@@ -583,9 +591,10 @@ int HPCupsFilter::processRasterData(cups
DRIVER_ERROR err;
int ret_status = 0;
- char hpPreProcessedRasterFile[64]; //temp file needed to store raster data with swaped pages.
+ char hpPreProcessedRasterFile[PATH_MAX]; //temp file needed to store raster data with swaped pages.
- strcpy(hpPreProcessedRasterFile, "/var/log/hp/tmp/hplipSwapedPagesXXXXXX");
+ snprintf(hpPreProcessedRasterFile, sizeof (hpPreProcessedRasterFile),
+ "%s/hplipSwapedPagesXXXXXX", env_tmpdir);
while (cupsRasterReadHeader2(cups_raster, &cups_header))
@@ -647,9 +656,9 @@ int HPCupsFilter::processRasterData(cups
if (m_iLogLevel & SAVE_INPUT_RASTERS)
{
- char szFileName[64];
+ char szFileName[PATH_MAX];
memset(szFileName, 0, sizeof(szFileName));
- snprintf (szFileName, sizeof(szFileName), "/var/log/hp/tmp/hpcupsfilterc_%d.bmp", current_page_number);
+ snprintf (szFileName, sizeof(szFileName), "%s/hpcupsfilterc_%d.bmp", env_tmpdir, current_page_number);
if (cups_header.cupsColorSpace == CUPS_CSPACE_RGBW ||
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
@@ -42,9 +42,12 @@
#include "LJZjStream.h"
#include "Utils.h"
#include "hpjbig_wrapper.h"
+#include <limits.h>
#define ZJC_BAND_HEIGHT 100
+extern char *env_tmpdir;
+
LJZjStream::LJZjStream () : Encapsulator ()
{
memset(&m_PM, 0, sizeof(m_PM));
@@ -675,10 +678,10 @@ DRIVER_ERROR LJZjStream::preProcessRaste
cups_raster_t *even_pages_raster=NULL;
cups_raster_t *odd_pages_raster = NULL;
BYTE* pPageDataBuffer = NULL;
- char hpEvenPagesFile[64];
- char hpOddPagesFile[64];
- snprintf(hpEvenPagesFile, sizeof(hpEvenPagesFile), "%s/hplipEvenPagesXXXXXX","/var/log/hp/tmp");
- snprintf(hpOddPagesFile, sizeof(hpOddPagesFile), "%s/hplipOddPagesXXXXXX", "/var/log/hp/tmp");
+ char hpEvenPagesFile[PATH_MAX];
+ char hpOddPagesFile[PATH_MAX];
+ snprintf(hpEvenPagesFile, sizeof(hpEvenPagesFile), "%s/hplipEvenPagesXXXXXX",env_tmpdir);
+ snprintf(hpOddPagesFile, sizeof(hpOddPagesFile), "%s/hplipOddPagesXXXXXX", env_tmpdir);
if (1 != m_pJA->pre_process_raster || !cups_header.Duplex){
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
@@ -30,14 +30,17 @@
#include "CommonDefinitions.h"
#include "SystemServices.h"
+#include <limits.h>
+
+extern char *env_tmpdir;
SystemServices::SystemServices(int iLogLevel, int job_id) : m_iLogLevel(iLogLevel)
{
m_fp = NULL;
if (iLogLevel & SAVE_PCL_FILE)
{
- char fname[64];
- sprintf(fname, "%s/hpcups_job%d.out", "/var/log/hp/tmp",job_id);
+ char fname[PATH_MAX];
+ sprintf(fname, "%s/hpcups_job%d.out", env_tmpdir, job_id);
m_fp = fopen(fname, "w");
chmod(fname, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
}
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
@@ -29,6 +29,7 @@
POSSIBILITY OF SUCH DAMAGE.
\*****************************************************************************/
+#include <limits.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
@@ -66,6 +67,7 @@ uint16_t (*convert_endian_s)(uint16_t);
static int iLogLevel = 1;
char hpFileName[64] ;
+static char *env_tmpdir;
#define TIFF_HDR_SIZE 8
#define LITTLE_ENDIAN_MODE I
@@ -439,9 +441,9 @@ int ProcessTiffData(int fromFD, int toFD
int bytes_written = 0;
int ret_status = 0;
int bytes_read = 0;
- char hpTiffFileName[64];
+ char hpTiffFileName[PATH_MAX];
long input_file_size = 0;
- snprintf(hpTiffFileName,sizeof(hpTiffFileName), "%s/hpliptiffXXXXXX","/var/log/hp/tmp");
+ snprintf(hpTiffFileName,sizeof(hpTiffFileName), "%s/hpliptiffXXXXXX",env_tmpdir);
fdTiff = mkstemp (hpTiffFileName);
@@ -656,6 +658,10 @@ int main (int argc, char **argv)
/*********** PROLOGUE ***********/
+ env_tmpdir = getenv ("TMPDIR");
+ if (!env_tmpdir)
+ env_tmpdir = "/var/log/hp/tmp";
+
GetLogLevel();
openlog("hpcupsfax", LOG_PID, LOG_DAEMON);
@@ -679,7 +685,7 @@ int main (int argc, char **argv)
i++;
}
- snprintf(hpFileName,sizeof(hpFileName),"%s/hplipfaxLog_XXXXXX","/var/log/hp/tmp");
+ snprintf(hpFileName,sizeof(hpFileName),"%s/hplipfaxLog_XXXXXX",env_tmpdir);
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
@@ -29,6 +29,7 @@
POSSIBILITY OF SUCH DAMAGE.
\*****************************************************************************/
+#include <limits.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
@@ -43,6 +44,8 @@
#include "hpijs.h"
#include "services.h"
+static char *env_tmpdir;
+
extern void SendDbusMessage (const char *dev, const char *printer, int code,
const char *username, const int jobid, const char *title);
@@ -96,8 +99,8 @@ void setLogLevel(UXServices *pSS)
if (pSS->m_iLogLevel & SAVE_PCL_FILE)
{
- char szFileName[64];
- snprintf (szFileName,sizeof(szFileName), "/var/log/hp/tmp/hpijs_%d.out", getpid());
+ char szFileName[PATH_MAX];
+ snprintf (szFileName,sizeof(szFileName), "%s/hpijs_%d.out", env_tmpdir, getpid());
pSS->outfp = fopen (szFileName, "w");
if (pSS->outfp)
@@ -588,6 +591,10 @@ int main (int argc, char *argv[], char *
int ret, n, i, kn=0, width, k_width;
int low_marker = 0;
+ env_tmpdir = getenv ("TMPDIR");
+ if (!env_tmpdir)
+ env_tmpdir = "/var/log/hp/tmp";
+
openlog("hpijs", LOG_PID, LOG_DAEMON);
if (argc > 1)
@@ -627,8 +634,8 @@ int main (int argc, char *argv[], char *
setLogLevel(pSS);
#ifdef CAPTURE
- char szCapOutFile[64];
- snprintf(szCapOutFile, sizeof(szCapOutFile),"%s/capout_XXXXXX","/var/log/hp/tmp");
+ char szCapOutFile[PATH_MAX];
+ snprintf(szCapOutFile, sizeof(szCapOutFile),"%s/capout_XXXXXX",env_tmpdir);
if ((pSS->InitScript(szCapOutFile, TRUE)) != NO_ERROR)
BUG("unable to init capture");
#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
@@ -31,6 +31,7 @@
#ifdef HAVE_LIBHPIP
+#include <limits.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
@@ -270,14 +271,15 @@ int hpijsFaxServer (int argc, char **arg
IP_IMAGE_TRAITS traits;
IP_HANDLE hJob;
- char hpFileName[64];
+ char hpFileName[PATH_MAX];
int fdFax = -1;
BYTE szFileHeader[68];
BYTE szPageHeader[64];
BYTE *p;
unsigned int uiPageNum = 0;
- snprintf(hpFileName,sizeof(hpFileName),"%s/hplipfaxXXXXXX","/var/log/hp/tmp");
+ snprintf(hpFileName,sizeof(hpFileName),"%s/hplipfaxXXXXXX",
+ getenv ("TMPDIR") ? : "/var/log/hp/tmp");
pFaxStruct = new HPIJSFax ();

View File

@ -3,7 +3,7 @@
Summary: HP Linux Imaging and Printing Project
Name: hplip
Version: 3.12.10
Release: 2.%{posttag}%{?dist}
Release: 3.%{posttag}%{?dist}
License: GPLv2+ and MIT
Group: System Environment/Daemons
@ -25,6 +25,7 @@ Patch11: hplip-hpijs-marker-supply.patch
Patch12: hplip-clear-old-state-reasons.patch
Patch13: hplip-systray-dbus-exception.patch
Patch14: hplip-hpcups-sigpipe.patch
Patch15: hplip-logdir.patch
Patch16: hplip-bad-low-ink-warning.patch
Patch17: hplip-deviceIDs-ppd.patch
Patch18: hplip-skip-blank-lines.patch
@ -213,6 +214,9 @@ mv prnt/drv/hpijs.drv.in{,.deviceIDs-drv-hpijs}
# Avoid busy loop in hpcups when backend has exited (bug #525944).
%patch14 -p1 -b .hpcups-sigpipe
# CUPS filters should use TMPDIR when available (bug #865603).
%patch15 -p1 -b .logdir
# Fixed Device ID parsing code in hpijs's dj9xxvip.c (bug #510926).
%patch16 -p1 -b .bad-low-ink-warning
@ -526,6 +530,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
%postun libs -p /sbin/ldconfig
%changelog
* Tue Oct 16 2012 Tim Waugh <twaugh@redhat.com> 3.12.10-3.a
- CUPS filters should use TMPDIR when available (bug #865603).
* Thu Oct 11 2012 Jiri Popelka <jpopelka@redhat.com> 3.12.10-2.a
- 3.12.10a