Re: Question about wild-pathnames

Alan Ruttenberg <[email protected]> Thu, 6 Jul 2023 00:25:02 -0400
Newsgroups gmane.editors.j.devel
Message-ID <CAFKQJ8k+gQABcRfwFXRmdcVVcUzdjiHXcnQ8f-oAHqZ4aWnrQw@mail.gmail.com>
--000000000000fc324205ffc9e70a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

It's not a wild pathname but it does satisfy wild-pathname-p. Given that
wild-pathname-p returns t, it is correct that an error is thrown
http://www.lispworks.com/documentation/HyperSpec/Issues/iss267_w.htm

You can address a file called "*" by quoting.
(wild-pathname-p "*") -> (:wild :wild-inferiors)
(wild-pathname-p "\\*") -> nil
(probe-file "~/*" ) throws an error
(probe-file "~/\\*")  works - I checked by creating a file called "*" in my
home directory.


Alan


On Wed, Jul 5, 2023 at 7:27=E2=80=AFPM Robert Goldman <[email protected]> =
wrote:

> In SBCL and Allegro, it's possible for UIOP to create a pathname for a
> file whose name is "*" and then we can find a file with such a(n odd)
> pathname.
>
> On ABCL, though, this gives me an error:
>
> (truename (ensure-pathname "*"))
>
> (truename (uiop:ensure-pathname "*"))
> #<THREAD "interpreter" native {21C91F12}>: Debugger invoked on condition =
of type FILE-ERROR
>   Cannot find the TRUENAME for a wild pathname.
>
> But actually, I don't think this *is* a wild pathname:
>
> CL-USER(4): (describe (uiop:ensure-pathname "*"))
> #P"*" is an object of type PATHNAME:
>   HOST         NIL
>   DEVICE       NIL
>   DIRECTORY    NIL
>   NAME         "*"
>   TYPE         :UNSPECIFIC
>   VERSION      NIL
>
> *this* is a wild pathname:
>
> CL-USER(5): (describe (parse-namestring "*"))
> #P"*" is an object of type PATHNAME:
>   HOST         NIL
>   DEVICE       NIL
>   DIRECTORY    NIL
>   NAME         :WILD
>   TYPE         NIL
>   VERSION      NIL
>
> Is this an ABCL bug, since it means ABCL cannot address a file whose name
> is "*"?
>
> The interested may refer to this ASDF issue
> <https://gitlab.common-lisp.net/asdf/asdf/-/issues/140> and the
> corresponding merge request.
>
> Thanks!
>

--000000000000fc324205ffc9e70a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>It&#39;s not a wild pathname but it does satisfy wild=
-pathname-p. Given that wild-pathname-p returns t, it is correct that an er=
ror is thrown</div><div><a href=3D"http://www.lispworks.com/documentation/H=
yperSpec/Issues/iss267_w.htm">http://www.lispworks.com/documentation/HyperS=
pec/Issues/iss267_w.htm</a></div><div><br></div><div>You can address a file=
 called &quot;*&quot; by quoting. <br></div><div>(wild-pathname-p &quot;*&q=
uot;) -&gt; (:wild :wild-inferiors)<br></div><div>(wild-pathname-p &quot;\\=
*&quot;) -&gt; nil</div><div>(probe-file &quot;~/*&quot; ) throws an error<=
/div><div>(probe-file &quot;~/\\*&quot;)=C2=A0 works - I checked by creatin=
g a file called &quot;*&quot; in my home directory.</div><div><br></div><di=
v><br></div><div>Alan</div><div><br></div></div><br><div class=3D"gmail_quo=
te"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Jul 5, 2023 at 7:27=E2=80=
=AFPM Robert Goldman &lt;<a href=3D"mailto:[email protected]">rpgoldman@si=
ft.net</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex"><u></u>




<div><div style=3D"font-family:sans-serif"><div style=3D"white-space:normal=
">
<p dir=3D"auto">In SBCL and Allegro, it&#39;s possible for UIOP to create a=
 pathname for a file whose name is &quot;*&quot; and then we can find a fil=
e with such a(n odd) pathname.</p>
<p dir=3D"auto">On ABCL, though, this gives me an error:</p>
<pre style=3D"margin-left:15px;margin-right:15px;padding:5px;background-col=
or:rgb(247,247,247);border-radius:5px;overflow-x:auto;max-width:90vw"><code=
 style=3D"margin:0px;border-radius:3px;background-color:rgb(247,247,247);pa=
dding:0px">(truename (ensure-pathname &quot;*&quot;))
</code></pre>
<pre style=3D"margin-left:15px;margin-right:15px;padding:5px;background-col=
or:rgb(247,247,247);border-radius:5px;overflow-x:auto;max-width:90vw"><code=
 style=3D"margin:0px;border-radius:3px;background-color:rgb(247,247,247);pa=
dding:0px">(truename (uiop:ensure-pathname &quot;*&quot;))
#&lt;THREAD &quot;interpreter&quot; native {21C91F12}&gt;: Debugger invoked=
 on condition of type FILE-ERROR
  Cannot find the TRUENAME for a wild pathname.
</code></pre>
<p dir=3D"auto">But actually, I don&#39;t think this <em>is</em> a wild pat=
hname:</p>
<pre style=3D"margin-left:15px;margin-right:15px;padding:5px;background-col=
or:rgb(247,247,247);border-radius:5px;overflow-x:auto;max-width:90vw"><code=
 style=3D"margin:0px;border-radius:3px;background-color:rgb(247,247,247);pa=
dding:0px">CL-USER(4): (describe (uiop:ensure-pathname &quot;*&quot;))
#P&quot;*&quot; is an object of type PATHNAME:
  HOST         NIL
  DEVICE       NIL
  DIRECTORY    NIL
  NAME         &quot;*&quot;
  TYPE         :UNSPECIFIC
  VERSION      NIL
</code></pre>
<p dir=3D"auto"><em>this</em> is a wild pathname:</p>
<pre style=3D"margin-left:15px;margin-right:15px;padding:5px;background-col=
or:rgb(247,247,247);border-radius:5px;overflow-x:auto;max-width:90vw"><code=
 style=3D"margin:0px;border-radius:3px;background-color:rgb(247,247,247);pa=
dding:0px">CL-USER(5): (describe (parse-namestring &quot;*&quot;))
#P&quot;*&quot; is an object of type PATHNAME:
  HOST         NIL
  DEVICE       NIL
  DIRECTORY    NIL
  NAME         :WILD
  TYPE         NIL
  VERSION      NIL
</code></pre>
<p dir=3D"auto">Is this an ABCL bug, since it means ABCL cannot address a f=
ile whose name is &quot;*&quot;?</p>
<p dir=3D"auto">The interested may refer to <a href=3D"https://gitlab.commo=
n-lisp.net/asdf/asdf/-/issues/140" style=3D"color:rgb(57,131,196)" target=
=3D"_blank">this ASDF issue</a> and the corresponding merge request.</p>
<p dir=3D"auto">Thanks!</p>

</div>
</div>
</div>


</blockquote></div>

--000000000000fc324205ffc9e70a--