From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: bootstrapping SED-4.5, circular dependency? Date: Sun, 09 Dec 2018 14:42:07 +0100 Message-ID: <87ftv63jgw.fsf@gnu.org> References: <87efasp1vp.fsf@gnu.org> <9bb1aa64-224e-9b4c-6ed5-50433ed947bb@gmail.com> <875zw361ml.fsf@gnu.org> <87o99vmjuf.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVzLf-0000QQ-Fl for guix-devel@gnu.org; Sun, 09 Dec 2018 08:42:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVzLd-0004aX-L1 for guix-devel@gnu.org; Sun, 09 Dec 2018 08:42:19 -0500 In-Reply-To: <87o99vmjuf.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Sun, 09 Dec 2018 04:59:04 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Jan Nieuwenhuizen Cc: guix-devel@gnu.org, Assaf Gordon , sed-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi! Jan Nieuwenhuizen skribis: > Ludovic Court=C3=A8s writes: > > Hello, > >> Jan, could it be that the =E2=80=98basename=E2=80=99 and =E2=80=98dirnam= e=E2=80=99 implementations in >> Gash fail this test? It might be that sed is not needed if you get >> these right. > > Ah, yes! I have added some test to Gash and this > > basename -- / > > failed, producing the empty string, where coreutils' basename returns > `/'. > > Gash "simply" (there is som if'ing involved) calls Guile's basename, > which disagrees here and returns "" for "/". > > I'm assuming that this is expected behaviour for Guile?... so I > special-cased this for Gash' basename. Looking at , I think it=E2=80=99s a bug of Guile=E2=80=99s =E2=80=98basename=E2=80=99 (w= hich is not implemented in terms of libc=E2=80=99s =E2=80=98basename=E2=80=99.) The fix might be as simple as the patch below, WDYT? In the meantime Gash should work around the bug. Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/libguile/filesys.c b/libguile/filesys.c index e1aeeed1b..c1cd50e21 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -1602,11 +1602,20 @@ SCM_DEFINE (scm_basename, "basename", 1, 1, 0, c_filename = scm_to_utf8_string (filename); scm_dynwind_free (c_filename); + if (strcmp (c_filename, "/") == 0 + || strcmp (c_filename, "//") == 0) + /* As per + , + "/" and "//" are treated specially. */ + res = scm_from_utf8_string ("/"); + else + { c_last_component = last_component (c_filename); if (!c_last_component) res = filename; else res = scm_from_utf8_string (c_last_component); + } scm_dynwind_end (); if (!SCM_UNBNDP (suffix) && --=-=-=--