Date: Thu, 21 Oct 2010 06:52:14 +0000 (UTC) From: Edwin Groothuis <edwin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r214124 - head/usr.sbin/lpr/lpr Message-ID: <201010210652.o9L6qFvq081581@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: edwin Date: Thu Oct 21 06:52:14 2010 New Revision: 214124 URL: http://svn.freebsd.org/changeset/base/214124 Log: 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 <Peter.Jeremy@alcatel-lucent.com> MFC after: 1 week Modified: head/usr.sbin/lpr/lpr/lpr.c Modified: head/usr.sbin/lpr/lpr/lpr.c ============================================================================== --- head/usr.sbin/lpr/lpr/lpr.c Thu Oct 21 01:13:41 2010 (r214123) +++ head/usr.sbin/lpr/lpr/lpr.c Thu Oct 21 06:52:14 2010 (r214124) @@ -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')
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010210652.o9L6qFvq081581>