From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Vm1dM-0002HN-4P for mharc-grub-devel@gnu.org; Thu, 28 Nov 2013 08:27:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm1dE-0002Gc-LM for grub-devel@gnu.org; Thu, 28 Nov 2013 08:27:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vm1d9-0003MZ-3v for grub-devel@gnu.org; Thu, 28 Nov 2013 08:27:48 -0500 Received: from mail-la0-x234.google.com ([2a00:1450:4010:c03::234]:51198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm1d8-0003MN-MI for grub-devel@gnu.org; Thu, 28 Nov 2013 08:27:43 -0500 Received: by mail-la0-f52.google.com with SMTP id y1so4218746lam.11 for ; Thu, 28 Nov 2013 05:27:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=yo68sTeSif1uW/gdSPSHXt8CyhuAMiUkiZiMFSZjZjs=; b=Q1NcYyYI0usHHgs6qq5I4WM0Pb2wlt98Do7J2F/HgwPyp/zENtKpw4mwpBVAPVSH+w xB8DIOjD3Kn8Sd9u5fVHqdl+EDnHRW9RuI2k9oadtxoitqADLsNzG3VbtJ901pwXjEeZ TyaCo2fIcKeidfb/jFz0WZmLqRsgNeG/ovTNbQMBhVT+ZrY1wBYkDCv70n1cok4z7wrB DdYJNSNSDKp5ojtiECDKWFbAhnEpW0XYjw/+TOUhA6GwfxmnmotYaSe28K5s1oEtRsZK gER9RAKe4Swpll5Zk4WejIGKJd/c9FR1hqjDjoeDMt/MoPenGengEMvajJJ0SFJ8VnAF sXTA== X-Received: by 10.152.21.74 with SMTP id t10mr75784lae.65.1385645261404; Thu, 28 Nov 2013 05:27:41 -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 sd11sm58792251lab.2.2013.11.28.05.27.40 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Thu, 28 Nov 2013 05:27:40 -0800 (PST) Date: Thu, 28 Nov 2013 17:27:38 +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: <20131128172738.3ce52427@opensuse.site> In-Reply-To: References: <518F74AA.6090907@gmail.com> <518F7544.5020202@gmail.com> <51975749.6030501@gmail.com> <51AB5B37.5050707@gmail.com> <20131127224154.7e2eb2a1@opensuse.site> 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::234 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: Thu, 28 Nov 2013 13:27:54 -0000 В Thu, 28 Nov 2013 07:31:54 +0100 "Vladimir 'phcoder' Serbinenko" пишет: > this very confusing with 2 opposite patches in same mail. I don't have my > keys here. Feel free to commit documentation patch. If you commit on > Francesco's behalf don't forget --author Done. > On Nov 27, 2013 7:42 PM, "Andrey Borzenkov" wrote: > > > 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 > > > > > > _______________________________________________ > > Grub-devel mailing list > > Grub-devel@gnu.org > > https://lists.gnu.org/mailman/listinfo/grub-devel > >