From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Vlk3u-0002Gw-RT for mharc-grub-devel@gnu.org; Wed, 27 Nov 2013 13:42:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vlk3n-0002Ee-RE for grub-devel@gnu.org; Wed, 27 Nov 2013 13:42:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vlk3i-0007V3-GW for grub-devel@gnu.org; Wed, 27 Nov 2013 13:42:03 -0500 Received: from mail-la0-x22b.google.com ([2a00:1450:4010:c03::22b]:46356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vlk3i-0007Uu-89 for grub-devel@gnu.org; Wed, 27 Nov 2013 13:41:58 -0500 Received: by mail-la0-f43.google.com with SMTP id n7so5572666lam.30 for ; Wed, 27 Nov 2013 10:41:57 -0800 (PST) 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:mime-version :content-type:content-transfer-encoding; bh=ZDT21HAtL5BhfOCOJMUD5M3zGr37Qz+5Nz7St5+yBlY=; b=USdRCca/L9zsEbQu3hfunzznZfgxgIcvuQBvGoI2hX6N4V4hEkdhdWANDz3FdtGs86 k1JK8NlfvGBLH81Q+lDYn/M66Jj5SZ+ZqKJI/xUJtEaFr2z3zm+kTwybjEKFPA4V7TEm xGXwwH2QJwfB1xc/6a42h3KU+aq3sXtgPPETo4+qyuSiZpN1JwI4jREe8sI9jsmHA1hB JPd2ONJ9YH9xUCc1mQH4i5JE1mWFtzUfp5zO9EC72IQkAIUd8G54c3bj4V6rMgi4D35f 2y6enRCr/ud2lnKN3NiU88mneXzbp6lY0grIcZLu2pnGbCsyHNhP8QavWoTrubih3UlS kspA== X-Received: by 10.152.181.98 with SMTP id dv2mr30967058lac.15.1385577716953; Wed, 27 Nov 2013 10:41:56 -0800 (PST) Received: from opensuse.site (ppp91-76-170-113.pppoe.mtu-net.ru. [91.76.170.113]) by mx.google.com with ESMTPSA id z3sm41160900lag.10.2013.11.27.10.41.56 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Wed, 27 Nov 2013 10:41:56 -0800 (PST) Date: Wed, 27 Nov 2013 22:41:54 +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: <20131127224154.7e2eb2a1@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.2 (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: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22b 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: Wed, 27 Nov 2013 18:42:09 -0000 What about this patch? Looks correct to me and reflects actual behavior. В 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. > > > 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