From owner-freebsd-current@FreeBSD.ORG Mon Sep 9 21:35:02 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DE3F634C; Mon, 9 Sep 2013 21:35:02 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BF4E525F0; Mon, 9 Sep 2013 21:35:02 +0000 (UTC) Received: from zeta.ixsystems.com (unknown [69.198.165.132]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 62E5C11D7D; Mon, 9 Sep 2013 14:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1378762502; bh=ITbwRxXnSmV7OqxMt6c40PNoWUQ/QMOznWMi1ZDKHOs=; h=Date:From:Reply-To:To:CC:Subject; b=XHvYmTdE6pemJSLBMY1mrwu/dV1NnZPmx/ps3caPoKFfHzSRdaPQmbouRTsVtYuTc NEufZ/Oj2Ou3h2CNXSZWCkDW7CBogpF0ue/tSOwVfNpWu7sGE0D6cj1wunCmY3lc6k 2w0tmVbinqFWYMWcunT6Bx3E7pRpfTcituUoLFCo= Message-ID: <522E3F06.3090003@delphij.net> Date: Mon, 09 Sep 2013 14:35:02 -0700 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: FreeBSD Current Subject: [PATCH] mtree should not output size if the file is not a regular file X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= , Brooks Davis , christos@NetBSD.org, Tim Kientzle X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2013 21:35:02 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi, I think it doesn't make sense to emit size information for non-regular files like directories, symlinks, etc. although both our and NetBSD's mtree would emit it. Comments? Index: usr.sbin/mtree/create.c =================================================================== - --- usr.sbin/mtree/create.c (revision 255424) +++ usr.sbin/mtree/create.c (working copy) @@ -208,7 +208,7 @@ statf(int indent, FTSENT *p) output(indent, &offset, "mode=%#o", p->fts_statp->st_mode & MBITS); if (keys & F_NLINK && p->fts_statp->st_nlink != 1) output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink); - - if (keys & F_SIZE) + if (keys & F_SIZE && S_ISREG(p->fts_statp->st_mode)) output(indent, &offset, "size=%jd", (intmax_t)p->fts_statp->st_size); if (keys & F_TIME) Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (FreeBSD) iQEcBAEBCgAGBQJSLj8GAAoJEG80Jeu8UPuzfr4H/RU/qxwVIBAdiXzaD7CvPnCr 3fl+wMIaugYYyZCOWXu1cW4NS8eq5PGPtkJyXCjxGjnyjIpJgZ9XWxZMzdNR4ID0 qLuDOStThE3jjQ/11vx4G4qwsd7iB/BE0O8dfpf68VQu50b40IRl6nDRfHrUETuZ wYFT+tbm6EiJlNif6Y9XNFJhdAuow3oPEexx6fxv5AUaC9ZeyoSZQdCJoDcfOsXm gEnB1IJiS5hRXckimvTrq8pjnfj+u6oTAj9U4klAx0yDk6VZuZPIWaYOnPZJr7BR rVuiRbLFnc2yIPyFFq7y3guqCJpRvOwRuOF/N5vj3qSCYJXmIasXkUjUM6hsxA0= =hteB -----END PGP SIGNATURE-----