From owner-svn-src-stable@FreeBSD.ORG Thu Oct 28 00:54:18 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E87C410656A6; Thu, 28 Oct 2010 00:54:18 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBFA18FC13; Thu, 28 Oct 2010 00:54:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9S0sIik050351; Thu, 28 Oct 2010 00:54:18 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9S0sIIE050349; Thu, 28 Oct 2010 00:54:18 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201010280054.o9S0sIIE050349@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 28 Oct 2010 00:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214442 - stable/8/usr.sbin/lpr/lpr X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 00:54:19 -0000 Author: edwin Date: Thu Oct 28 00:54:18 2010 New Revision: 214442 URL: http://svn.freebsd.org/changeset/base/214442 Log: MFC of 214124 Fix printing of files located on ZFS filesystem with an st_dev or st_ino larger than 2**31. From the PR: Printing from a ZFS filesystem using 'lp' fails and returns an email reporting "Your printer job was not printed because it was not linked to the original file". In order to protect against files being switched when files are printed using 'lp' or 'lpr -s', the st_dev and st_ino values for the original file are saved by lpr and verified by lpd before the file is printed. Unfortunately, lpr prints both values using '%d' (although both fields are unsigned) and lpd(8) assumes a string of decimal digits. ZFS (at least) generates st_dev values greater than 2^31-1, resulting in negative values being printed - which lpd cannot parse, leading it to report that the file has been switched. A similar problem would occur with large inode numbers. How-To-Repeat: Find a file with either st_dev or st_ino greater than 2^31-1 (stat(1) will report both numbers) and print it with 'lpq -s'. This should generate an email reporting that the file could not be printed because it was not linked to the original file PR: bin/151567 Submitted by: Peter Jeremy Modified: stable/8/usr.sbin/lpr/lpr/lpr.c Directory Properties: stable/8/usr.sbin/lpr/ (props changed) Modified: stable/8/usr.sbin/lpr/lpr/lpr.c ============================================================================== --- stable/8/usr.sbin/lpr/lpr/lpr.c Thu Oct 28 00:16:54 2010 (r214441) +++ stable/8/usr.sbin/lpr/lpr/lpr.c Thu Oct 28 00:54:18 2010 (r214442) @@ -386,7 +386,7 @@ main(int argc, char *argv[]) continue; /* file unreasonable */ if (sflag && (cp = linked(arg)) != NULL) { - (void) snprintf(buf, sizeof(buf), "%d %d", statb.st_dev, + (void) snprintf(buf, sizeof(buf), "%u %u", statb.st_dev, statb.st_ino); card('S', buf); if (format == 'p')