<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">OK, applied the revised fix, added tests, and pushed.</p>
<p dir="auto">Note that Faré points out I mis-numbered the earlier version.</p>
<p dir="auto">The latest version is now 3.3.3.1 and the incorrect 3.3.4 tag <strong>has been removed</strong>.</p>
<p dir="auto">We now return you to your regularly scheduled Common Lisp.</p>
<p dir="auto">Cheers,<br>
R</p>
<p dir="auto">On 25 Jun 2019, at 9:24, Robert Goldman wrote:</p>
</div>
<div style="white-space:normal"></div>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><div id="5D6B441F-FC93-4CA5-9B14-BD630AEC526B">
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">Generally this looks good, but why did you put the change in <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">with-current-directory</code> instead of in <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">call-with-current-directory</code>, since the former is just a thin wrapper around the latter?</p>
<p dir="auto">They are both exported, so I think it would be better to put it there. That leaves us with the following (rather ugly) form:</p>
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">(let ((dir (resolve-symlinks*
(get-pathname-defaults
(pathname-directory-pathname
(ensure-directory-pathname
dir)))))
...)
...)
</code></pre>
<p dir="auto">It's redundant to call <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">pathname-directory-pathname</code> on <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">ensure-directory-pathname</code>, so we just need the latter.</p>
<p dir="auto">I will push this after testing.</p>
<p dir="auto">On 25 Jun 2019, at 0:26, Spenser Truex wrote:</p>
</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">Neil Lindquist <neillindquist5@gmail.com><br>
writes:<br>
</p>
<blockquote style="border-left:2px solid #777; color:#999; margin:0 0 5px; padding-left:5px; border-left-color:#999"><p dir="auto">Hello,<br>
<br>
I recently noticed that uiop's DIRECTORY-FILES does not ensure that<br>
the path is always interpreted as a directory. On sbcl (and<br>
presumably other implementations), if the path does not have a<br>
trailing slash, the files in the parent directory are instead<br>
returned. This does not appear to be the indented behavior, given<br>
that SUBDIRECTORIES ensures that the path is a directory.</p>
</blockquote><p dir="auto">May as well also do that for uiop:with-current-directory. I've attached<br>
a diff, and have a test case below<br>
<br>
Test case:<br>
(uiop:with-current-directory ("/home/user")<br>
(run-program "ls" :output t))<br>
<br>
Behaviour is simiar to DIRECTORY-FILES.<br>
;=> Current: lists my /home dir<br>
;=> With diff: lists my /home/user dir<br>
<br>
~~~~~~~~~~ DIFF ~~~~~~~~~~~~~<br>
<br>
498c498<br>
< `(call-with-current-directory ,dir #'(lambda () ,@body))))<br>
---</p>
<blockquote style="border-left:2px solid #777; color:#999; margin:0 0 5px; padding-left:5px; border-left-color:#999"><p dir="auto"> `(call-with-current-directory (ensure-directory-pathname ,dir) #'(lambda<br>
() ,@body))))</p>
</blockquote><p dir="auto">Coleslaw has been using a similar version of the above for awhile.<br>
</p>
<blockquote style="border-left:2px solid #777; color:#999; margin:0 0 5px; padding-left:5px; border-left-color:#999"><p dir="auto">A patch for this new behavior and current/proposed results are below.<br>
## Patch ##<br>
--- a/uiop/filesystem.lisp<br>
+++ b/uiop/filesystem.lisp<br>
@@ -209,7 +209,7 @@ Subdirectories should NOT be returned.<br>
override the default at your own risk.<br>
DIRECTORY-FILES tries NOT to resolve symlinks if the implementation<br>
permits this,<br>
but the behavior in presence of symlinks is not portable. Use IOlib<br>
to handle such situations."<br>
- (let ((dir (pathname directory)))<br>
+ (let ((dir (ensure-directory-pathname directory))))<br>
(when (logical-pathname-p dir)<br>
;; Because of the filtering we do below,<br>
;; logical pathnames have restrictions on wild patterns.<br>
<br>
</p>
</blockquote><p dir="auto">--<br>
Spenser Truex<br>
usenet@spensertruex.com<br>
<a href="https://spensertruex.com/" style="color:#777">https://spensertruex.com/</a><br>
San Francisco, USA</p>
</blockquote></div>
<div style="white-space:normal">
</div>
</div></div></blockquote>
<div style="white-space:normal">
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
</blockquote></div>
<div style="white-space:normal">
</div>
</div>
</body>
</html>