From unknown Fri Jun 20 07:15:54 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#6555 <6555@debbugs.gnu.org> To: bug#6555 <6555@debbugs.gnu.org> Subject: Status: stat enhancement Reply-To: bug#6555 <6555@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:15:54 +0000 retitle 6555 stat enhancement reassign 6555 coreutils submitter 6555 A Burgie severity 6555 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 02 16:54:34 2010 Received: (at submit) by debbugs.gnu.org; 2 Jul 2010 20:54:34 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OUnFq-0008MW-89 for submit@debbugs.gnu.org; Fri, 02 Jul 2010 16:54:34 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OUnB4-0008Kd-NH for submit@debbugs.gnu.org; Fri, 02 Jul 2010 16:49:39 -0400 Received: from lists.gnu.org ([199.232.76.165]:38312) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OUnB0-0003gQ-Fs for submit@debbugs.gnu.org; Fri, 02 Jul 2010 16:49:34 -0400 Received: from [140.186.70.92] (port=52267 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUnAy-0002VB-Pu for bug-coreutils@gnu.org; Fri, 02 Jul 2010 16:49:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OUnAx-0001Sq-HL for bug-coreutils@gnu.org; Fri, 02 Jul 2010 16:49:32 -0400 Received: from mail-vw0-f41.google.com ([209.85.212.41]:49942) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OUnAx-0001SZ-DT for bug-coreutils@gnu.org; Fri, 02 Jul 2010 16:49:31 -0400 Received: by vws1 with SMTP id 1so4605380vws.0 for ; Fri, 02 Jul 2010 13:49:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:cc:content-type; bh=uy+xqwOMmF0WX9wiYtaFvPaRoOD0KKc5JYdISoEC+ZQ=; b=M2F64HXEC/8ctmL8WnG0C5BuMIIvU53jRax15g//0gYVzwWQCCFBz7N/c7NBt9yYQh F/KDYeepVzNgzsYCKmaAKqg3ewit3UFo+Vsww8+sv82jaRC7PAyQMfm6Hhb7LGFE/XLW HyVE4OeRSKwQKYUS+ItRZpusXIKVrEtmkTbk4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:cc:content-type; b=rQQfYHCONqQT+WOXxDIVRzpIR5XslO7v71/+tyhPyWPAY4MeQnTmGFad7Z1WR3m7Dm kYPpydpiDr5eXVOgpeoV1PdgOsRk3h9IlpHUuUp/e5y/+QgSxfhYMXJFFha8slV0O0Z0 zi4Sp8QCTyaIMgi0XfWfqzNN6HM0yVwrQsSQg= Received: by 10.220.157.140 with SMTP id b12mr701241vcx.156.1278103770187; Fri, 02 Jul 2010 13:49:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.176.136 with HTTP; Fri, 2 Jul 2010 13:49:10 -0700 (PDT) From: A Burgie Date: Fri, 2 Jul 2010 14:49:10 -0600 Message-ID: Subject: stat enhancement To: bug-coreutils@gnu.org Content-Type: multipart/mixed; boundary=e0cb4e8877d735471f048a6db9a9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 02 Jul 2010 16:54:33 -0400 Cc: meyering@redhat.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) --e0cb4e8877d735471f048a6db9a9 Content-Type: text/plain; charset=UTF-8 To Whom it May Concern: I have made a small change to the stat command adding in the ability to print the mountpoint of the specified file/directory. This is something I have heard several others (besides myself) trying to do via various methods involving the df command or some recursive directory traversals but which would make sense in the stat command. Michael Meskes suggested CC-ing meyering@redhat.com as well which I am doing. Reading through the submission process for the package I am not sure if the actual e-mail body should be the output of the 'git format-patch --stdout -1' command or not so I am attaching it. If preferred I will send it inline next time and in the future. Thank-you for your time, Aaron Burgemeister --e0cb4e8877d735471f048a6db9a9 Content-Type: application/octet-stream; name=DIFF Content-Disposition: attachment; filename=DIFF Content-Transfer-Encoding: base64 X-Attachment-Id: f_gb5hrl590 RnJvbSAzM2VmYjE1ZmU3YjQ4ZjczZTk1ZDRjMmJjOWVmYzQwMGZlZDI1ZmE1IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQ0KRnJvbTogQWFyb24gQnVyZ2VtZWlzdGVyIDxkYWpva2VyQGdtYWlsLmNv bT4NCkRhdGU6IEZyaSwgMiBKdWwgMjAxMCAxNDowNzoyNCAtMDYwMA0KU3ViamVjdDogW1BBVENI XSBzdGF0IGVuaGFuY2VkIHRvIHNob3cgbW91bnRwb2ludCBvZiBmaWxlL2RpcmVjdG9yeQ0KDQpD aGFuZ2UgdG8gaW1wbGVtZW50IG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NCisgICAgY2hhciAqbXAgPSBOVUxMOyAg ICAgICAgICAgICAgLyogVGhlIG1hbGxvY2VkIG1vdW50IHBvaW50LiAgKi8NCisgICAgaWYgKHNh dmVfY3dkICgmY3dkKSAhPSAwKQ0KKyAgICB7DQorICAgICAgICBlcnJvciAoMCwgZXJybm8sIF8o ImNhbm5vdCBnZXQgY3VycmVudCBkaXJlY3RvcnkiKSk7DQorICAgICAgICByZXR1cm4gTlVMTDsN CisgICAgfQ0KKyAgICBpZiAoU19JU0RJUiAoZmlsZV9zdGF0LT5zdF9tb2RlKSkNCisgICAgICAg IC8qIEZJTEUgaXMgYSBkaXJlY3RvcnksIHNvIGp1c3QgY2hkaXIgdGhlcmUgZGlyZWN0bHkuICAq Lw0KKyAgICB7DQorICAgICAgICBsYXN0X3N0YXQgPSAqZmlsZV9zdGF0Ow0KKyAgICAgICAgaWYg KGNoZGlyIChmaWxlKSA8IDApDQorICAgICAgICB7DQorICAgICAgICAgICAgZXJyb3IgKDAsIGVy cm5vLCBfKCJjYW5ub3QgY2hhbmdlIHRvIGRpcmVjdG9yeSAlcyIpLCBxdW90ZSAoZmlsZSkpOw0K KyAgICAgICAgICAgIHJldHVybiBOVUxMOw0KKyAgICAgICAgfQ0KKyAgICB9DQorICAgIGVsc2UN CisgICAgICAgIC8qIEZJTEUgaXMgc29tZSBvdGhlciBraW5kIG9mIGZpbGU7IHVzZSBpdHMgZGly ZWN0b3J5LiAgKi8NCisgICAgew0KKyAgICAgICAgY2hhciAqeGRpciA9IGRpcl9uYW1lIChmaWxl KTsNCisgICAgICAgIGNoYXIgKmRpcjsNCisgICAgICAgIEFTU0lHTl9TVFJEVVBBIChkaXIsIHhk aXIpOw0KKyAgICAgICAgZnJlZSAoeGRpcik7DQorICAgICAgICBpZiAoY2hkaXIgKGRpcikgPCAw KQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGVycm9yICgwLCBlcnJubywgXygiY2Fubm90IGNo YW5nZSB0byBkaXJlY3RvcnkgJXMiKSwgcXVvdGUgKGRpcikpOw0KKyAgICAgICAgICAgIHJldHVy biBOVUxMOw0KKyAgICAgICAgfQ0KKyAgICAgICAgaWYgKHN0YXQgKCIuIiwgJmxhc3Rfc3RhdCkg PCAwKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGVycm9yICgwLCBlcnJubywgXygiY2Fubm90 IHN0YXQgY3VycmVudCBkaXJlY3RvcnkgKG5vdyAlcykiKSwNCisgICAgICAgICAgICAgICAgICAg IHF1b3RlIChkaXIpKTsNCisgICAgICAgICAgICBnb3RvIGRvbmU7DQorICAgICAgICB9DQorICAg IH0NCisgICAgLyogTm93IHdhbGsgdXAgRklMRSdzIHBhcmVudHMgdW50aWwgd2UgZmluZCBhbm90 aGVyIGZpbGUgc3lzdGVtIG9yIC8sDQorICAgICAqIGNoZGlyaW5nIGFzIHdlIGdvLiAgTEFTVF9T VEFUIGhvbGRzIHN0YXQgaW5mb3JtYXRpb24gZm9yIHRoZSBsYXN0IHBsYWNlDQorICAgICAqIHdl IHZpc2l0ZWQuICAqLw0KKyAgICB3aGlsZSAodHJ1ZSkNCisgICAgew0KKyAgICAgICAgc3RydWN0 IHN0YXQgc3Q7DQorICAgICAgICBpZiAoc3RhdCAoIi4uIiwgJnN0KSA8IDApDQorICAgICAgICB7 DQorICAgICAgICAgICAgZXJyb3IgKDAsIGVycm5vLCBfKCJjYW5ub3Qgc3RhdCAlcyIpLCBxdW90 ZSAoIi4uIikpOw0KKyAgICAgICAgICAgIGdvdG8gZG9uZTsNCisgICAgICAgIH0NCisgICAgICAg IGlmIChzdC5zdF9kZXYgIT0gbGFzdF9zdGF0LnN0X2RldiB8fCBzdC5zdF9pbm8gPT0gbGFzdF9z dGF0LnN0X2lubykNCisgICAgICAgICAgICAvKiBjd2QgaXMgdGhlIG1vdW50IHBvaW50LiAgKi8N CisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIGlmIChjaGRpciAoIi4uIikgPCAwKQ0KKyAg ICAgICAgew0KKyAg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lZml4X2xlbiwgY2hhciBt LA0KICAgICBjYXNlICd0JzoNCiAgICAgICBvdXRfdWludF94IChwZm9ybWF0LCBwcmVmaXhfbGVu LCBtYWpvciAoc3RhdGJ1Zi0+c3RfcmRldikpOw0KICAgICAgIGJyZWFrOw0KKyAgICBjYXNlICdt JzoNCisgICAgICBvdXRfc3RyaW5nIChwZm9ybWF0LCBwcmVmaXhfbGVuLCBmaW5kX21vdW50X3Bv aW50IChmaWxlbmFtZSwgc3RhdGJ1ZikpOw0KKyAgICAgIGJyZWFrOw0KICAgICBjYXNlICdUJzoN CiAgICAgICBvdXRfdWludF94IChwZm9ybWF0LCBwcmVmaXhfbGVuLCBtaW5vciAoc3RhdGJ1Zi0+ c3RfcmRldikpOw0KICAgICAgIGJyZWFrOw0KQEAgLTk0Miw2ICsxMDI4LDcgQEAgZG9fc3RhdCAo Y2hhciBjb25zdCAqZmlsZW5hbWUsIGJvb2wgdGVyc2UsIGNoYXIgY29uc3QgKmZvcm1hdCkNCiAg ICAgICAgICAgICB7DQogICAgICAgICAgICAgICBmb3JtYXQgPQ0KICAgICAgICAgICAgICAgICAi ICBGaWxlOiAlTlxuIg0KKyAgICAgICAgICAgICAgICAiICBNb3VudHBvaW50OiAlbVxuIg0KICAg ICAgICAgICAgICAgICAiICBTaXplOiAlLTEwc1x0QmxvY2tzOiAlLTEwYiBJTyBCbG9jazogJS02 byAlRlxuIg0KICAgICAgICAgICAgICAgICAiRGV2aWNlOiAlRGgvJWRkXHRJbm9kZTogJS0xMGkg IExpbmtzOiAlLTVoIg0KICAgICAgICAgICAgICAgICAiIERldmljZSB0eXBlOiAldCwlVFxuIg0K QEAgLTk1Miw2ICsxMDM5LDcgQEAgZG9fc3RhdCAoY2hhciBjb25zdCAqZmlsZW5hbWUsIGJvb2wg dGVyc2UsIGNoYXIgY29uc3QgKmZvcm1hdCkNCiAgICAgICAgICAgICB7DQogICAgICAgICAgICAg ICBmb3JtYXQgPQ0KICAgICAgICAgICAgICAgICAiICBGaWxlOiAlTlxuIg0KKyAgICAgICAgICAg ICAgICAiICBNb3VudHBvaW50OiAlbVxuIg0KICAgICAgICAgICAgICAgICAiICBTaXplOiAlLTEw c1x0QmxvY2tzOiAlLTEwYiBJTyBCbG9jazogJS02byAlRlxuIg0KICAgICAgICAgICAgICAgICAi RGV2aWNlOiAlRGgvJWRkXHRJbm9kZTogJS0xMGkgIExpbmtzOiAlaFxuIg0KICAgICAgICAgICAg ICAgICAiQWNjZXNzOiAoJTA0YS8lMTAuMTBBKSAgVWlkOiAoJTV1LyU4VSkgICBHaWQ6ICglNWcv JThHKVxuIg0KQEAgLTEwMDksNiArMTA5Nyw3IEBAIFRoZSB2YWxpZCBmb3JtYXQgc2VxdWVuY2Vz IGZvciBmaWxlcyAod2l0aG91dCAtLWZpbGUtc3lzdGVtKTpcblwNCiAgICAgICBmcHV0cyAoXygi XA0KICAgJWggICBOdW1iZXIgb2YgaGFyZCBsaW5rc1xuXA0KICAgJWkgICBJbm9kZSBudW1iZXJc blwNCisgICVtICAgTW91bnQgcG9pbnRcblwNCiAgICVuICAgRmlsZSBuYW1lXG5cDQogICAlTiAg IFF1b3RlZCBmaWxlIG5hbWUgd2l0aCBkZXJlZmVyZW5jZSBpZiBzeW1ib2xpYyBsaW5rXG5cDQog ICAlbyAgIEkvTyBibG9jayBzaXplXG5cDQotLSANCjEuNy4xDQoNCg== --e0cb4e8877d735471f048a6db9a9-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 05 08:04:26 2010 Received: (at 6555) by debbugs.gnu.org; 5 Jul 2010 12:04:26 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVkPS-0002JW-0T for submit@debbugs.gnu.org; Mon, 05 Jul 2010 08:04:26 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OVkPP-0002JP-3Q for 6555@debbugs.gnu.org; Mon, 05 Jul 2010 08:04:23 -0400 Received: (qmail 8247 invoked from network); 5 Jul 2010 12:04:17 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 5 Jul 2010 12:04:17 -0000 Message-ID: <4C31CA1F.9070002@draigBrady.com> Date: Mon, 05 Jul 2010 13:03:43 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: A Burgie Subject: Re: bug#6555: stat enhancement References: In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 6555 Cc: meyering@redhat.com, 6555@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.8 (--) On 02/07/10 21:49, A Burgie wrote: > To Whom it May Concern: > > I have made a small change to the stat command adding in the ability > to print the mountpoint of the specified file/directory. This is > something I have heard several others (besides myself) trying to do > via various methods involving the df command or some recursive > directory traversals but which would make sense in the stat command. > Michael Meskes suggested CC-ing meyering@redhat.com as well which I am > doing. > > Reading through the submission process for the package I am not sure > if the actual e-mail body should be the output of the 'git > format-patch --stdout -1' command or not so I am attaching it. If > preferred I will send it inline next time and in the future. The idea seems sensible. Using df on a file _is_ a little unintuitive, and also parsing the output from df is awkward. You copied (while re-indenting with non GNU options) the find_mount_point() function from df.c to stat.c We'll have to refactor that out for both to use (if indeed it's the best method to use which I've not looked into at this stage). cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 05 08:48:57 2010 Received: (at 6555) by debbugs.gnu.org; 5 Jul 2010 12:48:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVl6X-0002dj-IL for submit@debbugs.gnu.org; Mon, 05 Jul 2010 08:48:57 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVl6V-0002dZ-0L for 6555@debbugs.gnu.org; Mon, 05 Jul 2010 08:48:56 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id C3ECE940143 for <6555@debbugs.gnu.org>; Mon, 5 Jul 2010 14:48:44 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 986ECE27C; Mon, 5 Jul 2010 14:48:43 +0200 (CEST) From: Jim Meyering To: A Burgie Subject: Re: bug#6555: stat enhancement In-Reply-To: <4C31CA1F.9070002@draigBrady.com> (=?utf-8?Q?=22P=C3=A1draig?= Brady"'s message of "Mon, 05 Jul 2010 13:03:43 +0100") References: <4C31CA1F.9070002@draigBrady.com> Date: Mon, 05 Jul 2010 14:48:43 +0200 Message-ID: <87hbke14d0.fsf@meyering.net> Lines: 43 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) P=C3=A1draig Brady wrote: > On 02/07/10 21:49, A Burgie wrote: >> To Whom it May Concern: >> >> I have made a small change to the stat command adding in the ability >> to print the mountpoint of the specified file/directory. This is >> something I have heard several others (besides myself) trying to do >> via various methods involving the df command or some recursive >> directory traversals but which would make sense in the stat command. >> Michael Meskes suggested CC-ing meyering@redhat.com as well which I am >> doing. >> >> Reading through the submission process for the package I am not sure >> if the actual e-mail body should be the output of the 'git >> format-patch --stdout -1' command or not so I am attaching it. If >> preferred I will send it inline next time and in the future. Inline is slightly preferred. No big deal. > The idea seems sensible. I think so, too. However, the patch that adds the option would do well to add a test that exercises it and to mention it in the NEWS file. Your change will qualify as "significant". Can you file a copyright assignment? Here are guidelines: http://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKING#n327 > Using df on a file _is_ a little unintuitive, > and also parsing the output from df is awkward. > > You copied (while re-indenting with non GNU options) > the find_mount_point() function from df.c to stat.c > We'll have to refactor that out for both to use > (if indeed it's the best method to use which I've not > looked into at this stage). Yes, it has to be factored out. I haven't looked either, yet ;-) Thanks for contributing! From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 05 09:33:31 2010 Received: (at 6555) by debbugs.gnu.org; 5 Jul 2010 13:33:31 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVlnf-0002xV-7A for submit@debbugs.gnu.org; Mon, 05 Jul 2010 09:33:31 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVlnc-0002xP-Lg for 6555@debbugs.gnu.org; Mon, 05 Jul 2010 09:33:29 -0400 Received: by vws14 with SMTP id 14so4187648vws.3 for <6555@debbugs.gnu.org>; Mon, 05 Jul 2010 06:33:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=HJyzkQ7PDxWtZIu0RFL9vowvkPCaWzz1AHTLwBLNuXI=; b=pMWYaJa0ivjv3Sbir/1tvRwErPszlvUI76nkfoc4reFt6EkrubzSOvon2bJXKsQ0GU 6FQdI9VzlO0d85ZXejK9JpEWEKvDKzvD4pljzdUkY1CQSweYZjqqZZ8ha31JlHBTJShM Ix9X5D1dw31YiRjhtIjdYX8fORmU6gKMB1lj0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=rV1323DSkbULcdSXqpj4GySKKQby6i8d11QaQ1i8DefqlbeWdwFQU/U9/PejjsCbL0 MySchLQG0zfRjxWXinfdxmY6+gVWgNcn/IOouDEfpSUwkWq1WbI2JvJSSENPkgQcU+iv hDt8wlao91PwUQQ1Z/la03gDAbxFlaxKxIFUQ= Received: by 10.220.123.33 with SMTP id n33mr1444285vcr.204.1278336803231; Mon, 05 Jul 2010 06:33:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.195.77 with HTTP; Mon, 5 Jul 2010 06:33:03 -0700 (PDT) In-Reply-To: <87hbke14d0.fsf@meyering.net> References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> From: A Burgie Date: Mon, 5 Jul 2010 07:33:03 -0600 Message-ID: Subject: Re: bug#6555: stat enhancement To: Jim Meyering Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.7 (---) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) On Mon, Jul 5, 2010 at 06:48, Jim Meyering wrote: >> The idea seems sensible. > > I think so, too. > However, the patch that adds the option would do well to add > a test that exercises it and to mention it in the NEWS file. > Your change will qualify as "significant". > Can you file a copyright assignment? =C2=A0Here are guidelines: > > =C2=A0 =C2=A0http://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKING#= n327 I was wondering if that would apply, but I did not think it would as it was not really my own code (I copied from previously-GPL'd code and only, perhaps, added three or four lines of my own). Please confirm if I am mistaken on this. >> Using df on a file _is_ a little unintuitive, >> and also parsing the output from df is awkward. >> >> You copied (while re-indenting with non GNU options) >> the find_mount_point() function from df.c to stat.c >> We'll have to refactor that out for both to use >> (if indeed it's the best method to use which I've not >> looked into at this stage). > > Yes, it has to be factored out. > I haven't looked either, yet ;-) I should have noticed the spacing issue. I'll send a new DIFF file here shortly with the fix and also with the NEWS stuff if I can figure that out. Test cases I know almost nothing about, but I'll check there too and hopefully have a worthwhile addition. Thank-you for the feedback, AB From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 05 09:50:28 2010 Received: (at 6555) by debbugs.gnu.org; 5 Jul 2010 13:50:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVm43-000342-IE for submit@debbugs.gnu.org; Mon, 05 Jul 2010 09:50:27 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVm40-00033w-L1 for 6555@debbugs.gnu.org; Mon, 05 Jul 2010 09:50:26 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id B0B059400B3 for <6555@debbugs.gnu.org>; Mon, 5 Jul 2010 15:50:14 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 811D7C4B; Mon, 5 Jul 2010 15:50:13 +0200 (CEST) From: Jim Meyering To: A Burgie Subject: Re: bug#6555: stat enhancement In-Reply-To: (A. Burgie's message of "Mon, 5 Jul 2010 07:33:03 -0600") References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> Date: Mon, 05 Jul 2010 15:50:13 +0200 Message-ID: <87y6dqyr56.fsf@meyering.net> Lines: 40 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) A Burgie wrote: > On Mon, Jul 5, 2010 at 06:48, Jim Meyering wrote: >>> The idea seems sensible. >> >> I think so, too. >> However, the patch that adds the option would do well to add >> a test that exercises it and to mention it in the NEWS file. >> Your change will qualify as "significant". >> Can you file a copyright assignment? =C2=A0Here are guidelines: >> >> =C2=A0 =C2=A0http://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKING= #n327 > > I was wondering if that would apply, but I did not think it would as > it was not really my own code (I copied from previously-GPL'd code and > only, perhaps, added three or four lines of my own). Please confirm > if I am mistaken on this. I figured that between moving that function into a file on its own, declaring the function in its own header file, adjusting df.c and stat.c to include the new .h file, adjusting src/Makefile.am to list the new file, adding a test and adding to NEWS you would end up adding more than 10 or 15 lines. Oh. And documentation. You'll want to add a line or two to the section on stat in doc/coreutils.texi. If it's too much work on the portability front (wouldn't surprise me), it may be ok simply to put the statically-declared function body in a new .c file and include the .c file from each of stat.c and df.c. BTW, please adjust this part of your patch not to dereference NULL when find_mount_point fails: + case 'm': + out_string (pformat, prefix_len, find_mount_point (filename, statb= uf)); Also, I'm a little reluctant to change the default format to add an entire new line just for "Mountpoint: %s\n". There is value in not changing the number of lines in the default output: compatibility. From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 05 10:01:28 2010 Received: (at 6555) by debbugs.gnu.org; 5 Jul 2010 14:01:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVmEi-00038y-0A for submit@debbugs.gnu.org; Mon, 05 Jul 2010 10:01:28 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVmEg-00038q-Eg for 6555@debbugs.gnu.org; Mon, 05 Jul 2010 10:01:27 -0400 Received: by vws14 with SMTP id 14so4216137vws.3 for <6555@debbugs.gnu.org>; Mon, 05 Jul 2010 07:01:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=xxxYSloyzdJVQ2P9A8Eo5o3tfp/VQRjFsXIpWreuJZg=; b=UNRC5G8mj7qSUy1YggQrQnT8aSIBPutyExsPv7/FXyccwd9UAWEmhTiu6cjXeCzTnl V1exjL37uy2an9Nif9f5mwU1Vrp7JHJmzILg1cIoO7QA4jMfkV9/40Y7aGochIFeb0X1 GKL9dKEDbIYHsVS/iNfqkLnXoZX2hAeFBHecE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=BzOgXZBEfqWr4PnesEhme8mZE3mgE/yJAzblN83JUY0C34drtjXpoc9dVpIuE4aWHI ukDnur6gUqFnpcBIPXfA/519y/uXGtzdsoWcQE4oSy6aoDUqdd7amc5MczoWDfTw886X azaNUZfy9yO3x9JJ2FQh+Z5dIuY3p5jom5m6k= Received: by 10.220.159.14 with SMTP id h14mr1578403vcx.115.1278338481119; Mon, 05 Jul 2010 07:01:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.195.77 with HTTP; Mon, 5 Jul 2010 07:01:00 -0700 (PDT) In-Reply-To: <87y6dqyr56.fsf@meyering.net> References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> From: A Burgie Date: Mon, 5 Jul 2010 08:01:00 -0600 Message-ID: Subject: Re: bug#6555: stat enhancement To: Jim Meyering Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) On Mon, Jul 5, 2010 at 07:50, Jim Meyering wrote: > A Burgie wrote: >> On Mon, Jul 5, 2010 at 06:48, Jim Meyering wrote: >>>> The idea seems sensible. >>> >>> I think so, too. >>> However, the patch that adds the option would do well to add >>> a test that exercises it and to mention it in the NEWS file. >>> Your change will qualify as "significant". >>> Can you file a copyright assignment? =C2=A0Here are guidelines: >>> >>> =C2=A0 =C2=A0http://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKIN= G#n327 >> >> I was wondering if that would apply, but I did not think it would as >> it was not really my own code (I copied from previously-GPL'd code and >> only, perhaps, added three or four lines of my own). =C2=A0Please confir= m >> if I am mistaken on this. > > I figured that between moving that function into a file on its > own, declaring the function in its own header file, > adjusting df.c and stat.c to include the new .h file, > adjusting src/Makefile.am to list the new file, adding a test and > adding to NEWS you would end up adding more than 10 or 15 lines. Ah.... I see. Very well; I'll get to work on the legal side of things. > Oh. =C2=A0And documentation. =C2=A0You'll want to add a line or two to > the section on stat in doc/coreutils.texi. Consider it done. > If it's too much work on the portability front (wouldn't surprise me), > it may be ok simply to put the statically-declared function body > in a new .c file and include the .c file from each of stat.c and df.c. I'll work to do it the right way and let you know if I fail there. > BTW, please adjust this part of your patch not to dereference NULL > when find_mount_point fails: > > =C2=A0+ =C2=A0 =C2=A0case 'm': > =C2=A0+ =C2=A0 =C2=A0 =C2=A0out_string (pformat, prefix_len, find_mount_p= oint (filename, statbuf)); Any pointers (pun intended) on the best way to do that? I'll check the df.c file to see what it does but if it's not there and you have a better option that'd be appreciated. I'm not sure it's been pointed out yet, but I'm not a C expert yet. > Also, I'm a little reluctant to change the default format to > add an entire new line just for "Mountpoint: %s\n". > There is value in not changing the number of lines in the default output: > compatibility. Agreed. My reasoning in doing so was perhaps a bit shortsighted. Most of the stat output seems to fit nicely within eighty columns and I did not want to disturb that too much. Some lines could easily go outside this (File, Permissions with user/group names, etc.) but File was on the first line and I was concerned about current users who may be running stat and then piping output through 'head' or 'tail' to get just a portion of it. I could easily enough add Mountpoint after the filename or anywhere else you feel is better, or it could be removed from the default output entirely which was what I did originally before submitting the patch. Thank-you for your patience, AB From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 05 11:26:59 2010 Received: (at 6555) by debbugs.gnu.org; 5 Jul 2010 15:27:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVnZT-0003iQ-AV for submit@debbugs.gnu.org; Mon, 05 Jul 2010 11:26:59 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVnZO-0003iK-Mh for 6555@debbugs.gnu.org; Mon, 05 Jul 2010 11:26:57 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id 5EBA594017D for <6555@debbugs.gnu.org>; Mon, 5 Jul 2010 17:26:44 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 20D20E27C; Mon, 5 Jul 2010 17:26:43 +0200 (CEST) From: Jim Meyering To: A Burgie Subject: Re: bug#6555: stat enhancement In-Reply-To: (A. Burgie's message of "Mon, 5 Jul 2010 08:01:00 -0600") References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> Date: Mon, 05 Jul 2010 17:26:43 +0200 Message-ID: <87sk3yymoc.fsf@meyering.net> Lines: 348 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) A Burgie wrote: > On Mon, Jul 5, 2010 at 07:50, Jim Meyering wrote: >> A Burgie wrote: >>> On Mon, Jul 5, 2010 at 06:48, Jim Meyering wrote: >>>>> The idea seems sensible. >>>> >>>> I think so, too. >>>> However, the patch that adds the option would do well to add >>>> a test that exercises it and to mention it in the NEWS file. >>>> Your change will qualify as "significant". >>>> Can you file a copyright assignment? =C2=A0Here are guidelines: >>>> >>>> =C2=A0 =C2=A0http://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKI= NG#n327 >>> >>> I was wondering if that would apply, but I did not think it would as >>> it was not really my own code (I copied from previously-GPL'd code and >>> only, perhaps, added three or four lines of my own). =C2=A0Please confi= rm >>> if I am mistaken on this. >> >> I figured that between moving that function into a file on its >> own, declaring the function in its own header file, >> adjusting df.c and stat.c to include the new .h file, >> adjusting src/Makefile.am to list the new file, adding a test and >> adding to NEWS you would end up adding more than 10 or 15 lines. > > Ah.... I see. Very well; I'll get to work on the legal side of things. > >> Oh. =C2=A0And documentation. =C2=A0You'll want to add a line or two to >> the section on stat in doc/coreutils.texi. > > Consider it done. > >> If it's too much work on the portability front (wouldn't surprise me), >> it may be ok simply to put the statically-declared function body >> in a new .c file and include the .c file from each of stat.c and df.c. > > I'll work to do it the right way and let you know if I fail there. > >> BTW, please adjust this part of your patch not to dereference NULL >> when find_mount_point fails: >> >> =C2=A0+ =C2=A0 =C2=A0case 'm': >> =C2=A0+ =C2=A0 =C2=A0 =C2=A0out_string (pformat, prefix_len, find_mount_= point (filename, statbuf)); > > Any pointers (pun intended) on the best way to do that? I'll check > the df.c file to see what it does but if it's not there and you have a > better option that'd be appreciated. I'm not sure it's been pointed > out yet, but I'm not a C expert yet. Hmm... Handling failure is actually looking complicated. If someone used the %m format and find_mount_point fails, then stat should exit nonzero, but the use of the new find_mount_point would be down in print_stat, which is a void function, and which is passed as a callback to print_it, which is also a void function. Doing this cleanly would mean modifying signatures of at least print_it, print_stat and print_statfs to return a success/fail indicator to do_statfs. So I've just adjusted those interfaces and added some comments. Patch below. That should make it easier for you. Note the out_file_context function. It currently prints "?" (and a diagnostic to stderr) when it fails to determine a context string. Such a failure did not make stat itself exit nonzero, but with this patch, now it does. Your change should be sure to do the same. >> Also, I'm a little reluctant to change the default format to >> add an entire new line just for "Mountpoint: %s\n". >> There is value in not changing the number of lines in the default output: >> compatibility. > > Agreed. My reasoning in doing so was perhaps a bit shortsighted. > Most of the stat output seems to fit nicely within eighty columns and > I did not want to disturb that too much. Some lines could easily go > outside this (File, Permissions with user/group names, etc.) but File > was on the first line and I was concerned about current users who may > be running stat and then piping output through 'head' or 'tail' to get > just a portion of it. I could easily enough add Mountpoint after the > filename or anywhere else you feel is better, or it could be removed > from the default output entirely which was what I did originally > before submitting the patch. Unless someone clamors for the added information, let's just omit it from the default format strings. I'll push these two change-sets shortly. >From d6d47eedb938743a56431988e73a5a3205687ba9 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 5 Jul 2010 17:16:23 +0200 Subject: [PATCH 1/2] system.h: define ATTRIBUTE_WARN_UNUSED_RESULT * src/system.h (ATTRIBUTE_WARN_UNUSED_RESULT): Define. --- src/system.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/system.h b/src/system.h index 859b663..d3fd901 100644 --- a/src/system.h +++ b/src/system.h @@ -483,6 +483,14 @@ enum # define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #endif +/* The warn_unused_result attribute appeared first in gcc-3.4.0 */ +#undef ATTRIBUTE_WARN_UNUSED_RESULT +#if __GNUC__ < 3 || (__GNUC__ =3D=3D 3 && __GNUC_MINOR__ < 4) +# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result= __)) +#else +# define ATTRIBUTE_WARN_UNUSED_RESULT /* empty */ +#endif + #if defined strdupa # define ASSIGN_STRDUPA(DEST, S) \ do { DEST =3D strdupa (S); } while (0) -- 1.7.2.rc1.192.g262ff >From e78f266f2ec5489824a28ef710c82bd6ca5ccf01 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 5 Jul 2010 17:18:29 +0200 Subject: [PATCH 2/2] stat: getfilecon failure now evokes nonzero exit status Add comments and adjust interfaces to allow low-level failure to propagate out to callers. * src/stat.c (out_file_context): Return bool, not void, so we can tell callers about failure. (print_statfs, print_stat, print_it): Propagate failure to caller. (do_statfs): Propagate print_it failure to caller. (do_stat): Likewise. I nearly forgot to update do_stat to propagate print_it failure, and it compiled just fine in spite of that. To prevent possibility of a repeat, I've marked each function that returns non-void with ATTRIBUTE_WARN_UNUSED_RESULT. --- src/stat.c | 60 ++++++++++++++++++++++++++++++++++++++------------------= ---- 1 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/stat.c b/src/stat.c index f1b5ef1..c3730f0 100644 --- a/src/stat.c +++ b/src/stat.c @@ -88,7 +88,7 @@ /* BeOS has a statvfs function, but it does not return sensible values for f_files, f_ffree and f_favail, and lacks f_type, f_basetype and f_fstypename. Use 'struct fs_info' instead. */ -static int +static int ATTRIBUTE_WARN_UNUSED_RESULT statfs (char const *filename, struct fs_info *buf) { dev_t device =3D dev_for_path (filename); @@ -185,7 +185,7 @@ static char const *trailing_delim =3D ""; Others have statfs.f_fstypename[MFSNAMELEN] (NetBSD 1.5.2). Still others have neither and have to get by with f_type (GNU/Linux). But f_type may only exist in statfs (Cygwin). */ -static char const * +static char const * ATTRIBUTE_WARN_UNUSED_RESULT human_fstype (STRUCT_STATVFS const *statfsbuf) { #ifdef STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME @@ -436,7 +436,7 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) #endif } -static char * +static char * ATTRIBUTE_WARN_UNUSED_RESULT human_access (struct stat const *statbuf) { static char modebuf[12]; @@ -445,7 +445,7 @@ human_access (struct stat const *statbuf) return modebuf; } -static char * +static char * ATTRIBUTE_WARN_UNUSED_RESULT human_time (struct timespec t) { static char str[MAX (INT_BUFSIZE_BOUND (intmax_t), @@ -491,11 +491,14 @@ out_uint_x (char *pformat, size_t prefix_len, uintmax= _t arg) } /* Very specialized function (modifies FORMAT), just so as to avoid - duplicating this code between both print_statfs and print_stat. */ -static void + duplicating this code between both print_statfs and print_stat. + Return zero upon success, nonzero upon failure. */ +static bool ATTRIBUTE_WARN_UNUSED_RESULT out_file_context (char const *filename, char *pformat, size_t prefix_len) { char *scontext; + bool fail =3D false; + if ((follow_links ? getfilecon (filename, &scontext) : lgetfilecon (filename, &scontext)) < 0) @@ -503,19 +506,22 @@ out_file_context (char const *filename, char *pformat= , size_t prefix_len) error (0, errno, _("failed to get security context of %s"), quote (filename)); scontext =3D NULL; + fail =3D true; } strcpy (pformat + prefix_len, "s"); printf (pformat, (scontext ? scontext : "?")); if (scontext) freecon (scontext); + return fail; } -/* print statfs info */ -static void +/* Print statfs info. Return zero upon success, nonzero upon failure. */ +static bool ATTRIBUTE_WARN_UNUSED_RESULT print_statfs (char *pformat, size_t prefix_len, char m, char const *filena= me, void const *data) { STRUCT_STATVFS const *statfsbuf =3D data; + bool fail =3D false; switch (m) { @@ -589,22 +595,24 @@ print_statfs (char *pformat, size_t prefix_len, char = m, char const *filename, out_int (pformat, prefix_len, statfsbuf->f_ffree); break; case 'C': - out_file_context (filename, pformat, prefix_len); + fail |=3D out_file_context (filename, pformat, prefix_len); break; default: fputc ('?', stdout); break; } + return fail; } -/* print stat info */ -static void +/* Print stat info. Return zero upon success, nonzero upon failure. */ +static bool print_stat (char *pformat, size_t prefix_len, char m, char const *filename, void const *data) { struct stat *statbuf =3D (struct stat *) data; struct passwd *pw_ent; struct group *gw_ent; + bool fail =3D false; switch (m) { @@ -620,7 +628,7 @@ print_stat (char *pformat, size_t prefix_len, char m, { error (0, errno, _("cannot read symbolic link %s"), quote (filename)); - return; + return true; } printf (" -> "); out_string (pformat, prefix_len, quote (linkname)); @@ -714,12 +722,13 @@ print_stat (char *pformat, size_t prefix_len, char m, out_uint (pformat, prefix_len, statbuf->st_ctime); break; case 'C': - out_file_context (filename, pformat, prefix_len); + fail |=3D out_file_context (filename, pformat, prefix_len); break; default: fputc ('?', stdout); break; } + return fail; } /* Output a single-character \ escape. */ @@ -763,11 +772,16 @@ print_esc_char (char c) putchar (c); } -static void +/* Print the information specified by the format string, FORMAT, + calling PRINT_FUNC for each %-directive encountered. + Return zero upon success, nonzero upon failure. */ +static bool ATTRIBUTE_WARN_UNUSED_RESULT print_it (char const *format, char const *filename, - void (*print_func) (char *, size_t, char, char const *, void con= st *), + bool (*print_func) (char *, size_t, char, char const *, void con= st *), void const *data) { + bool fail =3D false; + /* Add 2 to accommodate our conversion of the stat `%s' format string to the longer printf `%llu' one. */ enum @@ -807,7 +821,7 @@ print_it (char const *format, char const *filename, putchar ('%'); break; default: - print_func (dest, len + 1, *fmt_char, filename, data); + fail |=3D print_func (dest, len + 1, *fmt_char, filename, = data); break; } break; @@ -866,10 +880,12 @@ print_it (char const *format, char const *filename, free (dest); fputs (trailing_delim, stdout); + + return fail; } /* Stat the file system and print what we find. */ -static bool +static bool ATTRIBUTE_WARN_UNUSED_RESULT do_statfs (char const *filename, bool terse, char const *format) { STRUCT_STATVFS statfsbuf; @@ -899,12 +915,12 @@ do_statfs (char const *filename, bool terse, char con= st *format) "Inodes: Total: %-10c Free: %d\n"); } - print_it (format, filename, print_statfs, &statfsbuf); - return true; + bool fail =3D print_it (format, filename, print_statfs, &statfsbuf); + return ! fail; } /* stat the file and print what we find */ -static bool +static bool ATTRIBUTE_WARN_UNUSED_RESULT do_stat (char const *filename, bool terse, char const *format) { struct stat statbuf; @@ -959,8 +975,8 @@ do_stat (char const *filename, bool terse, char const *= format) } } } - print_it (format, filename, print_stat, &statbuf); - return true; + bool fail =3D print_it (format, filename, print_stat, &statbuf); + return ! fail; } void -- 1.7.2.rc1.192.g262ff From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 05 11:41:58 2010 Received: (at 6555) by debbugs.gnu.org; 5 Jul 2010 15:41:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVnnx-0003on-TK for submit@debbugs.gnu.org; Mon, 05 Jul 2010 11:41:58 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVnnu-0003oe-IC for 6555@debbugs.gnu.org; Mon, 05 Jul 2010 11:41:56 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id B58FE94009F for <6555@debbugs.gnu.org>; Mon, 5 Jul 2010 17:41:44 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 7BDE3E302; Mon, 5 Jul 2010 17:41:43 +0200 (CEST) From: Jim Meyering To: A Burgie Subject: Re: bug#6555: stat enhancement In-Reply-To: <87sk3yymoc.fsf@meyering.net> (Jim Meyering's message of "Mon, 05 Jul 2010 17:26:43 +0200") References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> Date: Mon, 05 Jul 2010 17:41:43 +0200 Message-ID: <87mxu6ylzc.fsf@meyering.net> Lines: 43 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) Jim Meyering wrote: > I'll push these two change-sets shortly. > > Subject: [PATCH 1/2] system.h: define ATTRIBUTE_WARN_UNUSED_RESULT ... > +/* The warn_unused_result attribute appeared first in gcc-3.4.0 */ > +#undef ATTRIBUTE_WARN_UNUSED_RESULT > +#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) > +# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) > +#else > +# define ATTRIBUTE_WARN_UNUSED_RESULT /* empty */ > +#endif Just noticed I reversed the if/else branches above. This works a lot better: commit 61aae73f5427c987b20604fbec5772e02edc0f74 Author: Jim Meyering Date: Mon Jul 5 17:16:23 2010 +0200 system.h: define ATTRIBUTE_WARN_UNUSED_RESULT * src/system.h (ATTRIBUTE_WARN_UNUSED_RESULT): Define. diff --git a/src/system.h b/src/system.h index 859b663..9e14681 100644 --- a/src/system.h +++ b/src/system.h @@ -483,6 +483,14 @@ enum # define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #endif +/* The warn_unused_result attribute appeared first in gcc-3.4.0 */ +#undef ATTRIBUTE_WARN_UNUSED_RESULT +#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) +# define ATTRIBUTE_WARN_UNUSED_RESULT /* empty */ +#else +# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) +#endif + #if defined strdupa # define ASSIGN_STRDUPA(DEST, S) \ do { DEST = strdupa (S); } while (0) From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 05 11:52:36 2010 Received: (at 6555) by debbugs.gnu.org; 5 Jul 2010 15:52:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVnyF-0003ty-K8 for submit@debbugs.gnu.org; Mon, 05 Jul 2010 11:52:36 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVnyD-0003tt-Qm for 6555@debbugs.gnu.org; Mon, 05 Jul 2010 11:52:34 -0400 Received: by vws14 with SMTP id 14so4326766vws.3 for <6555@debbugs.gnu.org>; Mon, 05 Jul 2010 08:52:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=7PtQ0h4KhRVudMRQXmq7LoYK0FYFUZvtwM4+VQbxHQE=; b=Em5RWwK/Ecf6WQw1RBfZcthRzF/uZFiaMTkRaz784uRD7M3YTy/wcOu9Z7jLhutovB eWpAyxzLjXnzPqEu1s5TC/XoaIq8ztgMwPOjbU7olkpqI2/QEYBmwgzmju0pQ12gcu0J Nt55Gr08F5Qmpa7EMsvJSgL1DilbJFN/AZG7I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=GQkVMz3krB491NJZ93ahVekwkr/4WBd9yNZnESaSFPyCnuqDF+sGq3cZYIZuAxe0gx hAnd7vbBvd7TPvt5S/AvrhiSDUwcPX0I42dp8n6HgsVFe2mui3Pz2QS/YK+Bte6VJhJ6 mhsId0aWQvJm2fX6ikyrHItKYEWa7bfdsZ2tM= Received: by 10.220.62.200 with SMTP id y8mr1617138vch.279.1278345148615; Mon, 05 Jul 2010 08:52:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.195.77 with HTTP; Mon, 5 Jul 2010 08:52:08 -0700 (PDT) In-Reply-To: <87mxu6ylzc.fsf@meyering.net> References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> From: A Burgie Date: Mon, 5 Jul 2010 09:52:08 -0600 Message-ID: Subject: Re: bug#6555: stat enhancement To: Jim Meyering Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Mon, Jul 5, 2010 at 09:41, Jim Meyering wrote: > Jim Meyering wrote: >> I'll push these two change-sets shortly. >> >> Subject: [PATCH 1/2] system.h: define ATTRIBUTE_WARN_UNUSED_RESULT > ... >> +/* The warn_unused_result attribute appeared first in gcc-3.4.0 */ >> +#undef ATTRIBUTE_WARN_UNUSED_RESULT >> +#if __GNUC__ < 3 || (__GNUC__ =3D=3D 3 && __GNUC_MINOR__ < 4) >> +# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_res= ult__)) >> +#else >> +# define ATTRIBUTE_WARN_UNUSED_RESULT /* empty */ >> +#endif > > Just noticed I reversed the if/else branches above. > This works a lot better: > > commit 61aae73f5427c987b20604fbec5772e02edc0f74 > Author: Jim Meyering > Date: =C2=A0 Mon Jul 5 17:16:23 2010 +0200 > > =C2=A0 =C2=A0system.h: define ATTRIBUTE_WARN_UNUSED_RESULT > > =C2=A0 =C2=A0* src/system.h (ATTRIBUTE_WARN_UNUSED_RESULT): Define. > > diff --git a/src/system.h b/src/system.h > index 859b663..9e14681 100644 > --- a/src/system.h > +++ b/src/system.h > @@ -483,6 +483,14 @@ enum > =C2=A0# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) > =C2=A0#endif > > +/* The warn_unused_result attribute appeared first in gcc-3.4.0 */ > +#undef ATTRIBUTE_WARN_UNUSED_RESULT > +#if __GNUC__ < 3 || (__GNUC__ =3D=3D 3 && __GNUC_MINOR__ < 4) > +# define ATTRIBUTE_WARN_UNUSED_RESULT /* empty */ > +#else > +# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_resu= lt__)) > +#endif > + > =C2=A0#if defined strdupa > =C2=A0# define ASSIGN_STRDUPA(DEST, S) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 \ > =C2=A0 do { DEST =3D strdupa (S); } while (0) > Just to make sure I understand why something else was invalid, I wrapped the print statement with an if that basically had the same logic as df.c (mp=3Dfind_mount_point....; if(mp){print....}) That, to me, seemed valid, though it would not print anything at all if find_mount_point returned a null. I suppose it would be preferred for the question-mark result which is perhaps what your version is doing. Anyway, just thought I'd throw that out there. Sent in the e-mail for the legal side of things; waiting to hear back from = them. From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 05 11:54:25 2010 Received: (at 6555) by debbugs.gnu.org; 5 Jul 2010 15:54:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVo01-0003ut-Cr for submit@debbugs.gnu.org; Mon, 05 Jul 2010 11:54:25 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVnzz-0003um-Oa for 6555@debbugs.gnu.org; Mon, 05 Jul 2010 11:54:24 -0400 Received: by vws14 with SMTP id 14so4328533vws.3 for <6555@debbugs.gnu.org>; Mon, 05 Jul 2010 08:54:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=1UxlKZ3/G4MrnPOG394bZPMdQ+CuRcbdVQY6sLCnMfo=; b=wu0mzYasHfu/igvRq2S99qKBXoGc2FnRrgeyqx4MtMknprb2r1MZ92fmfU9IQiPw21 7iovvZeBlS0HLBLw5/VZJaHY5M401KDL23SFXkN53NC/Q518xKdvEpKIcznV6nVXDT6Z eDt51PmCMCEVIPx23QXpWz0V8x0VnrpxXxWHY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=K3Dc4/E5yPb23hzSW9iy4CuX1rZLgPI8MebV3lmUITVMyWmW0a/75rLpS4WNY5Tt4F 6DUbOhOvixBXsCchZTLsRPaU3KkJ0nOoSN1XH2mtOqzUyZkZ3Qvc1f7TocFvSSltPkAb GUT6ycChfUFdJKbsQn8IRv9oS3P/qenW/bY/I= Received: by 10.220.98.193 with SMTP id r1mr1645692vcn.89.1278345258091; Mon, 05 Jul 2010 08:54:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.195.77 with HTTP; Mon, 5 Jul 2010 08:53:49 -0700 (PDT) In-Reply-To: References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> From: A Burgie Date: Mon, 5 Jul 2010 09:53:49 -0600 Message-ID: Subject: Re: bug#6555: stat enhancement To: Jim Meyering Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.8 (--) Nevermind.... I understand your reasoning now to allow the failure to propagate out. On Mon, Jul 5, 2010 at 09:52, A Burgie wrote: > On Mon, Jul 5, 2010 at 09:41, Jim Meyering wrote: >> Jim Meyering wrote: >>> I'll push these two change-sets shortly. >>> >>> Subject: [PATCH 1/2] system.h: define ATTRIBUTE_WARN_UNUSED_RESULT >> ... >>> +/* The warn_unused_result attribute appeared first in gcc-3.4.0 */ >>> +#undef ATTRIBUTE_WARN_UNUSED_RESULT >>> +#if __GNUC__ < 3 || (__GNUC__ =3D=3D 3 && __GNUC_MINOR__ < 4) >>> +# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_re= sult__)) >>> +#else >>> +# define ATTRIBUTE_WARN_UNUSED_RESULT /* empty */ >>> +#endif >> >> Just noticed I reversed the if/else branches above. >> This works a lot better: >> >> commit 61aae73f5427c987b20604fbec5772e02edc0f74 >> Author: Jim Meyering >> Date: =C2=A0 Mon Jul 5 17:16:23 2010 +0200 >> >> =C2=A0 =C2=A0system.h: define ATTRIBUTE_WARN_UNUSED_RESULT >> >> =C2=A0 =C2=A0* src/system.h (ATTRIBUTE_WARN_UNUSED_RESULT): Define. >> >> diff --git a/src/system.h b/src/system.h >> index 859b663..9e14681 100644 >> --- a/src/system.h >> +++ b/src/system.h >> @@ -483,6 +483,14 @@ enum >> =C2=A0# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) >> =C2=A0#endif >> >> +/* The warn_unused_result attribute appeared first in gcc-3.4.0 */ >> +#undef ATTRIBUTE_WARN_UNUSED_RESULT >> +#if __GNUC__ < 3 || (__GNUC__ =3D=3D 3 && __GNUC_MINOR__ < 4) >> +# define ATTRIBUTE_WARN_UNUSED_RESULT /* empty */ >> +#else >> +# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_res= ult__)) >> +#endif >> + >> =C2=A0#if defined strdupa >> =C2=A0# define ASSIGN_STRDUPA(DEST, S) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 \ >> =C2=A0 do { DEST =3D strdupa (S); } while (0) >> > > Just to make sure I understand why something else was invalid, I > wrapped the print statement with an if that basically had the same > logic as df.c (mp=3Dfind_mount_point....; if(mp){print....}) > > That, to me, seemed valid, though it would not print anything at all > if find_mount_point returned a null. =C2=A0I suppose it would be preferre= d > for the question-mark result which is perhaps what your version is > doing. =C2=A0Anyway, just thought I'd throw that out there. > > Sent in the e-mail for the legal side of things; waiting to hear back fro= m them. > From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 14:18:44 2010 Received: (at 6555) by debbugs.gnu.org; 6 Jul 2010 18:18:44 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWCjD-00023f-Jo for submit@debbugs.gnu.org; Tue, 06 Jul 2010 14:18:44 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWCjA-00023W-Ux for 6555@debbugs.gnu.org; Tue, 06 Jul 2010 14:18:41 -0400 Received: by vws14 with SMTP id 14so5820582vws.3 for <6555@debbugs.gnu.org>; Tue, 06 Jul 2010 11:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=SnOWPi7ZQfDXmMZHTAcpM0XmggcaQQ6QmHUAfpaz5nw=; b=fWruKjboOf2ak7CGkw8jqIScSyt9uX+LAEF6ekCHf8OBNbePlm0N3vfhr6LMM9GRfr xtRA5huv1ozMHRQAo31gdhP/m/4i8Rg/6KoBhYr54a0E+Qmu77ndnjBOS6G4c9iIGcQg D2gFqZCI2JlBCAqEj0jBX9yJwYT062gtRpjJs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=jBQnoPGNn4vs3zfbQRNk11QvYtUl7f04bYEGKM7gDquqtYPToU71Fv3ZO7nE0RDGsD XA/jBKIqCg/dOUrlMqQ678qKaWfQZh3WHeEJTHHEs4ntIdZN/IG2IMGWkYygBdh51odz FftY3fOs6JMQ92rvRQbDXQn62Mn6wlAR8Mv9I= Received: by 10.220.76.200 with SMTP id d8mr2695203vck.121.1278440316133; Tue, 06 Jul 2010 11:18:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.195.77 with HTTP; Tue, 6 Jul 2010 11:18:16 -0700 (PDT) In-Reply-To: References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> From: A Burgie Date: Tue, 6 Jul 2010 12:18:16 -0600 Message-ID: Subject: Re: bug#6555: stat enhancement To: Jim Meyering Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.8 (--) Is there any documentation on doing this the right (meaning, GNU) way? I've separated out find_mount_point() into a separate .c file, created a .h file, put both in ./gnulib/lib and linked-to them from lib, included the .h file in stat.c and df.c, but cannot compile (w/make). I believe I still need to modify a makefile to include the findmountpoint.c file somewhere but have never worked w/make except as an end user (./configure && make && make install). Also I do not know that I am using the correct directories (./gnulib/lib) for my new .c and .h files. My current error makes me think I'm missing something else that's probably obvious: make[4]: Entering directory `/home/aburgemeister/code/coreutils/lib' GEN configmake.h make[4]: Leaving directory `/home/aburgemeister/code/coreutils/lib' make[3]: Leaving directory `/home/aburgemeister/code/coreutils/lib' make[2]: Leaving directory `/home/aburgemeister/code/coreutils/lib' Making all in src make[2]: Entering directory `/home/aburgemeister/code/coreutils/src' GEN fs.h make all-am make[3]: Entering directory `/home/aburgemeister/code/coreutils/src' CC stat.o stat.c: In function 'print_stat': stat.c:686:7: error: a label can only be part of a statement and a declaration is not a statement stat.c: At top level: ../lib/findmountpoint.h:28:1: warning: 'find_mount_point' used but never de= fined make[3]: *** [stat.o] Error 1 make[3]: Leaving directory `/home/aburgemeister/code/coreutils/src' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/aburgemeister/code/coreutils/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/aburgemeister/code/coreutils' make: *** [all] Error 2 Thanks, AB On Mon, Jul 5, 2010 at 09:53, A Burgie wrote: > Nevermind.... I understand your reasoning now to allow the failure to > propagate out. > > On Mon, Jul 5, 2010 at 09:52, A Burgie wrote: >> On Mon, Jul 5, 2010 at 09:41, Jim Meyering wrote: >>> Jim Meyering wrote: >>>> I'll push these two change-sets shortly. >>>> >>>> Subject: [PATCH 1/2] system.h: define ATTRIBUTE_WARN_UNUSED_RESULT >>> ... >>>> +/* The warn_unused_result attribute appeared first in gcc-3.4.0 */ >>>> +#undef ATTRIBUTE_WARN_UNUSED_RESULT >>>> +#if __GNUC__ < 3 || (__GNUC__ =3D=3D 3 && __GNUC_MINOR__ < 4) >>>> +# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_r= esult__)) >>>> +#else >>>> +# define ATTRIBUTE_WARN_UNUSED_RESULT /* empty */ >>>> +#endif >>> >>> Just noticed I reversed the if/else branches above. >>> This works a lot better: >>> >>> commit 61aae73f5427c987b20604fbec5772e02edc0f74 >>> Author: Jim Meyering >>> Date: =C2=A0 Mon Jul 5 17:16:23 2010 +0200 >>> >>> =C2=A0 =C2=A0system.h: define ATTRIBUTE_WARN_UNUSED_RESULT >>> >>> =C2=A0 =C2=A0* src/system.h (ATTRIBUTE_WARN_UNUSED_RESULT): Define. >>> >>> diff --git a/src/system.h b/src/system.h >>> index 859b663..9e14681 100644 >>> --- a/src/system.h >>> +++ b/src/system.h >>> @@ -483,6 +483,14 @@ enum >>> =C2=A0# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) >>> =C2=A0#endif >>> >>> +/* The warn_unused_result attribute appeared first in gcc-3.4.0 */ >>> +#undef ATTRIBUTE_WARN_UNUSED_RESULT >>> +#if __GNUC__ < 3 || (__GNUC__ =3D=3D 3 && __GNUC_MINOR__ < 4) >>> +# define ATTRIBUTE_WARN_UNUSED_RESULT /* empty */ >>> +#else >>> +# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_re= sult__)) >>> +#endif >>> + >>> =C2=A0#if defined strdupa >>> =C2=A0# define ASSIGN_STRDUPA(DEST, S) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 \ >>> =C2=A0 do { DEST =3D strdupa (S); } while (0) >>> >> >> Just to make sure I understand why something else was invalid, I >> wrapped the print statement with an if that basically had the same >> logic as df.c (mp=3Dfind_mount_point....; if(mp){print....}) >> >> That, to me, seemed valid, though it would not print anything at all >> if find_mount_point returned a null. =C2=A0I suppose it would be preferr= ed >> for the question-mark result which is perhaps what your version is >> doing. =C2=A0Anyway, just thought I'd throw that out there. >> >> Sent in the e-mail for the legal side of things; waiting to hear back fr= om them. >> > From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 17:54:28 2010 Received: (at 6555) by debbugs.gnu.org; 6 Jul 2010 21:54:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWG60-0006Tf-0H for submit@debbugs.gnu.org; Tue, 06 Jul 2010 17:54:28 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OWG5x-0006TZ-HL for 6555@debbugs.gnu.org; Tue, 06 Jul 2010 17:54:26 -0400 Received: (qmail 55567 invoked from network); 6 Jul 2010 21:54:20 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 6 Jul 2010 21:54:20 -0000 Message-ID: <4C33A5E4.8010005@draigBrady.com> Date: Tue, 06 Jul 2010 22:53:40 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: A Burgie Subject: Re: bug#6555: stat enhancement References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.8 (--) On 06/07/10 19:18, A Burgie wrote: > Is there any documentation on doing this the right (meaning, GNU) way? > I've separated out find_mount_point() into a separate .c file, > created a .h file, put both in ./gnulib/lib and linked-to them from > lib, included the .h file in stat.c and df.c, but cannot compile > (w/make). I believe I still need to modify a makefile to include the > findmountpoint.c file somewhere but have never worked w/make except as > an end user (./configure && make && make install). Also I do not know > that I am using the correct directories (./gnulib/lib) for my new .c > and .h files. lib/ is for gnulib stuff so best avoided. Have a look at how a function was extracted to a separate file previously. For example, search for "operand2sig" in `git show 265c4b83` > My current error makes me think I'm missing something > else that's probably obvious: > > CC stat.o > stat.c: In function 'print_stat': > stat.c:686:7: error: a label can only be part of a statement and a > declaration is not a statement > stat.c: At top level: is your case 'm': typoed? > ../lib/findmountpoint.h:28:1: warning: 'find_mount_point' used but never defined that'll probably be sorted if you follow what was done for operand2sig cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 18:15:38 2010 Received: (at 6555) by debbugs.gnu.org; 6 Jul 2010 22:15:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWGQU-0006dD-Bu for submit@debbugs.gnu.org; Tue, 06 Jul 2010 18:15:38 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWGQS-0006d7-2Q for 6555@debbugs.gnu.org; Tue, 06 Jul 2010 18:15:37 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id 321339400A8 for <6555@debbugs.gnu.org>; Wed, 7 Jul 2010 00:15:26 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 7D5A5F77; Wed, 7 Jul 2010 00:15:25 +0200 (CEST) From: Jim Meyering To: A Burgie Subject: Re: bug#6555: stat enhancement In-Reply-To: (A. Burgie's message of "Tue, 6 Jul 2010 12:18:16 -0600") References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> Date: Wed, 07 Jul 2010 00:15:25 +0200 Message-ID: <87r5jguuiq.fsf@meyering.net> Lines: 8 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) A Burgie wrote: > Is there any documentation on doing this the right (meaning, GNU) way? > I've separated out find_mount_point() into a separate .c file, > created a .h file, put both in ./gnulib/lib and linked-to them from For now, you can just put them in src/. Simpler that way. If needed, we can move them later. From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 20:05:08 2010 Received: (at 6555) by debbugs.gnu.org; 7 Jul 2010 00:05:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWI8S-0007PN-FI for submit@debbugs.gnu.org; Tue, 06 Jul 2010 20:05:08 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWI8Q-0007P1-72 for 6555@debbugs.gnu.org; Tue, 06 Jul 2010 20:05:06 -0400 Received: by vws14 with SMTP id 14so6161719vws.3 for <6555@debbugs.gnu.org>; Tue, 06 Jul 2010 17:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=MkcyUi2L60lrTdQaqc2xxwtt5/jlb1tn1GvF12QZAP8=; b=SXW3OOQ09iR0UP/4lBvZl/5yz25g0jy38SU4btLlffOr1u9z2IPAfcFCqcvlIaGwpQ TPsrXsmOi2zTlqF46rA7Sy113K77RmgeKb/+gMb0GqEdYFUhHGJGgnFJmhyoDKWbmZ1D s1w/BThZHYHLih3QMsWUamHqlRb9MOs/vfAoI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=azQvobRc53DkymuoWsOSbpC1kAm6fqk/zevRyz96OecXzzEpDXgOYHsyHuImpcb6yo etZQlPjYKV0j6TM0sO5gFRUIgc2UD0rCfLToJ16LRrHvWNdik3J5xH4gNxACGK+gATNm sBxqZXscFX3+I34UpBd2VX2fSvFQ0h2y6CP5g= Received: by 10.220.76.200 with SMTP id d8mr2902278vck.261.1278461102152; Tue, 06 Jul 2010 17:05:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.195.77 with HTTP; Tue, 6 Jul 2010 17:04:42 -0700 (PDT) In-Reply-To: <87r5jguuiq.fsf@meyering.net> References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> From: A Burgie Date: Tue, 6 Jul 2010 18:04:42 -0600 Message-ID: Subject: Re: bug#6555: stat enhancement To: Jim Meyering Content-Type: multipart/mixed; boundary=0016e6476496da5dde048ac0ebf3 X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) --0016e6476496da5dde048ac0ebf3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Well I am closer, but am still technically nowhere since it still will not compile. The problem with the odd declaration error was because I was trying to declare a c-pointer in the case section of the switch statement. I guess that's not allowed in C (back to the easy languages for me). Despite this I am still stuck with the compilation complaining about find_mount_point's lack of existence though I'd bet a nickel I have everything setup properly. Attached are a couple DIFF files for those who may want to try to replay things and laugh at my mediocrity on the condition that an explanation is provided where I'm failing. I'd have just one DIFF file but I can't figure out how to make Git show what I want so I think the combination of these two show it all (first use of Git as well). Sorry to be slow at this. I'd like to learn and have yet to find documentation on GNU's site (or anywhere else) other than the diff for operand2sig which helped me a little but not quite enough for what seems like a very simple operation (extract function, put in file, create .h file, include .h file in previous .c files, modify Makefile.am, compile). Thanks, AB On Tue, Jul 6, 2010 at 16:15, Jim Meyering wrote: > A Burgie wrote: > >> Is there any documentation on doing this the right (meaning, GNU) way? >> =C2=A0I've separated out find_mount_point() into a separate .c file, >> created a .h file, put both in ./gnulib/lib and linked-to them from > > For now, you can just put them in src/. =C2=A0Simpler that way. > If needed, we can move them later. > --0016e6476496da5dde048ac0ebf3 Content-Type: application/octet-stream; name=DIFF0 Content-Disposition: attachment; filename=DIFF0 Content-Transfer-Encoding: base64 X-Attachment-Id: f_gbbehdwo0 ZGlmZiAtLWdpdCBhL05FV1MgYi9ORVdTDQppbmRleCA4MjE5MGQ5Li4yNTZiNTQxIDEwMDY0NA0K LS0tIGEvTkVXUw0KKysrIGIvTkVXUw0KQEAgLTQsMTYgKzQsMTYgQEAgR05VIGNvcmV1dGlscyBO RVdTICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSotIG91dGxpbmUgLSotDQog DQogKiogTmV3IGZlYXR1cmVzDQogDQorICBzdGF0IG5vdyBzaG93cyB0aGUgbW91bnRwb2ludCBv ZiBhIHNwZWNpZmllZCBmaWxlIG9yIGRpcmVjdG9yeQ0KKyAgaW4gaXRzIGRlZmF1bHQ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csNyBAQCBU aGUgdmFsaWQgZm9ybWF0IHNlcXVlbmNlcyBmb3IgZmlsZXMgKHdpdGhvdXQgLS1maWxlLXN5c3Rl bSk6XG5cDQogICAgICAgZnB1dHMgKF8oIlwNCiAgICVoICAgTnVtYmVyIG9mIGhhcmQgbGlua3Nc blwNCiAgICVpICAgSW5vZGUgbnVtYmVyXG5cDQorICAlbSAgIE1vdW50IHBvaW50XG5cDQogICAl biAgIEZpbGUgbmFtZVxuXA0KICAgJU4gICBRdW90ZWQgZmlsZSBuYW1lIHdpdGggZGVyZWZlcmVu Y2UgaWYgc3ltYm9saWMgbGlua1xuXA0KICAgJW8gICBJL08gYmxvY2sgc2l6ZVxuXA0K --0016e6476496da5dde048ac0ebf3 Content-Type: application/octet-stream; name=DIFF1 Content-Disposition: attachment; filename=DIFF1 Content-Transfer-Encoding: base64 X-Attachment-Id: f_gbbenh7g1 Y29tbWl0IDcwZDFmMWM5N2YzMjJhMTY0ZWU4NzJjMDM5OWQ5ZmJjY2M4NjJiMTgNCkF1dGhvcjog QWFyb24gQnVyZ2VtZWlzdGVyIDxkYWpva2VyQGdtYWlsLmNvbT4NCkRhdGU6ICAgVHVlIEp1bCA2 IDE4OjAxOjUzIDIwMTAgLTA2MDANCg0KICAgIGJyb2tlbi0yMDEwMDcwNzAwMDAwMFoNCg0KZGlm ZiAtLWdpdCBhL3NyYy9maW5kbW91bnRwb2ludC5jIGIvc3JjL2ZpbmRtb3VudHBvaW50LmMNCm5l dyBmaWxlIG1vZGUgMTAwNjQ0DQppbmRleCAwMDAwMDAwLi42NjVlMmZjDQotLS0gL2Rldi9udWxs DQorKysgYi9zcmMvZmluZG1vdW50cG9pbnQuYw0KQEAgLTAsMCArMSw5MyBAQA0KKyNpbmNsdWRl ICJzYXZlLWN3ZC5oIg0KKyNpbmNsdWRlICJ4Z2V0Y3dkLmgiDQorDQorDQorLyogUmV0dXJuIHRo ZSByb290IG1vdW50cG9pbnQgb2YgdGhlIGZpbGUgc3lzdGV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ZSByZWNlaXZlZCBhIGNvcHkgb2YgdGhl IEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlDQorICogICAgYWxvbmcgd2l0aCB0aGlzIHByb2dy YW0uICBJZiBub3QsIHNlZSA8aHR0cDovL3d3dy5nbnUub3JnL2xpY2Vuc2VzLz4uICAqLw0KKw0K KyNpZm5kZWYgRklORE1PVU5UUE9JTlRfSA0KKyNkZWZpbmUgRklORE1PVU5UUE9JTlRfSCAxDQor I2VuZGlmDQorDQorDQorLyogUmV0dXJuIHRoZSByb290IG1vdW50cG9pbnQgb2YgdGhlIGZpbGUg c3lzdGVtIG9uIHdoaWNoIEZJTEUgZXhpc3RzLCBpbg0KKyAqIG1hbGxvY2VkIHN0b3JhZ2UuICBG SUxFX1NUQVQgc2hvdWxkIGJlIHRoZSByZXN1bHQgb2Ygc3RhdGluZyBGSUxFLg0KKyAqIEdpdmUg YSBkaWFnbm9zdGljIGFuZCByZXR1cm4gTlVMTCBpZiB1bmFibGUgdG8gZGV0ZXJtaW5lIHRoZSBt b3VudCBwb2ludC4NCisgKiBFeGl0IGlmIHVuYWJsZSB0byByZXN0b3JlIGN1cnJlbnQgd29ya2lu ZyBkaXJlY3RvcnkuICAqLw0KK3N0YXRpYyBjaGFyICogZmluZF9tb3VudF9wb2ludCAoY29uc3Qg Y2hhciAqLCBjb25zdCBzdHJ1Y3Qgc3RhdCAqKTsNCg== --0016e6476496da5dde048ac0ebf3-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 07 02:19:17 2010 Received: (at 6555) by debbugs.gnu.org; 7 Jul 2010 06:19:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWNyX-0001TK-1P for submit@debbugs.gnu.org; Wed, 07 Jul 2010 02:19:17 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWNyU-0001TF-D0 for 6555@debbugs.gnu.org; Wed, 07 Jul 2010 02:19:16 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id 3684194008D for <6555@debbugs.gnu.org>; Wed, 7 Jul 2010 08:19:05 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id BCAD4D818; Wed, 7 Jul 2010 08:19:04 +0200 (CEST) From: Jim Meyering To: A Burgie Subject: Re: bug#6555: stat enhancement In-Reply-To: (A. Burgie's message of "Tue, 6 Jul 2010 18:04:42 -0600") References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> Date: Wed, 07 Jul 2010 08:19:04 +0200 Message-ID: <87fwzvvmp3.fsf@meyering.net> Lines: 304 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) A Burgie wrote: > Well I am closer, but am still technically nowhere since it still will > not compile. The problem with the odd declaration error was because I > was trying to declare a c-pointer in the case section of the switch > statement. I guess that's not allowed in C (back to the easy > languages for me). Despite this I am still stuck with the compilation > complaining about find_mount_point's lack of existence though I'd bet > a nickel I have everything setup properly. Attached are a couple DIFF > files for those who may want to try to replay things and laugh at my > mediocrity on the condition that an explanation is provided where I'm > failing. I'd have just one DIFF file but I can't figure out how to > make Git show what I want so I think the combination of these two show > it all (first use of Git as well). > > Sorry to be slow at this. I'd like to learn and have yet to find > documentation on GNU's site (or anywhere else) other than the diff for > operand2sig which helped me a little but not quite enough for what > seems like a very simple operation (extract function, put in file, > create .h file, include .h file in previous .c files, modify > Makefile.am, compile). Start by reading README* and HACKING. The GNU Coding Standards has plenty of useful background info. Run "info standards" or see http://www.gnu.org/prep/standards/. ... > ** New features > > + stat now shows the mountpoint of a specified file or directory > + in its default output. It also will show this when a format is > + explicitly specified through the use of the %m specifier. As discussed, I'd rather not change the default output. stat can now print the mount point of a file via its new %m format directive > - du now uses less than half as much memory when operating on trees > - with many hard-linked files. With --count-links (-l), or when > - operating on trees with no hard-linked files, there is no change. Oops. Your patch would revert the two recent additions to NEWS, above and below. > -** Bug fixes > - > - du no longer multiply counts a file that is a directory or whose > - link count is 1, even if the file is reached multiple times by > - following symlinks or via multiple arguments. > > * Noteworthy changes in release 8.5 (2010-04-23) [stable] > > diff --git a/doc/coreutils.texi b/doc/coreutils.texi > index 21cf36d..ea3f142 100644 > --- a/doc/coreutils.texi > +++ b/doc/coreutils.texi > @@ -10666,6 +10666,7 @@ The valid @var{format} directives for files with @option{--format} and > @item %G - Group name of owner > @item %h - Number of hard links > @item %i - Inode number > +@item %m - Mount point > @item %n - File name > @item %N - Quoted file name with dereference if symbolic link > @item %o - I/O block size > diff --git a/gnulib b/gnulib > --- a/gnulib > +++ b/gnulib > @@ -1 +1 @@ > -Subproject commit 7773f84fe1aa3bb17defad704ee87f2615894ae4 > +Subproject commit 7773f84fe1aa3bb17defad704ee87f2615894ae4-dirty > diff --git a/src/Makefile.am b/src/Makefile.am > index 0630a06..f090087 100644 > --- a/src/Makefile.am > +++ b/src/Makefile.am > @@ -145,6 +145,7 @@ noinst_HEADERS = \ > copy.h \ > cp-hash.h \ > dircolors.h \ > + findmountpoint.h \ > fs.h \ > group-list.h \ > ls.h \ > diff --git a/src/stat.c b/src/stat.c > index c3730f0..f283437 100644 > --- a/src/stat.c > +++ b/src/stat.c > @@ -68,6 +68,9 @@ > #include "quotearg.h" > #include "stat-time.h" > #include "strftime.h" > +#include "findmountpoint.h" nameslikethis are hard to read. I prefer find-mount-point.h. > +#include "save-cwd.h" > +#include "xgetcwd.h" > > #if USE_STATVFS > # define STRUCT_STATVFS struct statvfs > @@ -612,6 +615,7 @@ print_stat (char *pformat, size_t prefix_len, char m, > struct stat *statbuf = (struct stat *) data; > struct passwd *pw_ent; > struct group *gw_ent; > + char * mp; Remove the space-after-"*". > bool fail = false; > > switch (m) > @@ -679,6 +683,14 @@ print_stat (char *pformat, size_t prefix_len, char m, > case 't': > out_uint_x (pformat, prefix_len, major (statbuf->st_rdev)); > break; > + case 'm': > + mp = find_mount_point (filename, statbuf); > + if (mp) { > + out_string (pformat, prefix_len, mp); > + } else { > + fail = true; > + } Your brace-using style is inconsistent with the rest of the code. Drop them in this case, since those are one-line "if" and "else" bodies. > + break; > case 'T': > out_uint_x (pformat, prefix_len, minor (statbuf->st_rdev)); > break; > @@ -1025,6 +1037,7 @@ The valid format sequences for files (without --file-system):\n\ > fputs (_("\ > %h Number of hard links\n\ > %i Inode number\n\ > + %m Mount point\n\ > %n File name\n\ > %N Quoted file name with dereference if symbolic link\n\ > %o I/O block size\n\ > > commit 70d1f1c97f322a164ee872c0399d9fbccc862b18 > Author: Aaron Burgemeister > Date: Tue Jul 6 18:01:53 2010 -0600 > > broken-20100707000000Z > > diff --git a/src/findmountpoint.c b/src/findmountpoint.c > new file mode 100644 > index 0000000..665e2fc > --- /dev/null > +++ b/src/findmountpoint.c > @@ -0,0 +1,93 @@ Every .c file must first include . > +#include "save-cwd.h" > +#include "xgetcwd.h" > + > + > +/* Return the root mountpoint of the file system on which FILE exists, in > + * malloced storage. FILE_STAT should be the result of stating FILE. > + * Give a diagnostic and return NULL if unable to determine the mount point. > + * Exit if unable to restore current working directory. */ We don't use this style of comment. Remove the "*" on continued lines. > +static char * > +find_mount_point (const char *file, const struct stat *file_stat) > +{ > + struct saved_cwd cwd; > + struct stat last_stat; > + char *mp = NULL; /* The malloced mount point. */ > + > + if (save_cwd (&cwd) != 0) > + { You have reindented this function (changing the brace positioning style to be contrary to the rest of coreutils). > + error (0, errno, _("cannot get current directory")); > + return NULL; > + } > + > + if (S_ISDIR (file_stat->st_mode)) > + /* FILE is a directory, so just chdir there directly. */ > + { > + last_stat = *file_stat; > + if (chdir (file) < 0) > + { > + error (0, errno, _("cannot change to directory %s"), quote (file)); > + return NULL; > + } > + } > + else > + /* FILE is some other kind of file; use its directory. */ > + { > + char *xdir = dir_name (file); > + char *dir; > + ASSIGN_STRDUPA (dir, xdir); > + free (xdir); > + > + if (chdir (dir) < 0) > + { > + error (0, errno, _("cannot change to directory %s"), quote (dir)); > + return NULL; > + } > + > + if (stat (".", &last_stat) < 0) > + { > + error (0, errno, _("cannot stat current directory (now %s)"), > + quote (dir)); > + goto done; > + } > + } > + > + /* Now walk up FILE's parents until we find another file system or /, > + * chdiring as we go. LAST_STAT holds stat information for the last place > + * we visited. */ Same here. > + while (true) > + { > + struct stat st; > + if (stat ("..", &st) < 0) > + { > + error (0, errno, _("cannot stat %s"), quote ("..")); > + goto done; > + } > + if (st.st_dev != last_stat.st_dev || st.st_ino == last_stat.st_ino) > + /* cwd is the mount point. */ > + break; > + if (chdir ("..") < 0) > + { > + error (0, errno, _("cannot change to directory %s"), quote ("..")); > + goto done; > + } > + last_stat = st; > + } > + > + /* Finally reached a mount point, see what it's called. */ > + mp = xgetcwd (); > + > +done: > + /* Restore the original cwd. */ > + { > + int save_errno = errno; > + if (restore_cwd (&cwd) != 0) > + error (EXIT_FAILURE, errno, > + _("failed to return to initial working directory")); > + free_cwd (&cwd); > + errno = save_errno; > + } > + > + return mp; > +} > + > + > diff --git a/src/findmountpoint.h b/src/findmountpoint.h > new file mode 100644 > index 0000000..3943b1e > --- /dev/null > +++ b/src/findmountpoint.h > @@ -0,0 +1,27 @@ > +/* stat-related time functions. > + * > + * Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc. > + * > + * This program is free software: you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 3 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program. If not, see . */ remove the "*"s on continued lines. > +#ifndef FINDMOUNTPOINT_H > +#define FINDMOUNTPOINT_H 1 > +#endif The #ifndef...#endif is supposed to span the contents of the file. > + > +/* Return the root mountpoint of the file system on which FILE exists, in > + * malloced storage. FILE_STAT should be the result of stating FILE. > + * Give a diagnostic and return NULL if unable to determine the mount point. > + * Exit if unable to restore current working directory. */ Please remove this comment. It duplicates the one in the .c file. > +static char * find_mount_point (const char *, const struct stat *); Once you've addressed all that, (don't worry about a test. I'll add that) you'll want to write a ChangeLog entry. They're discussed in HACKING. Run "git log|less" to see many examples. From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 07 02:30:08 2010 Received: (at 6555) by debbugs.gnu.org; 7 Jul 2010 06:30:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWO91-0001Yn-Pc for submit@debbugs.gnu.org; Wed, 07 Jul 2010 02:30:07 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWO8z-0001YA-BW for 6555@debbugs.gnu.org; Wed, 07 Jul 2010 02:30:07 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id EA9FA9400DB for <6555@debbugs.gnu.org>; Wed, 7 Jul 2010 08:29:56 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id C2E9AD818; Wed, 7 Jul 2010 08:29:55 +0200 (CEST) From: Jim Meyering To: A Burgie Subject: Re: bug#6555: stat enhancement In-Reply-To: (A. Burgie's message of "Tue, 6 Jul 2010 18:04:42 -0600") References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> Date: Wed, 07 Jul 2010 08:29:55 +0200 Message-ID: <87aaq3vm70.fsf@meyering.net> Lines: 34 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) A Burgie wrote: > Well I am closer, but am still technically nowhere since it still will > not compile. The problem with the odd declaration error was because I > was trying to declare a c-pointer in the case section of the switch > statement. I guess that's not allowed in C (back to the easy > languages for me). Despite this I am still stuck with the compilation > complaining about find_mount_point's lack of existence though I'd bet You have to add the following to src/Makefile.am, since with your change, df and stat are no longer derived solely from df.c and stat.c respectively: df_SOURCES = stat.c find-mount-point.c stat_SOURCES = df.c find-mount-point.c > a nickel I have everything setup properly. Attached are a couple DIFF > files for those who may want to try to replay things and laugh at my > mediocrity on the condition that an explanation is provided where I'm > failing. I'd have just one DIFF file but I can't figure out how to > make Git show what I want so I think the combination of these two show > it all (first use of Git as well). > > Sorry to be slow at this. I'd like to learn and have yet to find > documentation on GNU's site (or anywhere else) other than the diff for > operand2sig which helped me a little but not quite enough for what > seems like a very simple operation (extract function, put in file, > create .h file, include .h file in previous .c files, modify > Makefile.am, compile). Note that I didn't even review (more than superficially) or test your patch. If you have to make any change at all when moving the function from df.c to the new file, please tell us about it. Otherwise, the function body in the new file should be identical. From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 07 21:56:13 2010 Received: (at 6555) by debbugs.gnu.org; 8 Jul 2010 01:56:13 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWgLU-0002g4-Ug for submit@debbugs.gnu.org; Wed, 07 Jul 2010 21:56:13 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWgLS-0002fz-4g for 6555@debbugs.gnu.org; Wed, 07 Jul 2010 21:56:11 -0400 Received: by vws14 with SMTP id 14so401958vws.3 for <6555@debbugs.gnu.org>; Wed, 07 Jul 2010 18:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=G+5iqCds158Xh59qyVlQ3Ckp4K9L0otINWAB3DiLzr8=; b=aDwIaJWQSDRXTwPv+ON3WWECicZqmdtEZ7Ee0lXukrE/7fryuAFgh3h8MRihp4x4ZD YJuCf3/hjL0+Dm87hc7SvfdaDX/DVkVGmPrvn4iDoenvBzM0wLZSzk/6UCwsk11tyKP6 tJ6fB5PKvCVVs3kPEldTk096Kb5RhPnwjAIi4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=YOvSJc+r8KrjvzVe53T/7m29EPUlfjwwPuP4MNBEMhYPFoD8ynXVq6WgzGT8iGgvwc ozP2Us/EejUphHDZLJ04F/M7MvaD30DGmyJYCTlFffiq43vXQtfOqXMZDxRhudO7wthZ VUv/hQF0cCbm6X/ns4lyTnvCAWkogUlB8U638= Received: by 10.220.171.211 with SMTP id i19mr3827929vcz.112.1278554166307; Wed, 07 Jul 2010 18:56:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.195.77 with HTTP; Wed, 7 Jul 2010 18:55:46 -0700 (PDT) In-Reply-To: <87fwzvvmp3.fsf@meyering.net> References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> <87fwzvvmp3.fsf@meyering.net> From: A Burgie Date: Wed, 7 Jul 2010 19:55:46 -0600 Message-ID: Subject: Re: bug#6555: stat enhancement To: Jim Meyering Content-Type: multipart/mixed; boundary=0016e64cad1ee8aa5f048ad6961b X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --0016e64cad1ee8aa5f048ad6961b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Jul 7, 2010 at 00:19, Jim Meyering wrote: > A Burgie wrote: > Start by reading README* and HACKING. > The GNU Coding Standards has plenty of useful background info. > Run "info standards" or see http://www.gnu.org/prep/standards/. > > ... >> =C2=A0** New features >> >> + =C2=A0stat now shows the mountpoint of a specified file or directory >> + =C2=A0in its default output. =C2=A0It also will show this when a forma= t is >> + =C2=A0explicitly specified through the use of the %m specifier. > > As discussed, I'd rather not change the default output. > > =C2=A0stat can now print the mount point of a file via its new %m format = directive Sorry... old version of NEWS. It wasn't really there at the time and will not be in the future. >> - =C2=A0du now uses less than half as much memory when operating on tree= s >> - =C2=A0with many hard-linked files. =C2=A0With --count-links (-l), or w= hen >> - =C2=A0operating on trees with no hard-linked files, there is no change= . > > Oops. =C2=A0Your patch would revert the two recent additions to NEWS, > above and below. rebasing is my friend.... rebasing is my friend. It'll be right by shipping time. >> -** Bug fixes >> - >> - =C2=A0du no longer multiply counts a file that is a directory or whose >> - =C2=A0link count is 1, even if the file is reached multiple times by >> - =C2=A0following symlinks or via multiple arguments. >> >> =C2=A0* Noteworthy changes in release 8.5 (2010-04-23) [stable] >> >> diff --git a/doc/coreutils.texi b/doc/coreutils.texi >> index 21cf36d..ea3f142 100644 >> --- a/doc/coreutils.texi >> +++ b/doc/coreutils.texi >> @@ -10666,6 +10666,7 @@ The valid @var{format} directives for files with= @option{--format} and >> =C2=A0@item %G - Group name of owner >> =C2=A0@item %h - Number of hard links >> =C2=A0@item %i - Inode number >> +@item %m - Mount point >> =C2=A0@item %n - File name >> =C2=A0@item %N - Quoted file name with dereference if symbolic link >> =C2=A0@item %o - I/O block size >> diff --git a/gnulib b/gnulib >> --- a/gnulib >> +++ b/gnulib >> @@ -1 +1 @@ >> -Subproject commit 7773f84fe1aa3bb17defad704ee87f2615894ae4 >> +Subproject commit 7773f84fe1aa3bb17defad704ee87f2615894ae4-dirty >> diff --git a/src/Makefile.am b/src/Makefile.am >> index 0630a06..f090087 100644 >> --- a/src/Makefile.am >> +++ b/src/Makefile.am >> @@ -145,6 +145,7 @@ noinst_HEADERS =3D =C2=A0\ >> =C2=A0 =C2=A0copy.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> =C2=A0 =C2=A0cp-hash.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0dircolors.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0\ >> + =C2=A0findmountpoint.h =C2=A0 \ >> =C2=A0 =C2=A0fs.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 \ >> =C2=A0 =C2=A0group-list.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 \ >> =C2=A0 =C2=A0ls.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 \ >> diff --git a/src/stat.c b/src/stat.c >> index c3730f0..f283437 100644 >> --- a/src/stat.c >> +++ b/src/stat.c >> @@ -68,6 +68,9 @@ >> =C2=A0#include "quotearg.h" >> =C2=A0#include "stat-time.h" >> =C2=A0#include "strftime.h" >> +#include "findmountpoint.h" > > nameslikethis are hard to read. > I prefer find-mount-point.h. Done thoughout. >> +#include "save-cwd.h" >> +#include "xgetcwd.h" >> >> =C2=A0#if USE_STATVFS >> =C2=A0# define STRUCT_STATVFS struct statvfs >> @@ -612,6 +615,7 @@ print_stat (char *pformat, size_t prefix_len, char m= , >> =C2=A0 =C2=A0struct stat *statbuf =3D (struct stat *) data; >> =C2=A0 =C2=A0struct passwd *pw_ent; >> =C2=A0 =C2=A0struct group *gw_ent; >> + =C2=A0char * mp; > > Remove the space-after-"*". Done. >> =C2=A0 =C2=A0bool fail =3D false; >> >> =C2=A0 =C2=A0switch (m) >> @@ -679,6 +683,14 @@ print_stat (char *pformat, size_t prefix_len, char = m, >> =C2=A0 =C2=A0 =C2=A0case 't': >> =C2=A0 =C2=A0 =C2=A0 =C2=A0out_uint_x (pformat, prefix_len, major (statb= uf->st_rdev)); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >> + =C2=A0 =C2=A0case 'm': >> + =C2=A0 =C2=A0 =C2=A0mp =3D find_mount_point (filename, statbuf); >> + =C2=A0 =C2=A0 =C2=A0if (mp) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0out_string (pformat, prefix_len, mp); >> + =C2=A0 =C2=A0 =C2=A0} else { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0fail =3D true; >> + =C2=A0 =C2=A0 =C2=A0} > > Your brace-using style is inconsistent with the rest of the code. > Drop them in this case, since those are one-line "if" and "else" bodies. Wondered about that. I see in HACKING it talks about this. Fixed. >> + =C2=A0 =C2=A0 =C2=A0break; >> =C2=A0 =C2=A0 =C2=A0case 'T': >> =C2=A0 =C2=A0 =C2=A0 =C2=A0out_uint_x (pformat, prefix_len, minor (statb= uf->st_rdev)); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >> @@ -1025,6 +1037,7 @@ The valid format sequences for files (without --fi= le-system):\n\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0fputs (_("\ >> =C2=A0 =C2=A0%h =C2=A0 Number of hard links\n\ >> =C2=A0 =C2=A0%i =C2=A0 Inode number\n\ >> + =C2=A0%m =C2=A0 Mount point\n\ >> =C2=A0 =C2=A0%n =C2=A0 File name\n\ >> =C2=A0 =C2=A0%N =C2=A0 Quoted file name with dereference if symbolic lin= k\n\ >> =C2=A0 =C2=A0%o =C2=A0 I/O block size\n\ >> >> commit 70d1f1c97f322a164ee872c0399d9fbccc862b18 >> Author: Aaron Burgemeister >> Date: =C2=A0 Tue Jul 6 18:01:53 2010 -0600 >> >> =C2=A0 =C2=A0 broken-20100707000000Z >> >> diff --git a/src/findmountpoint.c b/src/findmountpoint.c >> new file mode 100644 >> index 0000000..665e2fc >> --- /dev/null >> +++ b/src/findmountpoint.c >> @@ -0,0 +1,93 @@ > > Every .c file must first include . Ah ha. I added a bit more to actually get things where they are now but that is good to know. >> +#include "save-cwd.h" >> +#include "xgetcwd.h" >> + >> + >> +/* Return the root mountpoint of the file system on which FILE exists, = in >> + * malloced storage. =C2=A0FILE_STAT should be the result of stating FI= LE. >> + * Give a diagnostic and return NULL if unable to determine the mount p= oint. >> + * Exit if unable to restore current working directory. =C2=A0*/ > > We don't use this style of comment. > Remove the "*" on continued lines. Sorry... I copied from an example I found, I think in shred.c, though the second example is wrong while the first is correct. Noted for the future and fixed. >> +static char * >> +find_mount_point (const char *file, const struct stat *file_stat) >> +{ >> + =C2=A0struct saved_cwd cwd; >> + =C2=A0struct stat last_stat; >> + =C2=A0char *mp =3D NULL; =C2=A0 =C2=A0/* The malloced mount point. =C2= =A0*/ >> + >> + =C2=A0if (save_cwd (&cwd) !=3D 0) >> + =C2=A0{ > > You have reindented this function (changing > the brace positioning style to be contrary to the rest of coreutils). Finally figured out about the ':set [no]paste' stuff in vi so I can get around this. Hopefully fixed once and for all. > > The #ifndef...#endif is supposed to span the contents of the file. Fixed, and suddenly the point of compile-time conditionals comes back to me= . >> + >> +/* Return the root mountpoint of the file system on which FILE exists, = in >> + * malloced storage. =C2=A0FILE_STAT should be the result of stating FI= LE. >> + * Give a diagnostic and return NULL if unable to determine the mount p= oint. >> + * Exit if unable to restore current working directory. =C2=A0*/ > > Please remove this comment. > It duplicates the one in the .c file. Done. >> +static char * find_mount_point (const char *, const struct stat *); I think I can figure out a changelog. The one thing left, though, is a bit less cosmetic. Something about my makefile (which has the two new _SOURCES sections you suggested) is still not letting make compile everything properly. stat.o: In function `print_stat': /home/aburgemeister/code/coreutils/src/stat.c:687: undefined reference to `find_mount_point' collect2: ld returned 1 exit status make[3]: *** [df] Error 1 make[3]: Leaving directory `/home/aburgemeister/code/coreutils/src' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/aburgemeister/code/coreutils/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/aburgemeister/code/coreutils' make: *** [all] Error 2 --0016e64cad1ee8aa5f048ad6961b Content-Type: application/octet-stream; name=DIFF0 Content-Disposition: attachment; filename=DIFF0 Content-Transfer-Encoding: base64 X-Attachment-Id: f_gbcy1b9p1 RnJvbSAzMWY0ZjdjZmNiMzhjODg2MGY0NzBlYzk2ODhjOWYyNzAzYWRkMDM1IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQ0KRnJvbTogQWFyb24gQnVyZ2VtZWlzdGVyIDxkYWpva2VyQGdtYWlsLmNv bT4NCkRhdGU6IFdlZCwgNyBKdWwgMjAxMCAxOTo0MjoyNCAtMDYwMA0KU3ViamVjdDogW1BBVENI XSBmaXJzdCBidWlsZDsgbW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KKysrIGIvTkVXUw0K QEAgLTQsNiArNCw4IEBAIEdOVSBjb3JldXRpbHMgTkVXUyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIC0qLSBvdXRsaW5lIC0qLQ0KIA0KICoqIE5ldyBmZWF0dXJlcw0KIA0KKyAg c3RhdCBjYW4gbm93IHByaW50IHRoZSBtb3VudCBwb2ludCBvZiBhIGZpbGUgdmlhIGl0cyBuZXcg JW0gZm9ybWF0IGRpcmVjdGl2ZS4NCisNCiAgIGNwIG5vdyBhY2NlcHRzIHRoZSAtLWF0dHJpYnV0 ZXMtb25seSBvcHRpb24gdG8gbm90IGNvcHkgZmlsZSBkYXRhLA0KICAgd2hpY2ggaXMgdXNlZnVs IGZvciBlZmZpY2llbnRseSBtb2RpZnlpbmcgZmlsZXMuDQogDQpkaWZmIC0tZ2l0IGEvVEhBTktT IGIvVEhBTktTDQppbmRleCBjYWE0MGRlLi43OWYxZjFkIDEwMDY0NA0KLS0tIGEvVEhBTktTDQor KysgYi9USEFOS1MNCkBAIC04LDYgKzgsNyBAQCB0aGUgYnVnLXJlcG9ydCBtYWlsaW5nIGxpc3Qg KGFzIHNlZW4gb24gbGFzdCBsaW5lIG9mIGUuZy4sIGNwIC0taGVscCkuDQogDQogPz8/ICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAga3l0ZWtAY3liZXJjb21tLm5ldA0KIEEgQ29zdGEg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFnY29zdGFAZ2lzLm5ldA0KK0Fhcm9uIEJ1cmdl bWVpc3RlciAgICAgICAgICAgICAgICAgIGRham9rZXJAZ21haWwuY29tDQogQWFyb24gSGF3bGV5 ICAgICAgICAgICAgICAgICAgICAgICAgYXNoYXdsZXlAdXZtLmVkdQ0KIEFjaGltIEJsdW1lbnNh dGggICAgICAgICAgICAgICAgICAgIGJsdW1lQGNvcm9uYS5vY2hlLmRlDQogQWRhbSBKaW1lcnNv biAgICAgICAgICAgICAgICAgICAgICAg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ChmaWxlX3N0YXQtPnN0X21vZGUpKQ0KKyAgICAv KiBGSUxFIGlzIGEgZGlyZWN0b3J5LCBzbyBqdXN0IGNoZGlyIHRoZXJlIGRpcmVjdGx5LiAgKi8N CisgICAgew0KKyAgICAgIGxhc3Rfc3RhdCA9ICpmaWxlX3N0YXQ7DQorICAgICAgaWYgKGNoZGly IChmaWxlKSA8IDApDQorICAgICAgICB7DQorICAgICAgICAgIGVycm9yICgwLCBlcnJubywgXygi Y2Fubm90IGNoYW5nZSB0byBkaXJlY3RvcnkgJXMiKSwgcXVvdGUgKGZpbGUpKTsNCisgICAgICAg ICAgcmV0dXJuIE5VTEw7DQorICAgICAgICB9DQorICAgIH0NCisgIGVsc2UNCisgICAgLyogRklM RSBpcyBzb21lIG90aGVyIGtpbmQgb2YgZmlsZTsgdXNlIGl0cyBkaXJlY3RvcnkuICAqLw0KKyAg ICB7DQorICAgICAgY2hhciAqeGRpciA9IGRpcl9uYW1lIChmaWxlKTsNCisgICAgICBjaGFyICpk aXI7DQorICAgICAgQVNTSUdOX1NUUkRVUEEgKGRpciwgeGRpcik7DQorICAgICAgZnJlZSAoeGRp cik7DQorDQorICAgICAgaWYgKGNoZGlyIChkaXIpIDwgMCkNCisgICAgICAgIHsNCisgICAgICAg ICAgZXJyb3IgKDAsIGVycm5vLCBfKCJjYW5ub3QgY2hhbmdlIHRvIGRpcmVjdG9yeSAlcyIpLCBx dW90ZSAoZGlyKSk7DQorICAgICAgICAgIHJldHVybiBOVUxMOw0KKyAgICAgICAgfQ0KKw0KKyAg ICAgIGlmIChzdGF0ICgiLiIsICZsYXN0X3N0YXQpIDwgMCkNCisgICAgICAgIHsNCisgICAgICAg ICAgZXJyb3IgKDAsIGVycm5vLCBfKCJjYW5ub3Qgc3RhdCBjdXJyZW50IGRpcmVjdG9yeSAobm93 ICVzKSIpLA0KKyAgICAgICAgICAgICAgICAgcXVvdGUgKGRpcikpOw0KKyAgICAgICAgICBnb3Rv IGRvbmU7DQorICAgICAgIC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DQpAQCAtMTAyNSw2ICsxMDM2LDcgQEAgVGhlIHZhbGlkIGZvcm1h dCBzZXF1ZW5jZXMgZm9yIGZpbGVzICh3aXRob3V0IC0tZmlsZS1zeXN0ZW0pOlxuXA0KICAgICAg IGZwdXRzIChfKCJcDQogICAlaCAgIE51bWJlciBvZiBoYXJkIGxpbmtzXG5cDQogICAlaSAgIElu b2RlIG51bWJlclxuXA0KKyAgJW0gICBNb3VudCBwb2ludFxuXA0KICAgJW4gICBGaWxlIG5hbWVc blwNCiAgICVOICAgUXVvdGVkIGZpbGUgbmFtZSB3aXRoIGRlcmVmZXJlbmNlIGlmIHN5bWJvbGlj IGxpbmtcblwNCiAgICVvICAgSS9PIGJsb2NrIHNpemVcblwNCi0tIA0KMS43LjENCg0K --0016e64cad1ee8aa5f048ad6961b-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 15 22:08:39 2010 Received: (at 6555) by debbugs.gnu.org; 16 Jul 2010 02:08:40 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZaLu-0007TY-7B for submit@debbugs.gnu.org; Thu, 15 Jul 2010 22:08:38 -0400 Received: from mail-vw0-f44.google.com ([209.85.212.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZaLs-0007TT-D8 for 6555@debbugs.gnu.org; Thu, 15 Jul 2010 22:08:37 -0400 Received: by vws14 with SMTP id 14so1816947vws.3 for <6555@debbugs.gnu.org>; Thu, 15 Jul 2010 19:08:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=lpnGW3fmv/PwSYtQ3TTeDklK4XCuWproc6PFDiKuG2o=; b=guVprGlGD4jfZxyZGNm4J0ZG/s7kegETgSPT8XF6wpS3DZiKg3nGqfcbHxTepkmiMs C6bPat0oUAe3v/z6ocfyI6oh3H959Ceu+zn01QVPUkTU56gChoKjpplhMTsTl9jmFoUL MCTP96joDrRP4p9cC7zIpLfR4YzX+CUX7nONw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=NK9M0y3OoQPndyUTiQfiVlJjtPtNktg8QJGA+W82zdngGLPDJl+0UjvvM4iB/3vpK5 e1fGxMPIaFVf0RvJLIHU2YSJNEFPT4Y7rulUkac+W3v+U64yn5NVuW72yQ8aEZK+UGWC V4m9EZnqnJ8Am/ghF7mVm0qiRZ2ZX0Gt9BQJo= Received: by 10.220.99.21 with SMTP id s21mr77754vcn.222.1279246128187; Thu, 15 Jul 2010 19:08:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.195.77 with HTTP; Thu, 15 Jul 2010 19:08:28 -0700 (PDT) In-Reply-To: References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> <87fwzvvmp3.fsf@meyering.net> From: A Burgie Date: Thu, 15 Jul 2010 20:08:28 -0600 Message-ID: Subject: Re: bug#6555: stat enhancement To: Jim Meyering Content-Type: multipart/mixed; boundary=0016e64e9d200d0a0f048b77b314 X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) --0016e64e9d200d0a0f048b77b314 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Attached is the finished DIFF which I believe meets all of the requirements. For notes the problem with compilation had to do with the definition of the function in the find-mount-point.h and find-mount-point.c files having the 'static' as part of the definition. Removing that allowed compilation to continue. Apparently in C something defined as static cannot be used outside that C file, even if included. Let me know if anything else must be done. I started the licensing process but have not heard back at all since I did so. e0abccac5fbbe1af452cc04f7980f8e7 DIFF0 140caa8e1f0e04c8daa42ced5caa0962537ae2a8 DIFF0 Thanks, Aaron On Wed, Jul 7, 2010 at 19:55, A Burgie wrote: > On Wed, Jul 7, 2010 at 00:19, Jim Meyering wrote: >> A Burgie wrote: >> Start by reading README* and HACKING. >> The GNU Coding Standards has plenty of useful background info. >> Run "info standards" or see http://www.gnu.org/prep/standards/. >> >> ... >>> =C2=A0** New features >>> >>> + =C2=A0stat now shows the mountpoint of a specified file or directory >>> + =C2=A0in its default output. =C2=A0It also will show this when a form= at is >>> + =C2=A0explicitly specified through the use of the %m specifier. >> >> As discussed, I'd rather not change the default output. >> >> =C2=A0stat can now print the mount point of a file via its new %m format= directive > > Sorry... old version of NEWS. =C2=A0It wasn't really there at the time an= d > will not be in the future. > >>> - =C2=A0du now uses less than half as much memory when operating on tre= es >>> - =C2=A0with many hard-linked files. =C2=A0With --count-links (-l), or = when >>> - =C2=A0operating on trees with no hard-linked files, there is no chang= e. >> >> Oops. =C2=A0Your patch would revert the two recent additions to NEWS, >> above and below. > > rebasing is my friend.... rebasing is my friend. =C2=A0It'll be right by > shipping time. > >>> -** Bug fixes >>> - >>> - =C2=A0du no longer multiply counts a file that is a directory or whos= e >>> - =C2=A0link count is 1, even if the file is reached multiple times by >>> - =C2=A0following symlinks or via multiple arguments. >>> >>> =C2=A0* Noteworthy changes in release 8.5 (2010-04-23) [stable] >>> >>> diff --git a/doc/coreutils.texi b/doc/coreutils.texi >>> index 21cf36d..ea3f142 100644 >>> --- a/doc/coreutils.texi >>> +++ b/doc/coreutils.texi >>> @@ -10666,6 +10666,7 @@ The valid @var{format} directives for files wit= h @option{--format} and >>> =C2=A0@item %G - Group name of owner >>> =C2=A0@item %h - Number of hard links >>> =C2=A0@item %i - Inode number >>> +@item %m - Mount point >>> =C2=A0@item %n - File name >>> =C2=A0@item %N - Quoted file name with dereference if symbolic link >>> =C2=A0@item %o - I/O block size >>> diff --git a/gnulib b/gnulib >>> --- a/gnulib >>> +++ b/gnulib >>> @@ -1 +1 @@ >>> -Subproject commit 7773f84fe1aa3bb17defad704ee87f2615894ae4 >>> +Subproject commit 7773f84fe1aa3bb17defad704ee87f2615894ae4-dirty >>> diff --git a/src/Makefile.am b/src/Makefile.am >>> index 0630a06..f090087 100644 >>> --- a/src/Makefile.am >>> +++ b/src/Makefile.am >>> @@ -145,6 +145,7 @@ noinst_HEADERS =3D =C2=A0\ >>> =C2=A0 =C2=A0copy.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> =C2=A0 =C2=A0cp-hash.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> =C2=A0 =C2=A0dircolors.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0\ >>> + =C2=A0findmountpoint.h =C2=A0 \ >>> =C2=A0 =C2=A0fs.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 \ >>> =C2=A0 =C2=A0group-list.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 \ >>> =C2=A0 =C2=A0ls.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 \ >>> diff --git a/src/stat.c b/src/stat.c >>> index c3730f0..f283437 100644 >>> --- a/src/stat.c >>> +++ b/src/stat.c >>> @@ -68,6 +68,9 @@ >>> =C2=A0#include "quotearg.h" >>> =C2=A0#include "stat-time.h" >>> =C2=A0#include "strftime.h" >>> +#include "findmountpoint.h" >> >> nameslikethis are hard to read. >> I prefer find-mount-point.h. > > Done thoughout. > >>> +#include "save-cwd.h" >>> +#include "xgetcwd.h" >>> >>> =C2=A0#if USE_STATVFS >>> =C2=A0# define STRUCT_STATVFS struct statvfs >>> @@ -612,6 +615,7 @@ print_stat (char *pformat, size_t prefix_len, char = m, >>> =C2=A0 =C2=A0struct stat *statbuf =3D (struct stat *) data; >>> =C2=A0 =C2=A0struct passwd *pw_ent; >>> =C2=A0 =C2=A0struct group *gw_ent; >>> + =C2=A0char * mp; >> >> Remove the space-after-"*". > > Done. > >>> =C2=A0 =C2=A0bool fail =3D false; >>> >>> =C2=A0 =C2=A0switch (m) >>> @@ -679,6 +683,14 @@ print_stat (char *pformat, size_t prefix_len, char= m, >>> =C2=A0 =C2=A0 =C2=A0case 't': >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0out_uint_x (pformat, prefix_len, major (stat= buf->st_rdev)); >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>> + =C2=A0 =C2=A0case 'm': >>> + =C2=A0 =C2=A0 =C2=A0mp =3D find_mount_point (filename, statbuf); >>> + =C2=A0 =C2=A0 =C2=A0if (mp) { >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0out_string (pformat, prefix_len, mp); >>> + =C2=A0 =C2=A0 =C2=A0} else { >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0fail =3D true; >>> + =C2=A0 =C2=A0 =C2=A0} >> >> Your brace-using style is inconsistent with the rest of the code. >> Drop them in this case, since those are one-line "if" and "else" bodies. > > Wondered about that. =C2=A0I see in HACKING it talks about this. =C2=A0Fi= xed. > >>> + =C2=A0 =C2=A0 =C2=A0break; >>> =C2=A0 =C2=A0 =C2=A0case 'T': >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0out_uint_x (pformat, prefix_len, minor (stat= buf->st_rdev)); >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>> @@ -1025,6 +1037,7 @@ The valid format sequences for files (without --f= ile-system):\n\ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0fputs (_("\ >>> =C2=A0 =C2=A0%h =C2=A0 Number of hard links\n\ >>> =C2=A0 =C2=A0%i =C2=A0 Inode number\n\ >>> + =C2=A0%m =C2=A0 Mount point\n\ >>> =C2=A0 =C2=A0%n =C2=A0 File name\n\ >>> =C2=A0 =C2=A0%N =C2=A0 Quoted file name with dereference if symbolic li= nk\n\ >>> =C2=A0 =C2=A0%o =C2=A0 I/O block size\n\ >>> >>> commit 70d1f1c97f322a164ee872c0399d9fbccc862b18 >>> Author: Aaron Burgemeister >>> Date: =C2=A0 Tue Jul 6 18:01:53 2010 -0600 >>> >>> =C2=A0 =C2=A0 broken-20100707000000Z >>> >>> diff --git a/src/findmountpoint.c b/src/findmountpoint.c >>> new file mode 100644 >>> index 0000000..665e2fc >>> --- /dev/null >>> +++ b/src/findmountpoint.c >>> @@ -0,0 +1,93 @@ >> >> Every .c file must first include . > > Ah ha. =C2=A0I added a bit more to actually get things where they are now > but that is good to know. > >>> +#include "save-cwd.h" >>> +#include "xgetcwd.h" >>> + >>> + >>> +/* Return the root mountpoint of the file system on which FILE exists,= in >>> + * malloced storage. =C2=A0FILE_STAT should be the result of stating F= ILE. >>> + * Give a diagnostic and return NULL if unable to determine the mount = point. >>> + * Exit if unable to restore current working directory. =C2=A0*/ >> >> We don't use this style of comment. >> Remove the "*" on continued lines. > > Sorry... I copied from an example I found, I think in shred.c, though > the second example is wrong while the first is correct. =C2=A0Noted for t= he > future and fixed. > >>> +static char * >>> +find_mount_point (const char *file, const struct stat *file_stat) >>> +{ >>> + =C2=A0struct saved_cwd cwd; >>> + =C2=A0struct stat last_stat; >>> + =C2=A0char *mp =3D NULL; =C2=A0 =C2=A0/* The malloced mount point. = =C2=A0*/ >>> + >>> + =C2=A0if (save_cwd (&cwd) !=3D 0) >>> + =C2=A0{ >> >> You have reindented this function (changing >> the brace positioning style to be contrary to the rest of coreutils). > > Finally figured out about the ':set [no]paste' stuff in vi so I can > get around this. =C2=A0Hopefully fixed once and for all. > >> >> The #ifndef...#endif is supposed to span the contents of the file. > > Fixed, and suddenly the point of compile-time conditionals comes back to = me. > >>> + >>> +/* Return the root mountpoint of the file system on which FILE exists,= in >>> + * malloced storage. =C2=A0FILE_STAT should be the result of stating F= ILE. >>> + * Give a diagnostic and return NULL if unable to determine the mount = point. >>> + * Exit if unable to restore current working directory. =C2=A0*/ >> >> Please remove this comment. >> It duplicates the one in the .c file. > > Done. > >>> +static char * find_mount_point (const char *, const struct stat *); > > I think I can figure out a changelog. =C2=A0The one thing left, though, i= s > a bit less cosmetic. =C2=A0Something about my makefile (which has the two > new _SOURCES sections you suggested) is still not letting make compile > everything properly. > > stat.o: In function `print_stat': > /home/aburgemeister/code/coreutils/src/stat.c:687: undefined reference > to `find_mount_point' > collect2: ld returned 1 exit status > make[3]: *** [df] Error 1 > make[3]: Leaving directory `/home/aburgemeister/code/coreutils/src' > make[2]: *** [all] Error 2 > make[2]: Leaving directory `/home/aburgemeister/code/coreutils/src' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/aburgemeister/code/coreutils' > make: *** [all] Error 2 > --0016e64e9d200d0a0f048b77b314 Content-Type: application/octet-stream; name=DIFF0 Content-Disposition: attachment; filename=DIFF0 Content-Transfer-Encoding: base64 X-Attachment-Id: f_gbody8ws1 RnJvbSBjYjFjNDc4MmNkYmRkOGI2Y2VlMWY2NmQ3NDAyOGY1ZjU3MzZjOGRjIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBBYXJvbiBCdXJnZW1laXN0ZXIgPGRham9rZXJAZ21haWwuY29t PgpEYXRlOiBUaHUsIDE1IEp1bCAyMDEwIDE5OjU0OjQ5IC0wNjAwClN1YmplY3Q6IFtQQVRDSF0g Q2hhbmdlIHN0YXQgdG8gc2hvdyBtb3VudHBvaW50cyBmb3IgZmlsZXM7IHB1dCBmaW5kX21vdW50 X3BvaW50IG1ldGhvZCBpbnRvIG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XMgc29tZSBvdGhlciBr aW5kIG9mIGZpbGU7IHVzZSBpdHMgZGlyZWN0b3J5LiAgKi8KLSAgICB7Ci0gICAgICBjaGFyICp4 ZGlyID0gZGlyX25hbWUgKGZpbGUpOwotICAgICAgY2hhciAqZGlyOwotICAgICAgQVNTSUdOX1NU UkRVUEEgKGRpciwgeGRpcik7Ci0gICAgICBmcmVlICh4ZGlyKTsKLQotICAgICAgaWYgKGNoZGly IChkaXIpIDwgMCkKLSAgICAgICAgewotICAgICAgICAgIGVycm9yICgwLCBlcnJubywgXygiY2Fu bm90IGNoYW5nZSB0byBkaXJlY3RvcnkgJXMiKSwgcXVvdGUgKGRpcikpOwotICAgICAgICAgIHJl dHVybiBOVUxMOwotICAgICAgICB9Ci0KLSAgICAgIGlmIChzdGF0ICgiLiIsICZsYXN0X3N0YXQp IDwgMCkKLSAgICAgICAgewotICAgICAgICAgIGVycm9yICgwLCBlcnJubywgXygiY2Fubm90IHN0 YXQgY3VycmVudCBkaXJlY3RvcnkgKG5vdyAlcykiKSwKLSAgICAgICAgICAgICAgICAgcXVvdGUg KGRpcikpOwotICAgICAgICAgIGdvdG8gZG9uZTsKLSAgICAgICAgfQotICAgIH0KLQotICAvKiBO b3cgd2FsayB1cCBGSUxFJ3MgcGFyZW50cyB1bnRpbCB3ZSBmaW5kIGFub3RoZXIgZmlsZSBzeXN0 ZW0gb3IgLywKLSAgICAgY2hkaXJpbmcgYXMgd2UgZ28uICBMQVNUX1NUQVQgaG9sZHMgc3RhdCBp bmZvcm1hdGlvbiBmb3IgdGhlIGxhc3QgcGxhY2UKLSAgICAgd2UgdmlzaXRlZC4gICovCi0gIHdo aWxlICh0cnVlKQotICAgIHsKLSAgICAgIHN0cnVjdCBzdGF0IHN0OwotICAgICAgaWYgKHN0YXQg KCIuLiIsICZzdCkgPCAwKQotICAgICAgICB7Ci0gICAgICAgICAgZXJyb3IgKDAsIGVycm5vLCBf KCJjYW5ub3Qgc3RhdCAlcyIpLCBxdW90ZSAo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Ki8KKworICBpZiAoc2F2ZV9jd2QgKCZjd2QpICE9IDApCisgICAgeworICAgICAgZXJyb3Ig KDAsIGVycm5vLCBfKCJjYW5ub3QgZ2V0IGN1cnJlbnQgZGlyZWN0b3J5IikpOworICAgICAgcmV0 dXJuIE5VTEw7CisgICAgfQorCisgIGlmIChTX0lTRElSIChmaWxlX3N0YXQtPnN0X21vZGUpKQor ICAgIC8qIEZJTEUgaXMgYSBkaXJlY3RvcnksIHNvIGp1c3QgY2hkaXIgdGhlcmUgZGlyZWN0bHku ICAqLworICAgIHsKKyAgICAgIGxhc3Rfc3RhdCA9ICpmaWxlX3N0YXQ7CisgICAgICBpZiAoY2hk aXIgKGZpbGUpIDwgMCkKKyAgICAgICAgeworICAgICAgICAgIGVycm9yICgwLCBlcnJubywgXygi Y2Fubm90IGNoYW5nZSB0byBkaXJlY3RvcnkgJXMiKSwgcXVvdGUgKGZpbGUpKTsKKyAgICAgICAg ICByZXR1cm4gTlVMTDsKKyAgICAgICAgfQorICAgIH0KKyAgZWxzZQorICAgIC8qIEZJTEUgaXMg c29tZSBvdGhlciBraW5kIG9mIGZpbGU7IHVzZSBpdHMgZGlyZWN0b3J5LiAgKi8KKyAgICB7Cisg ICAgICBjaGFyICp4ZGlyID0gZGlyX25hbWUgKGZpbGUpOworICAgICAgY2hhciAqZGlyOworICAg ICAgQVNTSUdOX1NUUkRVUEEgKGRpciwgeGRpcik7CisgICAgICBmcmVlICh4ZGlyKTsKKworICAg ICAgaWYgKGNoZGlyIChkaXIpIDwgMCkKKyAgICAgICAgeworICAgICAgICAgIGVycm9yICgwLCBl cnJubywgXygiY2Fubm90IGNoYW5nZSB0byBkaXJlY3RvcnkgJXMiKSwgcXVvdGUgKGRpcikpOwor ICAgICAgICAgIHJldHVybiBOVUxMOworICAgICAgICB9CisKKyAgICAgIGlmIChzdGF0ICgiLiIs ICZsYXN0X3N0YXQpIDwgMCkKKyAgICAgICAgeworICAgICAgICAgIGVycm9yICgwLCBlcnJubywg XygiY2Fubm90IHN0YXQgY3VycmVudCBkaXJlY3RvcnkgKG5vdyAlcykiKSwKKyAgICAgICAgICAg ICAgICAgcXVvdGUgKGRpcikpOworICAgICAgICAgIGdvdG8gZG9uZTsKKyAgICAgICAgfQorICAg IH0KKworICAvKiBOb3cgd2FsayB1cCBGSUxFJ3MgcGFyZW50cyB1bnRpbCB3ZSBmaW5kIGFub3Ro ZXIgZmlsZSBzeXN0ZW0gb3IgLywKKyAgICAgY2hkaXJpbmcgYXMgd2UgZ28uICBMQVNUX1NUQVQg aG9sZHMgc3RhdCBpbmZvcm1hdGlvbiBmb3IgdGhlIGxhc3QgcGxhY2UKKyAgICAgd2UgdmlzaXRl ZC4gICovCisgIHdoaWxlICh0cnVlKQorICAgIHsKKyAgICAgIHN0cnVjdCBzdGF0IHN0OworICAg ICAgaWYgKHN0YXQgKCIuLiIsICZzdCkgPCAwKQorICAgICAgICB7CisgICAgICAgICAgZXJyb3Ig KDAsIGVycm5vLCBfKCJjYW5ub3Qgc3RhdCAlcyIpLCBxdW90ZSAoIi4uIikpOworICAgICAgICAg IGdvdG8gZG9uZTsKKyAgICAgICAgfQorICAgICAgaWYgKHN0LnN0X2RldiAhPSBsYXN0X3N0YXQu c3RfZGV2IHx8IHN0LnN0X2lubyA9PSBsYXN0X3N0YXQuc3RfaW5vKQorICAgICAgICAvKiBjd2Qg aXMgdGhlIG1vdW50IHBvaW50LiAgKi8KKyAgICAgICAgYnJlYWs7CisgICAgICBpZiAoY2hkaXIg KCIuLiIpIDwgMCkKKyAgICAgICAgeworICAgICAgICAgIGVycm9yICgwLCBlcnJubywgXygiY2Fu bm90IGNoYW5nZSB0byBkaXJlY3RvcnkgJXMiKSwgcXVvdGUgKCIuLiIpKTsKKyAgICAgICAgICBn b3RvIGRvbmU7CisgICAgICAgIH0KKyAgICAgIGxhc3Rfc3RhdCA9IHN0OworICAgIH0KKworICAv KiBGaW5hbGx5IHJlYWNoZWQgYSBtb3VudCBwb2ludCwgc2VlIHdoY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GlkIGZvcm1hdCBzZXF1ZW5jZXMgZm9yIGZpbGVzICh3 aXRob3V0IC0tZmlsZS1zeXN0ZW0pOlxuXAogICAgICAgZnB1dHMgKF8oIlwKICAgJWggICBOdW1i ZXIgb2YgaGFyZCBsaW5rc1xuXAogICAlaSAgIElub2RlIG51bWJlclxuXAorICAlbSAgIE1vdW50 IHBvaW50XG5cCiAgICVuICAgRmlsZSBuYW1lXG5cCiAgICVOICAgUXVvdGVkIGZpbGUgbmFtZSB3 aXRoIGRlcmVmZXJlbmNlIGlmIHN5bWJvbGljIGxpbmtcblwKICAgJW8gICBJL08gYmxvY2sgc2l6 ZVxuXAotLSAKMS43LjEKCg== --0016e64e9d200d0a0f048b77b314-- From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 12 23:01:25 2010 Received: (at 6555) by debbugs.gnu.org; 13 Aug 2010 03:01:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OjkWK-0004cY-9M for submit@debbugs.gnu.org; Thu, 12 Aug 2010 23:01:25 -0400 Received: from mail-qy0-f179.google.com ([209.85.216.179]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OjkWH-0004cT-O6 for 6555@debbugs.gnu.org; Thu, 12 Aug 2010 23:01:22 -0400 Received: by qyk29 with SMTP id 29so2365041qyk.3 for <6555@debbugs.gnu.org>; Thu, 12 Aug 2010 20:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=cbkhDCGncaGO74VT2rcCKGzi9HPESAgr9sW4XVvZ2o8=; b=WzeSwwGsu+2+zYPsumyNgtCOb0mDlHdQASn1pMy1nEvOaMXd0jhjuhutdpwbQpsF4e sOv95W8hfxCg35lJkoj9dOs9+6Mj5AlZkAGLJkhqG5D8W8zPwBrb0B8fnPYRcA4XpCLe Yl4RXzww1vM5C8H8lkP224bEfEJnG2Odd2cmQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=HTVNsI37q8iTPHHNp4BRwGMIk6IkfcuSkgQCQJ1Ko3O04M4Fmh9PSR08/jelZe0j2j oG5QtzRtMfA7MrTXBLofaHKokUDVoRbP26lERxBOJmBrinRmZu3n2borSgRcVEAsuPK0 KQI8XITuG01EgGc+75Xdk74nccbPf9EupL4VQ= Received: by 10.220.163.10 with SMTP id y10mr579861vcx.203.1281668530915; Thu, 12 Aug 2010 20:02:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.178.194 with HTTP; Thu, 12 Aug 2010 20:01:40 -0700 (PDT) In-Reply-To: References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> <87fwzvvmp3.fsf@meyering.net> From: A Burgie Date: Thu, 12 Aug 2010 21:01:40 -0600 Message-ID: Subject: Re: bug#6555: stat enhancement To: Jim Meyering Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig_Brady?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) I have received confirmation of the completion of my exciting paperwork. I can send the PDF for proof but at this point all of the legal stuff should be handled. Thanks, AB On Thu, Jul 15, 2010 at 20:08, A Burgie wrote: > Attached is the finished DIFF which I believe meets all of the > requirements. =C2=A0For notes the problem with compilation had to do with > the definition of the function in the find-mount-point.h and > find-mount-point.c files having the 'static' as part of the > definition. =C2=A0Removing that allowed compilation to continue. > Apparently in C something defined as static cannot be used outside > that C file, even if included. > > Let me know if anything else must be done. =C2=A0I started the licensing > process but have not heard back at all since I did so. > > e0abccac5fbbe1af452cc04f7980f8e7 =C2=A0DIFF0 > 140caa8e1f0e04c8daa42ced5caa0962537ae2a8 =C2=A0DIFF0 > > Thanks, > Aaron > > On Wed, Jul 7, 2010 at 19:55, A Burgie wrote: >> On Wed, Jul 7, 2010 at 00:19, Jim Meyering wrote: >>> A Burgie wrote: >>> Start by reading README* and HACKING. >>> The GNU Coding Standards has plenty of useful background info. >>> Run "info standards" or see http://www.gnu.org/prep/standards/. >>> >>> ... >>>> =C2=A0** New features >>>> >>>> + =C2=A0stat now shows the mountpoint of a specified file or directory >>>> + =C2=A0in its default output. =C2=A0It also will show this when a for= mat is >>>> + =C2=A0explicitly specified through the use of the %m specifier. >>> >>> As discussed, I'd rather not change the default output. >>> >>> =C2=A0stat can now print the mount point of a file via its new %m forma= t directive >> >> Sorry... old version of NEWS. =C2=A0It wasn't really there at the time a= nd >> will not be in the future. >> >>>> - =C2=A0du now uses less than half as much memory when operating on tr= ees >>>> - =C2=A0with many hard-linked files. =C2=A0With --count-links (-l), or= when >>>> - =C2=A0operating on trees with no hard-linked files, there is no chan= ge. >>> >>> Oops. =C2=A0Your patch would revert the two recent additions to NEWS, >>> above and below. >> >> rebasing is my friend.... rebasing is my friend. =C2=A0It'll be right by >> shipping time. >> >>>> -** Bug fixes >>>> - >>>> - =C2=A0du no longer multiply counts a file that is a directory or who= se >>>> - =C2=A0link count is 1, even if the file is reached multiple times by >>>> - =C2=A0following symlinks or via multiple arguments. >>>> >>>> =C2=A0* Noteworthy changes in release 8.5 (2010-04-23) [stable] >>>> >>>> diff --git a/doc/coreutils.texi b/doc/coreutils.texi >>>> index 21cf36d..ea3f142 100644 >>>> --- a/doc/coreutils.texi >>>> +++ b/doc/coreutils.texi >>>> @@ -10666,6 +10666,7 @@ The valid @var{format} directives for files wi= th @option{--format} and >>>> =C2=A0@item %G - Group name of owner >>>> =C2=A0@item %h - Number of hard links >>>> =C2=A0@item %i - Inode number >>>> +@item %m - Mount point >>>> =C2=A0@item %n - File name >>>> =C2=A0@item %N - Quoted file name with dereference if symbolic link >>>> =C2=A0@item %o - I/O block size >>>> diff --git a/gnulib b/gnulib >>>> --- a/gnulib >>>> +++ b/gnulib >>>> @@ -1 +1 @@ >>>> -Subproject commit 7773f84fe1aa3bb17defad704ee87f2615894ae4 >>>> +Subproject commit 7773f84fe1aa3bb17defad704ee87f2615894ae4-dirty >>>> diff --git a/src/Makefile.am b/src/Makefile.am >>>> index 0630a06..f090087 100644 >>>> --- a/src/Makefile.am >>>> +++ b/src/Makefile.am >>>> @@ -145,6 +145,7 @@ noinst_HEADERS =3D =C2=A0\ >>>> =C2=A0 =C2=A0copy.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>>> =C2=A0 =C2=A0cp-hash.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>>> =C2=A0 =C2=A0dircolors.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0\ >>>> + =C2=A0findmountpoint.h =C2=A0 \ >>>> =C2=A0 =C2=A0fs.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 \ >>>> =C2=A0 =C2=A0group-list.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 \ >>>> =C2=A0 =C2=A0ls.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 \ >>>> diff --git a/src/stat.c b/src/stat.c >>>> index c3730f0..f283437 100644 >>>> --- a/src/stat.c >>>> +++ b/src/stat.c >>>> @@ -68,6 +68,9 @@ >>>> =C2=A0#include "quotearg.h" >>>> =C2=A0#include "stat-time.h" >>>> =C2=A0#include "strftime.h" >>>> +#include "findmountpoint.h" >>> >>> nameslikethis are hard to read. >>> I prefer find-mount-point.h. >> >> Done thoughout. >> >>>> +#include "save-cwd.h" >>>> +#include "xgetcwd.h" >>>> >>>> =C2=A0#if USE_STATVFS >>>> =C2=A0# define STRUCT_STATVFS struct statvfs >>>> @@ -612,6 +615,7 @@ print_stat (char *pformat, size_t prefix_len, char= m, >>>> =C2=A0 =C2=A0struct stat *statbuf =3D (struct stat *) data; >>>> =C2=A0 =C2=A0struct passwd *pw_ent; >>>> =C2=A0 =C2=A0struct group *gw_ent; >>>> + =C2=A0char * mp; >>> >>> Remove the space-after-"*". >> >> Done. >> >>>> =C2=A0 =C2=A0bool fail =3D false; >>>> >>>> =C2=A0 =C2=A0switch (m) >>>> @@ -679,6 +683,14 @@ print_stat (char *pformat, size_t prefix_len, cha= r m, >>>> =C2=A0 =C2=A0 =C2=A0case 't': >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0out_uint_x (pformat, prefix_len, major (sta= tbuf->st_rdev)); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>> + =C2=A0 =C2=A0case 'm': >>>> + =C2=A0 =C2=A0 =C2=A0mp =3D find_mount_point (filename, statbuf); >>>> + =C2=A0 =C2=A0 =C2=A0if (mp) { >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0out_string (pformat, prefix_len, mp); >>>> + =C2=A0 =C2=A0 =C2=A0} else { >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0fail =3D true; >>>> + =C2=A0 =C2=A0 =C2=A0} >>> >>> Your brace-using style is inconsistent with the rest of the code. >>> Drop them in this case, since those are one-line "if" and "else" bodies= . >> >> Wondered about that. =C2=A0I see in HACKING it talks about this. =C2=A0F= ixed. >> >>>> + =C2=A0 =C2=A0 =C2=A0break; >>>> =C2=A0 =C2=A0 =C2=A0case 'T': >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0out_uint_x (pformat, prefix_len, minor (sta= tbuf->st_rdev)); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>> @@ -1025,6 +1037,7 @@ The valid format sequences for files (without --= file-system):\n\ >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0fputs (_("\ >>>> =C2=A0 =C2=A0%h =C2=A0 Number of hard links\n\ >>>> =C2=A0 =C2=A0%i =C2=A0 Inode number\n\ >>>> + =C2=A0%m =C2=A0 Mount point\n\ >>>> =C2=A0 =C2=A0%n =C2=A0 File name\n\ >>>> =C2=A0 =C2=A0%N =C2=A0 Quoted file name with dereference if symbolic l= ink\n\ >>>> =C2=A0 =C2=A0%o =C2=A0 I/O block size\n\ >>>> >>>> commit 70d1f1c97f322a164ee872c0399d9fbccc862b18 >>>> Author: Aaron Burgemeister >>>> Date: =C2=A0 Tue Jul 6 18:01:53 2010 -0600 >>>> >>>> =C2=A0 =C2=A0 broken-20100707000000Z >>>> >>>> diff --git a/src/findmountpoint.c b/src/findmountpoint.c >>>> new file mode 100644 >>>> index 0000000..665e2fc >>>> --- /dev/null >>>> +++ b/src/findmountpoint.c >>>> @@ -0,0 +1,93 @@ >>> >>> Every .c file must first include . >> >> Ah ha. =C2=A0I added a bit more to actually get things where they are no= w >> but that is good to know. >> >>>> +#include "save-cwd.h" >>>> +#include "xgetcwd.h" >>>> + >>>> + >>>> +/* Return the root mountpoint of the file system on which FILE exists= , in >>>> + * malloced storage. =C2=A0FILE_STAT should be the result of stating = FILE. >>>> + * Give a diagnostic and return NULL if unable to determine the mount= point. >>>> + * Exit if unable to restore current working directory. =C2=A0*/ >>> >>> We don't use this style of comment. >>> Remove the "*" on continued lines. >> >> Sorry... I copied from an example I found, I think in shred.c, though >> the second example is wrong while the first is correct. =C2=A0Noted for = the >> future and fixed. >> >>>> +static char * >>>> +find_mount_point (const char *file, const struct stat *file_stat) >>>> +{ >>>> + =C2=A0struct saved_cwd cwd; >>>> + =C2=A0struct stat last_stat; >>>> + =C2=A0char *mp =3D NULL; =C2=A0 =C2=A0/* The malloced mount point. = =C2=A0*/ >>>> + >>>> + =C2=A0if (save_cwd (&cwd) !=3D 0) >>>> + =C2=A0{ >>> >>> You have reindented this function (changing >>> the brace positioning style to be contrary to the rest of coreutils). >> >> Finally figured out about the ':set [no]paste' stuff in vi so I can >> get around this. =C2=A0Hopefully fixed once and for all. >> >>> >>> The #ifndef...#endif is supposed to span the contents of the file. >> >> Fixed, and suddenly the point of compile-time conditionals comes back to= me. >> >>>> + >>>> +/* Return the root mountpoint of the file system on which FILE exists= , in >>>> + * malloced storage. =C2=A0FILE_STAT should be the result of stating = FILE. >>>> + * Give a diagnostic and return NULL if unable to determine the mount= point. >>>> + * Exit if unable to restore current working directory. =C2=A0*/ >>> >>> Please remove this comment. >>> It duplicates the one in the .c file. >> >> Done. >> >>>> +static char * find_mount_point (const char *, const struct stat *); >> >> I think I can figure out a changelog. =C2=A0The one thing left, though, = is >> a bit less cosmetic. =C2=A0Something about my makefile (which has the tw= o >> new _SOURCES sections you suggested) is still not letting make compile >> everything properly. >> >> stat.o: In function `print_stat': >> /home/aburgemeister/code/coreutils/src/stat.c:687: undefined reference >> to `find_mount_point' >> collect2: ld returned 1 exit status >> make[3]: *** [df] Error 1 >> make[3]: Leaving directory `/home/aburgemeister/code/coreutils/src' >> make[2]: *** [all] Error 2 >> make[2]: Leaving directory `/home/aburgemeister/code/coreutils/src' >> make[1]: *** [all-recursive] Error 1 >> make[1]: Leaving directory `/home/aburgemeister/code/coreutils' >> make: *** [all] Error 2 >> > From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 18 10:13:07 2010 Received: (at 6555-done) by debbugs.gnu.org; 18 Aug 2010 14:13:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OljO6-000556-6p for submit@debbugs.gnu.org; Wed, 18 Aug 2010 10:13:06 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OljO3-00054k-88 for 6555-done@debbugs.gnu.org; Wed, 18 Aug 2010 10:13:04 -0400 Received: (qmail 550 invoked from network); 18 Aug 2010 14:14:06 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 18 Aug 2010 14:14:06 -0000 Message-ID: <4C6BEA82.6090509@draigBrady.com> Date: Wed, 18 Aug 2010 15:13:22 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: A Burgie Subject: Re: bug#6555: stat enhancement References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> <87fwzvvmp3.fsf@meyering.net> In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: multipart/mixed; boundary="------------010300060702020505010005" X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 6555-done Cc: 6555-done@debbugs.gnu.org, Jim Meyering X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) This is a multi-part message in MIME format. --------------010300060702020505010005 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 13/08/10 04:01, A Burgie wrote: > I have received confirmation of the completion of my exciting > paperwork. I can send the PDF for proof but at this point all of the > legal stuff should be handled. The attached passes `make syntax-check` I'll clean it up further and apply this evening. cheers, Pádraig. --------------010300060702020505010005 Content-Type: text/x-patch; name="stat-mnt.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="stat-mnt.diff" >From 14db051918acb83b23c2600fb880fc606fa0b65a Mon Sep 17 00:00:00 2001 From: Aaron Burgemeister Date: Thu, 15 Jul 2010 19:54:49 -0600 Subject: [PATCH] stat: add %m to output the mount point * src/find-mount-point.c: A new file refactoring find_mount_point() out from df.c * src/find-mount-point.c: Likewise. * src/df.c: Use the new find-mount-point module. * src/stat.c (print_stat): Output the mount point for %m (usage): Document %m. * src/Makefile.am: Reference the refactored find-mount-point.c * po/POTFILES.in: Add find_mount_point.c to the translation list * doc/coreutils.texi (stat invocation): Document %m * NEWS: Mention the new feature * THANKS: Add the author --- NEWS | 3 + THANKS | 1 + doc/coreutils.texi | 1 + po/POTFILES.in | 1 + src/Makefile.am | 4 ++ src/df.c | 91 +-------------------------------------- src/find-mount-point.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++++ src/find-mount-point.h | 22 +++++++++ src/stat.c | 10 ++++ 9 files changed, 155 insertions(+), 90 deletions(-) create mode 100644 src/find-mount-point.c create mode 100644 src/find-mount-point.h diff --git a/NEWS b/NEWS index ae7b839..bece07b 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,9 @@ GNU coreutils NEWS -*- outline -*- sort now supports -d, -f, -i, -R, and -V in any combination. + stat now accepts the %m format directive to output + the mount point for a file. + ** Changes in behavior du now uses less than half as much memory when operating on trees diff --git a/THANKS b/THANKS index 34b95f1..c368a2c 100644 --- a/THANKS +++ b/THANKS @@ -8,6 +8,7 @@ the bug-report mailing list (as seen on last line of e.g., cp --help). ??? kytek@cybercomm.net A Costa agcosta@gis.net +Aaron Burgemeister dajoker@gmail.com Aaron Hawley ashawley@uvm.edu Achim Blumensath blume@corona.oche.de Adam Jimerson vendion@charter.net diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 7eedec7..1453f30 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -10685,6 +10685,7 @@ The valid @var{format} directives for files with @option{--format} and @item %G - Group name of owner @item %h - Number of hard links @item %i - Inode number +@item %m - Mount point @item %n - File name @item %N - Quoted file name with dereference if symbolic link @item %o - I/O block size diff --git a/po/POTFILES.in b/po/POTFILES.in index be20f4c..673a7d9 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -61,6 +61,7 @@ src/expand.c src/expr.c src/factor.c src/false.c +src/find-mount-point.c src/fmt.c src/fold.c src/getlimits.c diff --git a/src/Makefile.am b/src/Makefile.am index 1a19fa6..00c7ff7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -145,6 +145,7 @@ noinst_HEADERS = \ copy.h \ cp-hash.h \ dircolors.h \ + find-mount-point.h \ fs.h \ group-list.h \ ls.h \ @@ -478,6 +479,9 @@ rm_SOURCES = rm.c remove.c mkdir_SOURCES = mkdir.c prog-fprintf.c rmdir_SOURCES = rmdir.c prog-fprintf.c +df_SOURCES = df.c find-mount-point.c +stat_SOURCES = stat.c find-mount-point.c + uname_SOURCES = uname.c uname-uname.c arch_SOURCES = uname.c uname-arch.c nproc_SOURCES = nproc.c diff --git a/src/df.c b/src/df.c index 76622fb..97b1637 100644 --- a/src/df.c +++ b/src/df.c @@ -29,8 +29,7 @@ #include "human.h" #include "mountlist.h" #include "quote.h" -#include "save-cwd.h" -#include "xgetcwd.h" +#include "find-mount-point.h" /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "df" @@ -522,94 +521,6 @@ show_dev (char const *disk, char const *mount_point, putchar ('\n'); } -/* Return the root mountpoint of the file system on which FILE exists, in - malloced storage. FILE_STAT should be the result of stating FILE. - Give a diagnostic and return NULL if unable to determine the mount point. - Exit if unable to restore current working directory. */ -static char * -find_mount_point (const char *file, const struct stat *file_stat) -{ - struct saved_cwd cwd; - struct stat last_stat; - char *mp = NULL; /* The malloced mount point. */ - - if (save_cwd (&cwd) != 0) - { - error (0, errno, _("cannot get current directory")); - return NULL; - } - - if (S_ISDIR (file_stat->st_mode)) - /* FILE is a directory, so just chdir there directly. */ - { - last_stat = *file_stat; - if (chdir (file) < 0) - { - error (0, errno, _("cannot change to directory %s"), quote (file)); - return NULL; - } - } - else - /* FILE is some other kind of file; use its directory. */ - { - char *xdir = dir_name (file); - char *dir; - ASSIGN_STRDUPA (dir, xdir); - free (xdir); - - if (chdir (dir) < 0) - { - error (0, errno, _("cannot change to directory %s"), quote (dir)); - return NULL; - } - - if (stat (".", &last_stat) < 0) - { - error (0, errno, _("cannot stat current directory (now %s)"), - quote (dir)); - goto done; - } - } - - /* Now walk up FILE's parents until we find another file system or /, - chdiring as we go. LAST_STAT holds stat information for the last place - we visited. */ - while (true) - { - struct stat st; - if (stat ("..", &st) < 0) - { - error (0, errno, _("cannot stat %s"), quote ("..")); - goto done; - } - if (st.st_dev != last_stat.st_dev || st.st_ino == last_stat.st_ino) - /* cwd is the mount point. */ - break; - if (chdir ("..") < 0) - { - error (0, errno, _("cannot change to directory %s"), quote ("..")); - goto done; - } - last_stat = st; - } - - /* Finally reached a mount point, see what it's called. */ - mp = xgetcwd (); - -done: - /* Restore the original cwd. */ - { - int save_errno = errno; - if (restore_cwd (&cwd) != 0) - error (EXIT_FAILURE, errno, - _("failed to return to initial working directory")); - free_cwd (&cwd); - errno = save_errno; - } - - return mp; -} - /* If DISK corresponds to a mount point, show its usage and return true. Otherwise, return false. */ static bool diff --git a/src/find-mount-point.c b/src/find-mount-point.c new file mode 100644 index 0000000..289d23e --- /dev/null +++ b/src/find-mount-point.c @@ -0,0 +1,112 @@ +/* find-mount-point.c -- find the root mount point for a file. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +#include "system.h" +#include "error.h" +#include "quote.h" +#include "save-cwd.h" +#include "xgetcwd.h" +#include "find-mount-point.h" + +/* Return the root mountpoint of the file system on which FILE exists, in + malloced storage. FILE_STAT should be the result of stating FILE. + Give a diagnostic and return NULL if unable to determine the mount point. + Exit if unable to restore current working directory. */ +extern char * +find_mount_point (const char *file, const struct stat *file_stat) +{ + struct saved_cwd cwd; + struct stat last_stat; + char *mp = NULL; /* The malloced mount point. */ + + if (save_cwd (&cwd) != 0) + { + error (0, errno, _("cannot get current directory")); + return NULL; + } + + if (S_ISDIR (file_stat->st_mode)) + /* FILE is a directory, so just chdir there directly. */ + { + last_stat = *file_stat; + if (chdir (file) < 0) + { + error (0, errno, _("cannot change to directory %s"), quote (file)); + return NULL; + } + } + else + /* FILE is some other kind of file; use its directory. */ + { + char *xdir = dir_name (file); + char *dir; + ASSIGN_STRDUPA (dir, xdir); + free (xdir); + + if (chdir (dir) < 0) + { + error (0, errno, _("cannot change to directory %s"), quote (dir)); + return NULL; + } + + if (stat (".", &last_stat) < 0) + { + error (0, errno, _("cannot stat current directory (now %s)"), + quote (dir)); + goto done; + } + } + + /* Now walk up FILE's parents until we find another file system or /, + chdiring as we go. LAST_STAT holds stat information for the last place + we visited. */ + while (true) + { + struct stat st; + if (stat ("..", &st) < 0) + { + error (0, errno, _("cannot stat %s"), quote ("..")); + goto done; + } + if (st.st_dev != last_stat.st_dev || st.st_ino == last_stat.st_ino) + /* cwd is the mount point. */ + break; + if (chdir ("..") < 0) + { + error (0, errno, _("cannot change to directory %s"), quote ("..")); + goto done; + } + last_stat = st; + } + + /* Finally reached a mount point, see what it's called. */ + mp = xgetcwd (); + +done: + /* Restore the original cwd. */ + { + int save_errno = errno; + if (restore_cwd (&cwd) != 0) + error (EXIT_FAILURE, errno, + _("failed to return to initial working directory")); + free_cwd (&cwd); + errno = save_errno; + } + + return mp; +} diff --git a/src/find-mount-point.h b/src/find-mount-point.h new file mode 100644 index 0000000..a97c57f --- /dev/null +++ b/src/find-mount-point.h @@ -0,0 +1,22 @@ +/* find-mount-point.h -- find the root mount point for a file. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef FINDMOUNTPOINT_H +#define FINDMOUNTPOINT_H 1 + +extern char* find_mount_point (const char *, const struct stat *); + +#endif diff --git a/src/stat.c b/src/stat.c index c3730f0..6fb2999 100644 --- a/src/stat.c +++ b/src/stat.c @@ -68,6 +68,7 @@ #include "quotearg.h" #include "stat-time.h" #include "strftime.h" +#include "find-mount-point.h" #if USE_STATVFS # define STRUCT_STATVFS struct statvfs @@ -612,6 +613,7 @@ print_stat (char *pformat, size_t prefix_len, char m, struct stat *statbuf = (struct stat *) data; struct passwd *pw_ent; struct group *gw_ent; + char *mp; bool fail = false; switch (m) @@ -679,6 +681,13 @@ print_stat (char *pformat, size_t prefix_len, char m, case 't': out_uint_x (pformat, prefix_len, major (statbuf->st_rdev)); break; + case 'm': + mp = find_mount_point (filename, statbuf); + if (mp) + out_string (pformat, prefix_len, mp); + else + fail = true; + break; case 'T': out_uint_x (pformat, prefix_len, minor (statbuf->st_rdev)); break; @@ -1025,6 +1034,7 @@ The valid format sequences for files (without --file-system):\n\ fputs (_("\ %h Number of hard links\n\ %i Inode number\n\ + %m Mount point\n\ %n File name\n\ %N Quoted file name with dereference if symbolic link\n\ %o I/O block size\n\ -- 1.6.2.5 --------------010300060702020505010005-- From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 18 19:45:24 2010 Received: (at 6555) by debbugs.gnu.org; 18 Aug 2010 23:45:24 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OlsJu-0000Sh-Bw for submit@debbugs.gnu.org; Wed, 18 Aug 2010 19:45:23 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OlsJr-0000Sc-CS for 6555@debbugs.gnu.org; Wed, 18 Aug 2010 19:45:21 -0400 Received: (qmail 89427 invoked from network); 18 Aug 2010 23:46:23 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 18 Aug 2010 23:46:23 -0000 Message-ID: <4C6C70A1.4070301@draigBrady.com> Date: Thu, 19 Aug 2010 00:45:37 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: A Burgie Subject: Re: bug#6555: stat enhancement References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> <87fwzvvmp3.fsf@meyering.net> In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: multipart/mixed; boundary="------------080508060907050709000202" X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, Jim Meyering X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) This is a multi-part message in MIME format. --------------080508060907050709000202 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 13/08/10 04:01, A Burgie wrote: > I have received confirmation of the completion of my exciting > paperwork. I can send the PDF for proof but at this point all of the > legal stuff should be handled. I updated the patch further, adding a test, and fixing a small mem leak in print_stat(). However I'm wary about pushing as I'm worried about bypassing most of the logic from df::show_point(). I.E. do we lose anything by not using read_file_system_list()? cheers, Pádraig. --------------080508060907050709000202 Content-Type: text/x-patch; name="stat-mnt.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="stat-mnt.diff" >From 8f61cca9325d54fbc7ef30d23394d0f3a536dd1f Mon Sep 17 00:00:00 2001 From: Aaron Burgemeister Date: Thu, 15 Jul 2010 19:54:49 -0600 Subject: [PATCH] stat: add %m to output the mount point for a file * src/find-mount-point.c: A new file refactoring find_mount_point() out from df.c * src/find-mount-point.h: Likewise. * src/df.c: Use the new find-mount-point module. * src/stat.c (print_stat): Using the new module, output the mount point for the new %m format directive. (usage): Document the %m format directive. * src/Makefile.am: Reference the refactored find-mount-point.c * po/POTFILES.in: Add find_mount_point.c to the translation list * doc/coreutils.texi (stat invocation): Document %m * test/misc/stat-mount: A new test to correlate mount points output from df and stat. * tests/Makefile.am: Reference the new test. * NEWS: Mention the new feature * THANKS: Add the author --- NEWS | 3 + THANKS | 1 + doc/coreutils.texi | 1 + po/POTFILES.in | 1 + src/Makefile.am | 4 ++ src/df.c | 91 +-------------------------------------- src/find-mount-point.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++ src/find-mount-point.h | 17 +++++++ src/stat.c | 13 ++++++ tests/Makefile.am | 1 + tests/misc/stat-mount | 27 +++++++++++ 11 files changed, 182 insertions(+), 90 deletions(-) create mode 100644 src/find-mount-point.c create mode 100644 src/find-mount-point.h create mode 100755 tests/misc/stat-mount diff --git a/NEWS b/NEWS index ae7b839..bece07b 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,9 @@ GNU coreutils NEWS -*- outline -*- sort now supports -d, -f, -i, -R, and -V in any combination. + stat now accepts the %m format directive to output + the mount point for a file. + ** Changes in behavior du now uses less than half as much memory when operating on trees diff --git a/THANKS b/THANKS index 34b95f1..c368a2c 100644 --- a/THANKS +++ b/THANKS @@ -8,6 +8,7 @@ the bug-report mailing list (as seen on last line of e.g., cp --help). ??? kytek@cybercomm.net A Costa agcosta@gis.net +Aaron Burgemeister dajoker@gmail.com Aaron Hawley ashawley@uvm.edu Achim Blumensath blume@corona.oche.de Adam Jimerson vendion@charter.net diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 7eedec7..1453f30 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -10685,6 +10685,7 @@ The valid @var{format} directives for files with @option{--format} and @item %G - Group name of owner @item %h - Number of hard links @item %i - Inode number +@item %m - Mount point @item %n - File name @item %N - Quoted file name with dereference if symbolic link @item %o - I/O block size diff --git a/po/POTFILES.in b/po/POTFILES.in index be20f4c..673a7d9 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -61,6 +61,7 @@ src/expand.c src/expr.c src/factor.c src/false.c +src/find-mount-point.c src/fmt.c src/fold.c src/getlimits.c diff --git a/src/Makefile.am b/src/Makefile.am index 1a19fa6..00c7ff7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -145,6 +145,7 @@ noinst_HEADERS = \ copy.h \ cp-hash.h \ dircolors.h \ + find-mount-point.h \ fs.h \ group-list.h \ ls.h \ @@ -478,6 +479,9 @@ rm_SOURCES = rm.c remove.c mkdir_SOURCES = mkdir.c prog-fprintf.c rmdir_SOURCES = rmdir.c prog-fprintf.c +df_SOURCES = df.c find-mount-point.c +stat_SOURCES = stat.c find-mount-point.c + uname_SOURCES = uname.c uname-uname.c arch_SOURCES = uname.c uname-arch.c nproc_SOURCES = nproc.c diff --git a/src/df.c b/src/df.c index 76622fb..97b1637 100644 --- a/src/df.c +++ b/src/df.c @@ -29,8 +29,7 @@ #include "human.h" #include "mountlist.h" #include "quote.h" -#include "save-cwd.h" -#include "xgetcwd.h" +#include "find-mount-point.h" /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "df" @@ -522,94 +521,6 @@ show_dev (char const *disk, char const *mount_point, putchar ('\n'); } -/* Return the root mountpoint of the file system on which FILE exists, in - malloced storage. FILE_STAT should be the result of stating FILE. - Give a diagnostic and return NULL if unable to determine the mount point. - Exit if unable to restore current working directory. */ -static char * -find_mount_point (const char *file, const struct stat *file_stat) -{ - struct saved_cwd cwd; - struct stat last_stat; - char *mp = NULL; /* The malloced mount point. */ - - if (save_cwd (&cwd) != 0) - { - error (0, errno, _("cannot get current directory")); - return NULL; - } - - if (S_ISDIR (file_stat->st_mode)) - /* FILE is a directory, so just chdir there directly. */ - { - last_stat = *file_stat; - if (chdir (file) < 0) - { - error (0, errno, _("cannot change to directory %s"), quote (file)); - return NULL; - } - } - else - /* FILE is some other kind of file; use its directory. */ - { - char *xdir = dir_name (file); - char *dir; - ASSIGN_STRDUPA (dir, xdir); - free (xdir); - - if (chdir (dir) < 0) - { - error (0, errno, _("cannot change to directory %s"), quote (dir)); - return NULL; - } - - if (stat (".", &last_stat) < 0) - { - error (0, errno, _("cannot stat current directory (now %s)"), - quote (dir)); - goto done; - } - } - - /* Now walk up FILE's parents until we find another file system or /, - chdiring as we go. LAST_STAT holds stat information for the last place - we visited. */ - while (true) - { - struct stat st; - if (stat ("..", &st) < 0) - { - error (0, errno, _("cannot stat %s"), quote ("..")); - goto done; - } - if (st.st_dev != last_stat.st_dev || st.st_ino == last_stat.st_ino) - /* cwd is the mount point. */ - break; - if (chdir ("..") < 0) - { - error (0, errno, _("cannot change to directory %s"), quote ("..")); - goto done; - } - last_stat = st; - } - - /* Finally reached a mount point, see what it's called. */ - mp = xgetcwd (); - -done: - /* Restore the original cwd. */ - { - int save_errno = errno; - if (restore_cwd (&cwd) != 0) - error (EXIT_FAILURE, errno, - _("failed to return to initial working directory")); - free_cwd (&cwd); - errno = save_errno; - } - - return mp; -} - /* If DISK corresponds to a mount point, show its usage and return true. Otherwise, return false. */ static bool diff --git a/src/find-mount-point.c b/src/find-mount-point.c new file mode 100644 index 0000000..f3a2074 --- /dev/null +++ b/src/find-mount-point.c @@ -0,0 +1,113 @@ +/* find-mount-point.c -- find the root mount point for a file. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include +#include + +#include "system.h" +#include "error.h" +#include "quote.h" +#include "save-cwd.h" +#include "xgetcwd.h" +#include "find-mount-point.h" + +/* Return the root mountpoint of the file system on which FILE exists, in + malloced storage. FILE_STAT should be the result of stating FILE. + Give a diagnostic and return NULL if unable to determine the mount point. + Exit if unable to restore current working directory. */ +extern char * +find_mount_point (const char *file, const struct stat *file_stat) +{ + struct saved_cwd cwd; + struct stat last_stat; + char *mp = NULL; /* The malloced mount point. */ + + if (save_cwd (&cwd) != 0) + { + error (0, errno, _("cannot get current directory")); + return NULL; + } + + if (S_ISDIR (file_stat->st_mode)) + /* FILE is a directory, so just chdir there directly. */ + { + last_stat = *file_stat; + if (chdir (file) < 0) + { + error (0, errno, _("cannot change to directory %s"), quote (file)); + return NULL; + } + } + else + /* FILE is some other kind of file; use its directory. */ + { + char *xdir = dir_name (file); + char *dir; + ASSIGN_STRDUPA (dir, xdir); + free (xdir); + + if (chdir (dir) < 0) + { + error (0, errno, _("cannot change to directory %s"), quote (dir)); + return NULL; + } + + if (stat (".", &last_stat) < 0) + { + error (0, errno, _("cannot stat current directory (now %s)"), + quote (dir)); + goto done; + } + } + + /* Now walk up FILE's parents until we find another file system or /, + chdiring as we go. LAST_STAT holds stat information for the last place + we visited. */ + while (true) + { + struct stat st; + if (stat ("..", &st) < 0) + { + error (0, errno, _("cannot stat %s"), quote ("..")); + goto done; + } + if (st.st_dev != last_stat.st_dev || st.st_ino == last_stat.st_ino) + /* cwd is the mount point. */ + break; + if (chdir ("..") < 0) + { + error (0, errno, _("cannot change to directory %s"), quote ("..")); + goto done; + } + last_stat = st; + } + + /* Finally reached a mount point, see what it's called. */ + mp = xgetcwd (); + +done: + /* Restore the original cwd. */ + { + int save_errno = errno; + if (restore_cwd (&cwd) != 0) + error (EXIT_FAILURE, errno, + _("failed to return to initial working directory")); + free_cwd (&cwd); + errno = save_errno; + } + + return mp; +} diff --git a/src/find-mount-point.h b/src/find-mount-point.h new file mode 100644 index 0000000..49be9ba --- /dev/null +++ b/src/find-mount-point.h @@ -0,0 +1,17 @@ +/* find-mount-point.h -- find the root mount point for a file. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +extern char* find_mount_point (const char *, const struct stat *); diff --git a/src/stat.c b/src/stat.c index c3730f0..a75b83e 100644 --- a/src/stat.c +++ b/src/stat.c @@ -68,6 +68,7 @@ #include "quotearg.h" #include "stat-time.h" #include "strftime.h" +#include "find-mount-point.h" #if USE_STATVFS # define STRUCT_STATVFS struct statvfs @@ -612,6 +613,7 @@ print_stat (char *pformat, size_t prefix_len, char m, struct stat *statbuf = (struct stat *) data; struct passwd *pw_ent; struct group *gw_ent; + char *mp; bool fail = false; switch (m) @@ -679,6 +681,16 @@ print_stat (char *pformat, size_t prefix_len, char m, case 't': out_uint_x (pformat, prefix_len, major (statbuf->st_rdev)); break; + case 'm': + mp = find_mount_point (filename, statbuf); + if (mp) + { + out_string (pformat, prefix_len, mp); + free (mp); + } + else + fail = true; + break; case 'T': out_uint_x (pformat, prefix_len, minor (statbuf->st_rdev)); break; @@ -1025,6 +1037,7 @@ The valid format sequences for files (without --file-system):\n\ fputs (_("\ %h Number of hard links\n\ %i Inode number\n\ + %m Mount point\n\ %n File name\n\ %N Quoted file name with dereference if symbolic link\n\ %o I/O block size\n\ diff --git a/tests/Makefile.am b/tests/Makefile.am index 4aa93bf..5619d0b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -241,6 +241,7 @@ TESTS = \ misc/split-l \ misc/stat-fmt \ misc/stat-hyphen \ + misc/stat-mount \ misc/stat-printf \ misc/stat-slash \ misc/stdbuf \ diff --git a/tests/misc/stat-mount b/tests/misc/stat-mount new file mode 100755 index 0000000..99e29cb --- /dev/null +++ b/tests/misc/stat-mount @@ -0,0 +1,27 @@ +#!/bin/sh +# Test stat -c%m + +# Copyright (C) 2010 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + + +df_mnt=$(df -P . | sed -n '2s/.* \([^ ]*$\)/\1/p') +stat_mnt=$(stat -c%m .) + +test "$df_mnt" = "$stat_mnt" || fail=1 + +Exit $fail -- 1.6.2.5 --------------080508060907050709000202-- From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 11:24:00 2010 Received: (at 6555) by debbugs.gnu.org; 19 Aug 2010 15:24:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om6yF-0007QG-PJ for submit@debbugs.gnu.org; Thu, 19 Aug 2010 11:24:00 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om6y4-0007Q9-JQ for 6555@debbugs.gnu.org; Thu, 19 Aug 2010 11:23:57 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id E8DC3940145 for <6555@debbugs.gnu.org>; Thu, 19 Aug 2010 17:24:50 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 97496E9A; Thu, 19 Aug 2010 17:24:49 +0200 (CEST) From: Jim Meyering To: =?utf-8?Q?P=C3=A1draig?= Brady Subject: Re: bug#6555: stat enhancement In-Reply-To: <4C6C70A1.4070301@draigBrady.com> (=?utf-8?Q?=22P=C3=A1draig?= Brady"'s message of "Thu, 19 Aug 2010 00:45:37 +0100") References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> <87fwzvvmp3.fsf@meyering.net> <4C6C70A1.4070301@draigBrady.com> Date: Thu, 19 Aug 2010 17:24:49 +0200 Message-ID: <87occylj5q.fsf@meyering.net> Lines: 23 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, A Burgie X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) P=C3=A1draig Brady wrote: > On 13/08/10 04:01, A Burgie wrote: >> I have received confirmation of the completion of my exciting >> paperwork. I can send the PDF for proof but at this point all of the >> legal stuff should be handled. > > I updated the patch further, adding a test, > and fixing a small mem leak in print_stat(). > However I'm wary about pushing as I'm worried > about bypassing most of the logic from df::show_point(). > I.E. do we lose anything by not using read_file_system_list()? Hi P=C3=A1draig and Aaron, That patch looks fine. Thanks to both of you! I noticed that there is a semantic difference with df. Running "df symlink-to-dir" works like "df dir", while "stat --format=3D%m symlink-to-dir" operates on the symlink, not on the directory. That does seem to be the proper default, given stat's --dereference (-L) option (which I confirmed does work fine). It might be worth adding a note in the texinfo doc that people looking for df-like semantics from %m should use --dereference (-L). From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 11:51:34 2010 Received: (at 6555) by debbugs.gnu.org; 19 Aug 2010 15:51:34 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om7Ow-0007cT-3c for submit@debbugs.gnu.org; Thu, 19 Aug 2010 11:51:34 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Om7Ot-0007cO-P0 for 6555@debbugs.gnu.org; Thu, 19 Aug 2010 11:51:32 -0400 Received: (qmail 43751 invoked from network); 19 Aug 2010 15:52:38 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 19 Aug 2010 15:52:38 -0000 Message-ID: <4C6D5314.7080607@draigBrady.com> Date: Thu, 19 Aug 2010 16:51:48 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Jim Meyering Subject: Re: bug#6555: stat enhancement References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> <87fwzvvmp3.fsf@meyering.net> <4C6C70A1.4070301@draigBrady.com> <87occylj5q.fsf@meyering.net> In-Reply-To: <87occylj5q.fsf@meyering.net> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org, A Burgie X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On 19/08/10 16:24, Jim Meyering wrote: > Pádraig Brady wrote: >> On 13/08/10 04:01, A Burgie wrote: >>> I have received confirmation of the completion of my exciting >>> paperwork. I can send the PDF for proof but at this point all of the >>> legal stuff should be handled. >> >> I updated the patch further, adding a test, >> and fixing a small mem leak in print_stat(). >> However I'm wary about pushing as I'm worried >> about bypassing most of the logic from df::show_point(). >> I.E. do we lose anything by not using read_file_system_list()? > > Hi Pádraig and Aaron, > That patch looks fine. Thanks to both of you! > > I noticed that there is a semantic difference with df. Running > "df symlink-to-dir" works like "df dir", while "stat --format=%m > symlink-to-dir" operates on the symlink, not on the directory. That does > seem to be the proper default, given stat's --dereference (-L) option > (which I confirmed does work fine). > > It might be worth adding a note in the texinfo doc that people looking > for df-like semantics from %m should use --dereference (-L). I also noticed differences with /dev/nodes. That's probably ok though, but would need to be documented: $ stat -c%m /dev/sda3 /dev $ df -P /dev/sda3 | sed -n '1!s/.* \([^ ]*$\)/\1/p' /boot I also noticed differences with bind mounts though, which I need to look into further. There are also comments in df::show_point() to indicate find_mount_points() is only a fall back and may hang. Perhaps we need to move more of show_point() to `stat`? $ mkdir tdir $ touch tfile $ sudo mount --bind /dev/shm/ tdir $ touch tdir/tfile $ sudo mount --bind /dev/shm/tfile tfile $ df -P tfile tdir/ tdir/tfile | sed -n '1!s/.* \([^ ]*$\)/\1/p' /dev/shm /dev/shm /dev/shm $ stat -c%m tfile tdir/ tdir/tfile /old_home /old_home/padraig/git/tdir /old_home/padraig/git/tdir BTW, I updated the patch to output '?' when find_mount_point() == NULL cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 23 15:18:45 2010 Received: (at 6555) by debbugs.gnu.org; 23 Aug 2010 19:18:46 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OncXc-0002CI-QR for submit@debbugs.gnu.org; Mon, 23 Aug 2010 15:18:45 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OncXa-0002CA-7O for 6555@debbugs.gnu.org; Mon, 23 Aug 2010 15:18:43 -0400 Received: (qmail 70970 invoked from network); 23 Aug 2010 19:19:59 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 23 Aug 2010 19:19:59 -0000 Message-ID: <4C72C999.2050408@draigBrady.com> Date: Mon, 23 Aug 2010 20:18:49 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: A Burgie Subject: Re: bug#6555: stat enhancement References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> <87fwzvvmp3.fsf@meyering.net> <4C6C70A1.4070301@draigBrady.com> <87occylj5q.fsf@meyering.net> <4C6D5314.7080607@draigBrady.com> In-Reply-To: <4C6D5314.7080607@draigBrady.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On 19/08/10 16:51, Pádraig Brady wrote: > I also noticed differences with bind mounts though, > which I need to look into further. > There are also comments in df::show_point() to > indicate find_mount_points() is only a fall back and > may hang. Perhaps we need to move more of show_point() > to `stat`? Looking more at correlating `statm -c%m file` and `df -P file`, I noticed an inconsistency with how df deals with bind mounts. Take for example: $ mount | column -t /dev/shm/tdir on /old_home/padraig/git/tdir /old_home/padraig/git/tfile on /dev/shm/tdir/tfile I.E. /old_home/padraig/git/tdir is replaced by /dev/shm/tdir and /dev/shm/tdir/tfile is replaced by /old_home/padraig/git/tfile Now if we pass an already canonicalized absolute path to the mount target to df, we get inconsistent results: ~/git$ df -Ph tfile /dev/shm/tdir//tfile /dev/shm/tdir/tfile Filesystem Size Used Avail Use% Mounted on /dev/sda8 37G 34G 3.0G 92% /old_home /dev/sda8 37G 34G 3.0G 92% /old_home /dev/sda8 37G 34G 3.0G 92% /old_home /old_home/padraig/git/tfile 37G 34G 3.0G 92% /dev/shm/tdir/tfile $ df -Ph tdir /old_home/padraig/git/tdir/ /old_home/padraig/git/tdir Filesystem Size Used Avail Use% Mounted on tmpfs 1004M 272K 1003M 1% /dev/shm tmpfs 1004M 272K 1003M 1% /dev/shm /dev/shm/tdir 1004M 272K 1003M 1% /old_home/padraig/git/tdir I think that df should resolve to disk devices if possible. I.E. the last line output in each of the above 2 commands above is inconsistent and a bit confusing IMHO. This patch removes the optimization which triggers this. diff --git a/src/df.c b/src/df.c index 76622fb..24877ab 100644 --- a/src/df.c +++ b/src/df.c @@ -643,54 +643,35 @@ show_point (const char *point, const struct stat *statp) struct mount_entry *me; struct mount_entry const *best_match = NULL; - /* If POINT is an absolute file name, see if we can find the - mount point without performing any extra stat calls at all. */ - if (*point == '/') - { - /* Find the best match: prefer non-dummies, and then prefer the - last match if there are ties. */ - - for (me = mount_list; me; me = me->me_next) - if (STREQ (me->me_mountdir, point) && !STREQ (me->me_type, "lofs") - && (!best_match || best_match->me_dummy || !me->me_dummy)) - best_match = me; - } Note now that we have `stat -c%m`, that seems a more appropriate place to output an aliased target if present, like: ~/git$ stat -c%m tdir /old_home/padraig/git/tdir/ /dev/shm/tdir /dev/shm/tdir /dev/shm/tdir /dev/shm cheers, Pádraig. p.s. I'll also update NEWS with the changed behavior if I apply the above From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 25 17:54:36 2010 Received: (at 6555) by debbugs.gnu.org; 25 Aug 2010 21:54:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OoNvX-0003ET-Vf for submit@debbugs.gnu.org; Wed, 25 Aug 2010 17:54:36 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OoNvU-0003EO-A2 for 6555@debbugs.gnu.org; Wed, 25 Aug 2010 17:54:34 -0400 Received: (qmail 53690 invoked from network); 25 Aug 2010 21:55:54 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 25 Aug 2010 21:55:54 -0000 Message-ID: <4C75911A.3030001@draigBrady.com> Date: Wed, 25 Aug 2010 22:54:34 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: A Burgie Subject: Re: bug#6555: stat enhancement References: <4C31CA1F.9070002@draigBrady.com> <87hbke14d0.fsf@meyering.net> <87y6dqyr56.fsf@meyering.net> <87sk3yymoc.fsf@meyering.net> <87mxu6ylzc.fsf@meyering.net> <87r5jguuiq.fsf@meyering.net> <87fwzvvmp3.fsf@meyering.net> <4C6C70A1.4070301@draigBrady.com> <87occylj5q.fsf@meyering.net> <4C6D5314.7080607@draigBrady.com> <4C72C999.2050408@draigBrady.com> In-Reply-To: <4C72C999.2050408@draigBrady.com> X-Enigmail-Version: 1.0.1 Content-Type: multipart/mixed; boundary="------------070508080709080001020609" X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 6555 Cc: 6555@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) This is a multi-part message in MIME format. --------------070508080709080001020609 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As a follow up to df not outputting bind mounts, here is the amended stat -c%m patch than _does_ resolve bind mounts. I was mulling over an option to output the mount point of the base device for a file, but one can just use df -P for that now, or run stat in a loop like: mp=; lp=/your/file/name while [ "$lp" != "$mp" ]; do mp=$lp; lp=$(./src/stat -c%m "$mp") done echo $lp Some example output in the presence of bind mounts: $ mount | column -t | grep git /dev/shm/tdir on /home/padraig/git/tdir /home/padraig/git/tfile on /dev/shm/tdir/tfile /home/padraig/git/t/coreutils/t/1 on /home/padraig/git/t/coreutils/t/2 /home/padraig/git/t/coreutils/t/1 on /home/padraig/git/t/coreutils/t/3 /home/padraig/git/t/coreutils/t/f on /home/padraig/git/t/coreutils/t/bf ~/git/t/coreutils$ ./src/stat -c%m /home/padraig/git/tdir/tfile /dev/shm/tdir/tfile t/2 t /dev/shm/tdir /home/padraig/git/tfile /home/padraig/git/t/coreutils/t/1 /home cheers, Pádraig. --------------070508080709080001020609 Content-Type: text/x-patch; name="stat-mnt.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="stat-mnt.diff" >From b2b55d54582e6ca9895461f20adbc979d492291f Mon Sep 17 00:00:00 2001 From: Aaron Burgemeister Date: Thu, 15 Jul 2010 19:54:49 -0600 Subject: [PATCH] stat: add %m to output the mount point for a file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit * src/find-mount-point.c: A new file refactoring find_mount_point() out from df.c * src/find-mount-point.h: Likewise. * src/df.c: Use the new find-mount-point module. * src/stat.c (print_stat): Using the new module, output the mount point for the new %m format directive. * src/stat.c (find_bind_mount): A new function to return the bind mount for a file if any. (usage): Document the %m format directive. * src/Makefile.am: Reference the refactored find-mount-point.c * po/POTFILES.in: Add find_mount_point.c to the translation list * doc/coreutils.texi (stat invocation): Document %m * test/misc/stat-mount: A new test to correlate mount points output from df and stat. * tests/Makefile.am: Reference the new test. * NEWS: Mention the new feature * THANKS: Add the author Signed-off-by: Pádraig Brady --- NEWS | 3 + THANKS | 1 + doc/coreutils.texi | 12 +++++ po/POTFILES.in | 1 + src/Makefile.am | 4 ++ src/df.c | 91 +-------------------------------------- src/find-mount-point.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++ src/find-mount-point.h | 17 +++++++ src/stat.c | 93 +++++++++++++++++++++++++++++++++++++++ tests/Makefile.am | 1 + tests/misc/stat-mount | 27 +++++++++++ 11 files changed, 273 insertions(+), 90 deletions(-) create mode 100644 src/find-mount-point.c create mode 100644 src/find-mount-point.h create mode 100755 tests/misc/stat-mount diff --git a/NEWS b/NEWS index ae7b839..bece07b 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,9 @@ GNU coreutils NEWS -*- outline -*- sort now supports -d, -f, -i, -R, and -V in any combination. + stat now accepts the %m format directive to output + the mount point for a file. + ** Changes in behavior du now uses less than half as much memory when operating on trees diff --git a/THANKS b/THANKS index 34b95f1..c368a2c 100644 --- a/THANKS +++ b/THANKS @@ -8,6 +8,7 @@ the bug-report mailing list (as seen on last line of e.g., cp --help). ??? kytek@cybercomm.net A Costa agcosta@gis.net +Aaron Burgemeister dajoker@gmail.com Aaron Hawley ashawley@uvm.edu Achim Blumensath blume@corona.oche.de Adam Jimerson vendion@charter.net diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 7eedec7..9a3bd95 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -10685,6 +10685,7 @@ The valid @var{format} directives for files with @option{--format} and @item %G - Group name of owner @item %h - Number of hard links @item %i - Inode number +@item %m - Mount point (See note below) @item %n - File name @item %N - Quoted file name with dereference if symbolic link @item %o - I/O block size @@ -10701,6 +10702,17 @@ The valid @var{format} directives for files with @option{--format} and @item %Z - Time of last change as seconds since Epoch @end itemize +The mount point printed by @samp{%m} is similar to that output +by @command{df}, except that: +@itemize @bullet +@item stat does not dereference symlinks +by default (unless @option{-L} is specified) +@item stat does not search for specified device nodes in the +file system list, instead operating on them directly +@item stat outputs the aliased target of a bind mounted file, +rather than its backing device +@end itemize + When listing file system information (@option{--file-system} (@option{-f})), you must use a different set of @var{format} directives: diff --git a/po/POTFILES.in b/po/POTFILES.in index be20f4c..673a7d9 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -61,6 +61,7 @@ src/expand.c src/expr.c src/factor.c src/false.c +src/find-mount-point.c src/fmt.c src/fold.c src/getlimits.c diff --git a/src/Makefile.am b/src/Makefile.am index 1a19fa6..00c7ff7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -145,6 +145,7 @@ noinst_HEADERS = \ copy.h \ cp-hash.h \ dircolors.h \ + find-mount-point.h \ fs.h \ group-list.h \ ls.h \ @@ -478,6 +479,9 @@ rm_SOURCES = rm.c remove.c mkdir_SOURCES = mkdir.c prog-fprintf.c rmdir_SOURCES = rmdir.c prog-fprintf.c +df_SOURCES = df.c find-mount-point.c +stat_SOURCES = stat.c find-mount-point.c + uname_SOURCES = uname.c uname-uname.c arch_SOURCES = uname.c uname-arch.c nproc_SOURCES = nproc.c diff --git a/src/df.c b/src/df.c index 76622fb..97b1637 100644 --- a/src/df.c +++ b/src/df.c @@ -29,8 +29,7 @@ #include "human.h" #include "mountlist.h" #include "quote.h" -#include "save-cwd.h" -#include "xgetcwd.h" +#include "find-mount-point.h" /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "df" @@ -522,94 +521,6 @@ show_dev (char const *disk, char const *mount_point, putchar ('\n'); } -/* Return the root mountpoint of the file system on which FILE exists, in - malloced storage. FILE_STAT should be the result of stating FILE. - Give a diagnostic and return NULL if unable to determine the mount point. - Exit if unable to restore current working directory. */ -static char * -find_mount_point (const char *file, const struct stat *file_stat) -{ - struct saved_cwd cwd; - struct stat last_stat; - char *mp = NULL; /* The malloced mount point. */ - - if (save_cwd (&cwd) != 0) - { - error (0, errno, _("cannot get current directory")); - return NULL; - } - - if (S_ISDIR (file_stat->st_mode)) - /* FILE is a directory, so just chdir there directly. */ - { - last_stat = *file_stat; - if (chdir (file) < 0) - { - error (0, errno, _("cannot change to directory %s"), quote (file)); - return NULL; - } - } - else - /* FILE is some other kind of file; use its directory. */ - { - char *xdir = dir_name (file); - char *dir; - ASSIGN_STRDUPA (dir, xdir); - free (xdir); - - if (chdir (dir) < 0) - { - error (0, errno, _("cannot change to directory %s"), quote (dir)); - return NULL; - } - - if (stat (".", &last_stat) < 0) - { - error (0, errno, _("cannot stat current directory (now %s)"), - quote (dir)); - goto done; - } - } - - /* Now walk up FILE's parents until we find another file system or /, - chdiring as we go. LAST_STAT holds stat information for the last place - we visited. */ - while (true) - { - struct stat st; - if (stat ("..", &st) < 0) - { - error (0, errno, _("cannot stat %s"), quote ("..")); - goto done; - } - if (st.st_dev != last_stat.st_dev || st.st_ino == last_stat.st_ino) - /* cwd is the mount point. */ - break; - if (chdir ("..") < 0) - { - error (0, errno, _("cannot change to directory %s"), quote ("..")); - goto done; - } - last_stat = st; - } - - /* Finally reached a mount point, see what it's called. */ - mp = xgetcwd (); - -done: - /* Restore the original cwd. */ - { - int save_errno = errno; - if (restore_cwd (&cwd) != 0) - error (EXIT_FAILURE, errno, - _("failed to return to initial working directory")); - free_cwd (&cwd); - errno = save_errno; - } - - return mp; -} - /* If DISK corresponds to a mount point, show its usage and return true. Otherwise, return false. */ static bool diff --git a/src/find-mount-point.c b/src/find-mount-point.c new file mode 100644 index 0000000..f3a2074 --- /dev/null +++ b/src/find-mount-point.c @@ -0,0 +1,113 @@ +/* find-mount-point.c -- find the root mount point for a file. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include +#include + +#include "system.h" +#include "error.h" +#include "quote.h" +#include "save-cwd.h" +#include "xgetcwd.h" +#include "find-mount-point.h" + +/* Return the root mountpoint of the file system on which FILE exists, in + malloced storage. FILE_STAT should be the result of stating FILE. + Give a diagnostic and return NULL if unable to determine the mount point. + Exit if unable to restore current working directory. */ +extern char * +find_mount_point (const char *file, const struct stat *file_stat) +{ + struct saved_cwd cwd; + struct stat last_stat; + char *mp = NULL; /* The malloced mount point. */ + + if (save_cwd (&cwd) != 0) + { + error (0, errno, _("cannot get current directory")); + return NULL; + } + + if (S_ISDIR (file_stat->st_mode)) + /* FILE is a directory, so just chdir there directly. */ + { + last_stat = *file_stat; + if (chdir (file) < 0) + { + error (0, errno, _("cannot change to directory %s"), quote (file)); + return NULL; + } + } + else + /* FILE is some other kind of file; use its directory. */ + { + char *xdir = dir_name (file); + char *dir; + ASSIGN_STRDUPA (dir, xdir); + free (xdir); + + if (chdir (dir) < 0) + { + error (0, errno, _("cannot change to directory %s"), quote (dir)); + return NULL; + } + + if (stat (".", &last_stat) < 0) + { + error (0, errno, _("cannot stat current directory (now %s)"), + quote (dir)); + goto done; + } + } + + /* Now walk up FILE's parents until we find another file system or /, + chdiring as we go. LAST_STAT holds stat information for the last place + we visited. */ + while (true) + { + struct stat st; + if (stat ("..", &st) < 0) + { + error (0, errno, _("cannot stat %s"), quote ("..")); + goto done; + } + if (st.st_dev != last_stat.st_dev || st.st_ino == last_stat.st_ino) + /* cwd is the mount point. */ + break; + if (chdir ("..") < 0) + { + error (0, errno, _("cannot change to directory %s"), quote ("..")); + goto done; + } + last_stat = st; + } + + /* Finally reached a mount point, see what it's called. */ + mp = xgetcwd (); + +done: + /* Restore the original cwd. */ + { + int save_errno = errno; + if (restore_cwd (&cwd) != 0) + error (EXIT_FAILURE, errno, + _("failed to return to initial working directory")); + free_cwd (&cwd); + errno = save_errno; + } + + return mp; +} diff --git a/src/find-mount-point.h b/src/find-mount-point.h new file mode 100644 index 0000000..49be9ba --- /dev/null +++ b/src/find-mount-point.h @@ -0,0 +1,17 @@ +/* find-mount-point.h -- find the root mount point for a file. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +extern char* find_mount_point (const char *, const struct stat *); diff --git a/src/stat.c b/src/stat.c index c3730f0..0a2162c 100644 --- a/src/stat.c +++ b/src/stat.c @@ -64,10 +64,12 @@ #include "filemode.h" #include "fs.h" #include "getopt.h" +#include "mountlist.h" #include "quote.h" #include "quotearg.h" #include "stat-time.h" #include "strftime.h" +#include "find-mount-point.h" #if USE_STATVFS # define STRUCT_STATVFS struct statvfs @@ -179,6 +181,9 @@ static bool interpret_backslash_escapes; "" for --printf=FMT, "\n" for --format=FMT (-c). */ static char const *trailing_delim = ""; +/* Linked list of mounted file systems. */ +static struct mount_entry *mount_list; + /* Return the type of the specified file system. Some systems have statfvs.f_basetype[FSTYPSZ] (AIX, HP-UX, and Solaris). Others have statvfs.f_fstypename[_VFS_NAMELEN] (NetBSD 3.0). @@ -604,6 +609,90 @@ print_statfs (char *pformat, size_t prefix_len, char m, char const *filename, return fail; } +/* Return any bind mounted target for a path. + The result does _not_ have to be freed. + NULL is returned if no bind mount is found. */ +static char const * ATTRIBUTE_WARN_UNUSED_RESULT +find_bind_mount (char const * name) +{ + char const * bind_mount = NULL; + + static bool tried_mount_list = false; + if (!tried_mount_list) /* attempt/warn once per process. */ + { + if (!(mount_list = read_file_system_list (false))) + error (0, errno, "%s", _("cannot read table of mounted file systems")); + tried_mount_list = true; + } + + struct mount_entry *me; + for (me = mount_list; me; me = me->me_next) + { + if (me->me_dummy && me->me_devname[0] == '/' + && STREQ (me->me_mountdir, name)) + { + struct stat name_stats; + struct stat dev_stats; + + if (stat (name, &name_stats) == 0 + && stat (me->me_devname, &dev_stats) == 0 + && SAME_INODE (name_stats, dev_stats)) + { + bind_mount = me->me_devname; + break; + } + } + } + + return bind_mount; +} + +/* Print mount point. Return zero upon success, nonzero upon failure. */ + /* TODO: see if there is a way to correlate the test also */ +static bool ATTRIBUTE_WARN_UNUSED_RESULT +out_mount_point (char const *filename, char *pformat, size_t prefix_len, + const struct stat *statp) +{ + /* Look for bind mounts first. Note we ouput the immediate target, + rather than further resolving to a base device mount point. */ + char const *bind_mount = NULL; + + /* It's not possible to bind mount a symlink, + so there is no inconsistency here with + canonicalizing when -L is not specified. */ + char *resolved = canonicalize_file_name (filename); + if (!resolved) + { + out_string (pformat, prefix_len, "?"); + return true; + } + bind_mount = find_bind_mount (resolved); + free (resolved); + if (bind_mount) + { + out_string (pformat, prefix_len, bind_mount); + return false; + } + + /* If there is no direct bind mount, then + traverse back up the tree looking for a device change. */ + char *mp = find_mount_point (filename, statp); + if (!mp) + { + out_string (pformat, prefix_len, "?"); + return true; + } + else + { + /* This dir might be bind mounted to another device, + so we resolve the bound target in that case also. */ + bind_mount = find_bind_mount (mp); + out_string (pformat, prefix_len, bind_mount ? bind_mount : mp); + free (mp); + return false; + } +} + /* Print stat info. Return zero upon success, nonzero upon failure. */ static bool print_stat (char *pformat, size_t prefix_len, char m, @@ -679,6 +768,9 @@ print_stat (char *pformat, size_t prefix_len, char m, case 't': out_uint_x (pformat, prefix_len, major (statbuf->st_rdev)); break; + case 'm': + fail |= out_mount_point (filename, pformat, prefix_len, statbuf); + break; case 'T': out_uint_x (pformat, prefix_len, minor (statbuf->st_rdev)); break; @@ -1025,6 +1117,7 @@ The valid format sequences for files (without --file-system):\n\ fputs (_("\ %h Number of hard links\n\ %i Inode number\n\ + %m Mount point\n\ %n File name\n\ %N Quoted file name with dereference if symbolic link\n\ %o I/O block size\n\ diff --git a/tests/Makefile.am b/tests/Makefile.am index 4aa93bf..5619d0b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -241,6 +241,7 @@ TESTS = \ misc/split-l \ misc/stat-fmt \ misc/stat-hyphen \ + misc/stat-mount \ misc/stat-printf \ misc/stat-slash \ misc/stdbuf \ diff --git a/tests/misc/stat-mount b/tests/misc/stat-mount new file mode 100755 index 0000000..99e29cb --- /dev/null +++ b/tests/misc/stat-mount @@ -0,0 +1,27 @@ +#!/bin/sh +# Test stat -c%m + +# Copyright (C) 2010 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + + +df_mnt=$(df -P . | sed -n '2s/.* \([^ ]*$\)/\1/p') +stat_mnt=$(stat -c%m .) + +test "$df_mnt" = "$stat_mnt" || fail=1 + +Exit $fail -- 1.6.2.5 --------------070508080709080001020609-- From unknown Fri Jun 20 07:15:54 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 23 Sep 2010 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator