From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UjND0-0007We-RT for mharc-grub-devel@gnu.org; Mon, 03 Jun 2013 01:21:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjNCx-0007V0-B4 for grub-devel@gnu.org; Mon, 03 Jun 2013 01:21:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjNCw-0003z1-2L for grub-devel@gnu.org; Mon, 03 Jun 2013 01:21:27 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]:54731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjNCv-0003yl-QR for grub-devel@gnu.org; Mon, 03 Jun 2013 01:21:25 -0400 Received: by mail-lb0-f177.google.com with SMTP id y6so308043lbh.22 for ; Sun, 02 Jun 2013 22:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; bh=cOvwElzlqnm2T3vcovhiYMvidfAszqEmXlcTG6jXIXc=; b=oflTvDEjJws8I4jDbU82p69OetCLREZmG3cOsMV9mq0VZRT6BZ1GjVQae4dQES6DJ1 aZmrs58UCK6FqZUIA4L8Uq6grp5AjCktd9oyFluwd+9QqmRtXeaGDHwzGIutNW0O8jrW Nv5OB2TUcHd4EgxdfyxNZ06LOj5L8L/i5EB2LF+Sx8TSEG1VX6SWMHxvqMTb254sr77l LvZg2YtwyrxNZVXZ+4xmfgC+IzNhPaX+tNPLFWBwzjRky5YNz5iroT8EBVrZrZIy4D3k not3t0rSOAV1wmC9PkGNyNXpsxN2IL9SxCJ+n0M7wWR+mJN58rg3ve24qdPZrvx9F+Ig FPWw== X-Received: by 10.112.172.234 with SMTP id bf10mr5798199lbc.133.1370236884833; Sun, 02 Jun 2013 22:21:24 -0700 (PDT) Received: from opensuse.site (ppp79-139-160-84.pppoe.spdop.ru. [79.139.160.84]) by mx.google.com with ESMTPSA id n7sm22812964lbd.12.2013.06.02.22.21.24 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Sun, 02 Jun 2013 22:21:24 -0700 (PDT) Date: Mon, 3 Jun 2013 09:21:23 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: Re: [PATCH 2/2] ls core command: handle listing of the root directory Message-ID: <20130603092123.675bceb5@opensuse.site> In-Reply-To: <51AB5B37.5050707@gmail.com> References: <518F74AA.6090907@gmail.com> <518F7544.5020202@gmail.com> <51975749.6030501@gmail.com> <51AB5B37.5050707@gmail.com> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.18; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.217.177 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 05:21:29 -0000 В Sun, 02 Jun 2013 16:48:23 +0200 Francesco Lavra пишет: > On 05/18/2013 12:26 PM, Francesco Lavra wrote: > > On 05/12/2013 12:56 PM, Francesco Lavra wrote: > >> Currently, listing of the root directory of a device with the command: > >> ls (device_name) > >> requires the underlying filesystem driver to handle an empty path > >> string as if it was the root directory path "/". This introduces > >> duplicated code across the different filesystem drivers. If a given > >> filesystem driver does not implement special handling of the empty > >> path string, the above command gives "error: invalid file name `'." > >> This error happens for instance with the ext4 filesystem. > >> The best place to handle correctly the empty path string and transform > >> it in "/" is the function grub_core_cmd_ls(), so that handling from > >> each filesystem driver is not required anymore. > > > > After revision 5010, issuing the ls command with a device name as > > parameter gives a response such as: > > (device_name): Filesystem is . > > But grub.texi says: > > " > > @deffn Command ls [arg @dots{}] > > List devices or files. > > > > With no arguments, print all devices known to GRUB. > > > > If the argument is a device name enclosed in parentheses (@pxref{Device > > syntax}), then list all files at the root directory of that device. > > > > If the argument is a directory given as an absolute file name (@pxref{File > > name syntax}), then list the contents of that directory. > > @end deffn > > " > > > > Which is the correct behavior? > > Depending on the answer to the above question, you might want to > consider applying one of the two patches below, as you see fit. > > Regards, > Francesco > > 2013-06-02 Francesco Lavra > > * docs/grub.texi (ls): Fix command description in case of a device name > passed as argument. > > === modified file 'docs/grub.texi' > --- docs/grub.texi 2013-05-11 05:23:26 +0000 > +++ docs/grub.texi 2013-06-02 14:35:24 +0000 > @@ -4049,7 +4049,7 @@ > With no arguments, print all devices known to GRUB. > > If the argument is a device name enclosed in parentheses (@pxref{Device > -syntax}), then list all files at the root directory of that device. > +syntax}), then print the name of the filesystem of that device. > > If the argument is a directory given as an absolute file name (@pxref{File > name syntax}), then list the contents of that directory. > Makes more sense to me than duplicating "ls (a,b)/". > > 2013-06-02 Francesco Lavra > > * grub-core/kern/corecmd.c (grub_core_cmd_ls): Fix listing of root > directory contents. > > === modified file 'grub-core/kern/corecmd.c' > --- grub-core/kern/corecmd.c 2013-06-02 14:23:14 +0000 > +++ grub-core/kern/corecmd.c 2013-06-02 14:28:24 +0000 > @@ -147,13 +147,11 @@ > > if (! *path) > { > - if (grub_errno == GRUB_ERR_UNKNOWN_FS) > - grub_errno = GRUB_ERR_NONE; > - > - grub_printf ("(%s): Filesystem is %s.\n", > - device_name, fs ? fs->name : "unknown"); > + /* The argument is a device name: list all files at the root directory > + of the device. */ > + path = (char *) "/"; > } > - else if (fs) > + if (fs) > { > (fs->dir) (dev, path, grub_mini_print_files, NULL); > grub_xputs ("\n"); > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel