uiop:directory-files doesn't behave on paths without a trailing slash
Robert Goldman
rpgoldman at sift.info
Tue Jun 25 23:01:52 UTC 2019
I checked and `pathname-directory-pathname` is redundant, because of the
guarantees provided by `ensure-directory-pathname`, but when I look at
`get-pathname-defaults`, I am pretty sure it *cannot* be removed in the
same way.
After `get-pathname-defaults` any relative pathnames will be resolved by
pathname merging, and we should be guaranteed to have an absolute
pathname.
AFAICT, `ensure-directory-pathname` can return a relative pathname.
To be honest, I don't know if an absolute pathname is required, but I
would have to understand a lot more of `uiop` to be sure it was safe to
relax that constraint, so I left it. I'm willing to be convinced if you
have more energy than I do.
Best,
R
P.S. please send diffs with some more context if you can -- I find the
following diff flags helpful: `--ignore-space-change -u -F
'\''^(def'\''`
On 25 Jun 2019, at 17:10, Spenser Truex wrote:
> "Robert Goldman" <rpgoldman at sift.info> writes:
>
>> OK, applied the revised fix, added tests, and pushed.
>>
>> On 25 Jun 2019, at 9:24, Robert Goldman wrote:
>>
>> Generally this looks good, but why did you put the change in
>> with-current-directory instead of in call-with-current-directory,
>> since the
>> former is just a thin wrapper around the latter?
>>
>> They are both exported, so I think it would be better to put it
>> there. That
>> leaves us with the following (rather ugly) form:
>>
>> (let ((dir (resolve-symlinks*
>> (get-pathname-defaults
>> (pathname-directory-pathname
>> (ensure-directory-pathname
>> dir)))))
>> ...)
>> ...)
>>
>> It's redundant to call pathname-directory-pathname on
>> ensure-directory-pathname,
>> so we just need the latter.
>
> Indeed, so why did you push the above code to
> <URL:https://gitlab.common-lisp.net/asdf/asdf/blob/b1ffbc47442973a18c43a44f6e17f0ff06ddfafd/uiop/filesystem.lisp
> >?
>
> I suggest you do that reduction (below)
>
> *** /uiop/filesystem.lisp
> *** 491,499 ****
> Note that this operation is usually NOT thread-safe."
> (if dir
> (let* ((dir (resolve-symlinks*
> - (get-pathname-defaults
> - (ensure-directory-pathname
> - dir))))
> (cwd (getcwd))
> (*default-pathname-defaults* dir))
> (chdir dir)
> --- 491,498 ----
> Note that this operation is usually NOT thread-safe."
> (if dir
> (let* ((dir (resolve-symlinks*
> + (ensure-directory-pathname
> + dir)))
> (cwd (getcwd))
> (*default-pathname-defaults* dir))
> (chdir dir)
>
> --
> Spenser Truex
> https://spensertruex.com/
> San Francisco, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20190625/b875cbe5/attachment.html>
More information about the asdf-devel
mailing list