From: msweet
Date: Thu, 18 Jun 2009 22:32:02 +0000 (+0000)
Subject: Merge changes from CUPS 1.4svn-r8722 (tentative 1.4.0 GM)
X-Git-Tag: release-1.6.3~97
X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=acb056cb175d1a003334c130e8e6bf3aa8edbff2;p=thirdparty%2Fcups.git
Merge changes from CUPS 1.4svn-r8722 (tentative 1.4.0 GM)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1567 a1ca3aef-8c08-0410-bb20-df032aa958be
---
diff --git a/CHANGES-1.3.txt b/CHANGES-1.3.txt
index d63ec68158..9af534f9bf 100644
--- a/CHANGES-1.3.txt
+++ b/CHANGES-1.3.txt
@@ -3,6 +3,12 @@ CHANGES-1.3.txt
CHANGES IN CUPS V1.3.11
+ - The scheduler did not prevent nested classes (STR #3211)
+ - The scheduler did not reprint processing jobs that were moved to
+ another destination (STR #3222)
+ - The scheduler did not reset the current job file when stopping a
+ printer (STR #3226)
+ - The scheduler did not handle POSTs to custom CGIs properly (STR #3221)
- The pdftops filter did not print landscape PDF pages properly
(STR #2881)
- The scheduler did not handle partial header lines properly from CGI
diff --git a/CHANGES.txt b/CHANGES.txt
index f818ec313b..19844bb008 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,23 @@
-CHANGES.txt - 2009-06-08
+CHANGES.txt - 2009-06-18
------------------------
+CHANGES IN CUPS V1.4.0
+
+ - Localization updates (STR #3223)
+ - Documentation updates (STR #3225)
+ - Fixed a HTML error in the add and modify printer web interface templates
+ (STR #3229)
+ - The scheduler did not minimize the number of printer state events that
+ were generated by filter STATE: messages, which could lead to poor
+ performance.
+ - The USB backend on Mac OS X did not cleanly cancel a job.
+ - The network backends now set the connecting-to-device printer-state-
+ reasons value when looking up the address and copying the print data
+ for consistency.
+ - The scheduler now supports the com.apple.print.recoverable-warning
+ reason on all platforms.
+
+
CHANGES IN CUPS V1.4rc1
- The PPD compiler documentation was missing information on localization
diff --git a/backend/ipp.c b/backend/ipp.c
index 176df77d26..dac3597667 100644
--- a/backend/ipp.c
+++ b/backend/ipp.c
@@ -91,7 +91,7 @@ main(int argc, /* I - Number of command-line args */
int num_options; /* Number of printer options */
cups_option_t *options; /* Printer options */
const char *device_uri; /* Device URI */
- char method[255], /* Method in URI */
+ char scheme[255], /* Scheme in URI */
hostname[1024], /* Hostname */
username[255], /* Username info */
resource[1024], /* Resource info (printer name) */
@@ -236,21 +236,14 @@ main(int argc, /* I - Number of command-line args */
if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
return (CUPS_BACKEND_FAILED);
- if (httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
- method, sizeof(method), username, sizeof(username),
- hostname, sizeof(hostname), &port,
- resource, sizeof(resource)) < HTTP_URI_OK)
- {
- _cupsLangPuts(stderr,
- _("ERROR: Missing device URI on command-line and no "
- "DEVICE_URI environment variable!\n"));
- return (CUPS_BACKEND_STOP);
- }
+ httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme),
+ username, sizeof(username), hostname, sizeof(hostname), &port,
+ resource, sizeof(resource));
if (!port)
port = IPP_PORT; /* Default to port 631 */
- if (!strcmp(method, "https"))
+ if (!strcmp(scheme, "https"))
cupsSetEncryption(HTTP_ENCRYPT_ALWAYS);
else
cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED);
@@ -421,6 +414,9 @@ main(int argc, /* I - Number of command-line args */
off_t tbytes; /* Total bytes copied */
+ fputs("STATE: +connecting-to-device\n", stderr);
+ fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
+
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, "1")) == NULL)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
@@ -544,8 +540,7 @@ main(int argc, /* I - Number of command-line args */
do
{
- fprintf(stderr, "DEBUG: Connecting to %s:%d\n",
- hostname, port);
+ fprintf(stderr, "DEBUG: Connecting to %s:%d\n", hostname, port);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
if ((http = httpConnectEncrypt(hostname, port, cupsEncryption())) == NULL)
@@ -661,7 +656,8 @@ main(int argc, /* I - Number of command-line args */
* might contain username:password information...
*/
- snprintf(uri, sizeof(uri), "%s://%s:%d%s", method, hostname, port, resource);
+ httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), scheme, NULL, hostname,
+ port, resource);
/*
* First validate the destination and see if the device supports multiple
diff --git a/backend/lpd.c b/backend/lpd.c
index b15f21581a..d6597cf1cb 100644
--- a/backend/lpd.c
+++ b/backend/lpd.c
@@ -113,7 +113,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
const char *device_uri; /* Device URI */
- char method[255], /* Method in URI */
+ char scheme[255], /* Scheme in URI */
hostname[1024], /* Hostname */
username[255], /* Username info */
resource[1024], /* Resource info (printer name) */
@@ -193,9 +193,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
return (CUPS_BACKEND_FAILED);
- httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
- method, sizeof(method), username, sizeof(username),
- hostname, sizeof(hostname), &port,
+ httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme),
+ username, sizeof(username), hostname, sizeof(hostname), &port,
resource, sizeof(resource));
if (!port)
@@ -430,6 +429,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
int bytes; /* Number of bytes read */
+ fputs("STATE: +connecting-to-device\n", stderr);
+ fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
+
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, "1")) == NULL)
{
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
@@ -695,6 +697,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
sprintf(portname, "%d", port);
+ fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
@@ -721,9 +724,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
* First try to reserve a port for this connection...
*/
- fputs("STATE: +connecting-to-device\n", stderr);
- fprintf(stderr, "DEBUG: Connecting to %s:%d for printer %s\n",
- hostname, port, printer);
+ fprintf(stderr, "DEBUG: Connecting to %s:%d for printer %s\n", hostname,
+ port, printer);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
for (lport = reserve == RESERVE_RFC1179 ? 732 : 1024, addr = addrlist,
diff --git a/backend/socket.c b/backend/socket.c
index f3d20b9b44..35d35e8bf7 100644
--- a/backend/socket.c
+++ b/backend/socket.c
@@ -3,7 +3,7 @@
*
* AppSocket backend for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -62,7 +62,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
char *argv[]) /* I - Command-line arguments */
{
const char *device_uri; /* Device URI */
- char method[255], /* Method in URI */
+ char scheme[255], /* Scheme in URI */
hostname[1024], /* Hostname */
username[255], /* Username info (not used) */
resource[1024], /* Resource info (not used) */
@@ -168,9 +168,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
return (CUPS_BACKEND_FAILED);
- httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
- method, sizeof(method), username, sizeof(username),
- hostname, sizeof(hostname), &port,
+ httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme),
+ username, sizeof(username), hostname, sizeof(hostname), &port,
resource, sizeof(resource));
if (port == 0)
@@ -261,6 +260,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
sprintf(portname, "%d", port);
+ fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname);
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
@@ -270,12 +270,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
return (CUPS_BACKEND_STOP);
}
- fprintf(stderr, "DEBUG: Connecting to %s:%d\n",
- hostname, port);
+ fprintf(stderr, "DEBUG: Connecting to %s:%d\n", hostname, port);
_cupsLangPuts(stderr, _("INFO: Connecting to printer...\n"));
- fputs("STATE: +connecting-to-device\n", stderr);
-
for (delay = 5;;)
{
if ((addr = httpAddrConnect(addrlist, &device_fd)) == NULL)
@@ -345,9 +342,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (recoverable)
{
/*
- * If we've shown a recoverable error make sure the printer proxies
- * have a chance to see the recovered message. Not pretty but
- * necessary for now...
+ * If we've shown a recoverable error make sure the printer proxies have a
+ * chance to see the recovered message. Not pretty but necessary for now...
*/
fputs("INFO: recovered: \n", stderr);
diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c
index 10b45f6b13..7bc37f75cb 100644
--- a/backend/usb-darwin.c
+++ b/backend/usb-darwin.c
@@ -104,6 +104,14 @@
extern char **environ;
+/*
+ * DEBUG_WRITES, if defined, causes the backend to write data to the printer in
+ * 512 byte increments, up to 8192 bytes, to make debugging with a USB bus
+ * analyzer easier.
+ */
+
+#define DEBUG_WRITES 0
+
/*
* WAIT_EOF_DELAY is number of seconds we'll wait for responses from
* the printer after we've finished sending all the data
@@ -232,6 +240,9 @@ typedef struct globals_s
int print_fd; /* File descriptor to print */
ssize_t print_bytes; /* Print bytes read */
+#if DEBUG_WRITES
+ ssize_t debug_bytes; /* Current bytes to read */
+#endif /* DEBUG_WRITES */
Boolean wait_eof;
int drain_output; /* Drain all pending output */
@@ -318,8 +329,7 @@ print_device(const char *uri, /* I - Device URI */
{
char serial[1024]; /* Serial number buffer */
OSStatus status; /* Function results */
- IOReturn iostatus, /* Current IO status */
- prev_iostatus = 0; /* Previous IO status */
+ IOReturn iostatus; /* Current IO status */
pthread_t read_thread_id, /* Read thread */
sidechannel_thread_id;/* Side-channel thread */
int have_sidechannel = 0; /* Was the side-channel thread started? */
@@ -612,7 +622,16 @@ print_device(const char *uri, /* I - Device URI */
if (FD_ISSET(print_fd, &input_set))
{
+#if DEBUG_WRITES
+ g.debug_bytes += 512;
+ if (g.debug_bytes > sizeof(print_buffer))
+ g.debug_bytes = 512;
+
+ g.print_bytes = read(print_fd, print_buffer, g.debug_bytes);
+
+#else
g.print_bytes = read(print_fd, print_buffer, sizeof(print_buffer));
+#endif /* DEBUG_WRITES */
if (g.print_bytes < 0)
{
@@ -646,8 +665,7 @@ print_device(const char *uri, /* I - Device URI */
if (g.print_bytes)
{
- bytes = g.print_bytes;
-
+ bytes = g.print_bytes;
iostatus = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
/*
@@ -662,26 +680,20 @@ print_device(const char *uri, /* I - Device URI */
}
/*
- * Ignore the first stall error we get since we try to clear any stalls
- * in the class driver...
+ * If we've stalled, retry the write...
*/
else if (iostatus == kIOUSBPipeStalled)
{
fputs("DEBUG: Got USB pipe stalled during write!\n", stderr);
- bytes = 0;
-
- if (prev_iostatus != kIOUSBPipeStalled)
- {
- prev_iostatus = iostatus;
- iostatus = 0;
- }
+ bytes = g.print_bytes;
+ iostatus = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
}
/*
- * Ignore the first "aborted" status we get, since we might have
- * received a signal ()...
+ * Retry a write after an aborted write since we probably just got
+ * SIGTERM ()...
*/
else if (iostatus == kIOReturnAborted)
@@ -691,16 +703,13 @@ print_device(const char *uri, /* I - Device URI */
IOReturn err = (*g.classdriver)->Abort(g.classdriver);
fprintf(stderr, "DEBUG: USB class driver Abort returned %x\n", err);
- bytes = 0;
+#if DEBUG_WRITES
+ sleep(5);
+#endif /* DEBUG_WRITES */
- if (prev_iostatus != kIOReturnAborted)
- {
- prev_iostatus = iostatus;
- iostatus = 0;
- }
+ bytes = g.print_bytes;
+ iostatus = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
}
- else
- prev_iostatus = iostatus;
if (iostatus || bytes < 0)
{
diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c
index f0812c81ae..ddddd76edf 100644
--- a/cgi-bin/admin.c
+++ b/cgi-bin/admin.c
@@ -492,6 +492,12 @@ do_am_class(http_t *http, /* I - HTTP connection */
request = ippNewRequest(CUPS_GET_PRINTERS);
+ ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type",
+ CUPS_PRINTER_LOCAL);
+ ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type-mask",
+ CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE |
+ CUPS_PRINTER_IMPLICIT);
+
/*
* Do the request and get back a response...
*/
diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4
index 1eebf17b23..11bffc60c9 100644
--- a/config-scripts/cups-common.m4
+++ b/config-scripts/cups-common.m4
@@ -20,7 +20,7 @@ dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number information...
-CUPS_VERSION="1.4rc1"
+CUPS_VERSION="1.4.0"
CUPS_REVISION=""
#if test -z "$CUPS_REVISION" -a -d .svn; then
# CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
diff --git a/cups/api-filter.shtml b/cups/api-filter.shtml
index 49bf24be36..cbf29657d5 100644
--- a/cups/api-filter.shtml
+++ b/cups/api-filter.shtml
@@ -127,7 +127,7 @@ when running print filters and backends:
-
APPLE_LANGUAGES
+
APPLE_LANGUAGE
The Apple language identifier associated with the job
(Mac OS X only).
@@ -264,7 +264,16 @@ prefix strings:
current queue. Typically this is used to indicate persistent media,
ink, toner, and configuration conditions or errors on a printer.
Table 2 lists the standard state keywords -
- use vendor-prefixed ("com.acme.foo") keywords for custom states.
+ use vendor-prefixed ("com.acme.foo") keywords for custom states.
+
+
Note:
+
+
"STATE:" messages often provide visible alerts to the user. For example, on
+ Mac OS X setting a printer-state-reason value with an "-error" or "-warning"
+ suffix will cause the printer's dock item to bounce if the corresponding reason
+ is localized with a cupsIPPReason keyword in the printer's PPD file.
+
+
WARNING: message
Sets the printer-state-message attribute and adds the specified
@@ -276,7 +285,6 @@ prefix strings:
Messages without one of these prefixes are treated as if they began with
the "DEBUG:" prefix string.
diff --git a/cups/http-support.c b/cups/http-support.c
index cd78c628b6..bb90964253 100644
--- a/cups/http-support.c
+++ b/cups/http-support.c
@@ -50,6 +50,7 @@
#include "debug.h"
#include "globals.h"
#include
+#include
#ifdef HAVE_DNSSD
# include
# include
@@ -1406,7 +1407,6 @@ _httpResolveURI(
fputs("STATE: +connecting-to-device\n", stderr);
fprintf(stderr, "DEBUG: Resolving \"%s\", regtype=\"%s\", "
"domain=\"local.\"...\n", hostname, regtype);
- _cupsLangPuts(stderr, _("INFO: Looking for printer...\n"));
}
uri = NULL;
@@ -1418,36 +1418,65 @@ _httpResolveURI(
hostname, regtype, "local.", resolve_callback,
&uribuf) == kDNSServiceErr_NoError)
{
- if (strcasecmp(domain, "local."))
+ int fds; /* Number of ready descriptors */
+ time_t timeout, /* Poll timeout */
+ start_time = time(NULL);/* Start time */
+
+ for (;;)
{
+ if (logit)
+ _cupsLangPuts(stderr, _("INFO: Looking for printer...\n"));
+
/*
- * Wait 2 seconds for a response to the local resolve; if nothing comes
- * in, do an additional domain resolution...
+ * For the first minute, wakeup every 2 seconds to emit a
+ * "looking for printer" message...
*/
+ timeout = (time(NULL) < (start_time + 60)) ? 2000 : -1;
+
polldata.fd = DNSServiceRefSockFD(ref);
polldata.events = POLLIN;
- if (poll(&polldata, 1, 2000) != 1)
+ fds = poll(&polldata, 1, timeout);
+
+ if (fds < 0)
+ {
+ if (errno != EINTR && errno != EAGAIN)
+ {
+ DEBUG_printf(("5_httpResolveURI: poll error: %s", strerror(errno)));
+ break;
+ }
+ }
+ else if (fds == 0)
{
/*
- * OK, send the domain name resolve...
+ * Wait 2 seconds for a response to the local resolve; if nothing
+ * comes in, do an additional domain resolution...
*/
- if (logit)
- fprintf(stderr, "DEBUG: Resolving \"%s\", regtype=\"%s\", "
- "domain=\"%s\"...\n", hostname, regtype, domain);
-
- domainref = ref;
- if (DNSServiceResolve(&domainref, kDNSServiceFlagsShareConnection, 0,
- hostname, regtype, domain, resolve_callback,
- &uribuf) == kDNSServiceErr_NoError)
- domainsent = 1;
+ if (domainsent == 0 && strcasecmp(domain, "local."))
+ {
+ if (logit)
+ fprintf(stderr,
+ "DEBUG: Resolving \"%s\", regtype=\"%s\", "
+ "domain=\"%s\"...\n", hostname, regtype, domain);
+
+ domainref = ref;
+ if (DNSServiceResolve(&domainref, kDNSServiceFlagsShareConnection, 0,
+ hostname, regtype, domain, resolve_callback,
+ &uribuf) == kDNSServiceErr_NoError)
+ domainsent = 1;
+ }
}
- }
-
- if (DNSServiceProcessResult(ref) == kDNSServiceErr_NoError)
- uri = resolved_uri;
+ else
+ {
+ if (DNSServiceProcessResult(ref) == kDNSServiceErr_NoError)
+ {
+ uri = resolved_uri;
+ break;
+ }
+ }
+ }
if (domainsent)
DNSServiceRefDeallocate(domainref);
diff --git a/doc/help/api-filter.html b/doc/help/api-filter.html
index da8a1373d1..c5e89b0123 100644
--- a/doc/help/api-filter.html
+++ b/doc/help/api-filter.html
@@ -549,7 +549,7 @@ when running print filters and backends:
-
APPLE_LANGUAGES
+
APPLE_LANGUAGE
The Apple language identifier associated with the job
(Mac OS X only).
@@ -686,7 +686,16 @@ prefix strings:
current queue. Typically this is used to indicate persistent media,
ink, toner, and configuration conditions or errors on a printer.
Table 2 lists the standard state keywords -
- use vendor-prefixed ("com.acme.foo") keywords for custom states.
+ use vendor-prefixed ("com.acme.foo") keywords for custom states.
+
+
Note:
+
+
"STATE:" messages often provide visible alerts to the user. For example, on
+ Mac OS X setting a printer-state-reason value with an "-error" or "-warning"
+ suffix will cause the printer's dock item to bounce if the corresponding reason
+ is localized with a cupsIPPReason keyword in the printer's PPD file.
+
+
WARNING: message
Sets the printer-state-message attribute and adds the specified
@@ -698,7 +707,6 @@ prefix strings:
Messages without one of these prefixes are treated as if they began with
the "DEBUG:" prefix string.