Subject: bug#66115: closed (Re: bug#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 22 Sep 2023 10:52:02 +0000

Your bug report

#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
66115: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66115
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout
From: Philip Kaludercic <[email-masked]>
To: Joseph Turner <[email-masked]>
Cc: [email-masked]
Date: Fri, 22 Sep 2023 10:51:13 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Joseph Turner <[email-masked]> writes:

> Philip Kaludercic <[email-masked]> writes:
>
>> Joseph Turner <[email-masked]> writes:
>>
>>> Tags: patch
>>>
>>> Tags: patch
>>>
>>> This patch fixes a serious bug which caused package-vc-checkout to fail
>>> entirely when its second argument `directory' was not expanded.
>>>
>>> From 75a6ec74ff5e31edc7592b68e7ad9d1ec26f515c Mon Sep 17 00:00:00 2001
>>> From: Joseph Turner <[email-masked]>
>>> Date: Wed, 20 Sep 2023 00:12:10 -0700
>>> Subject: [PATCH] Ensure that directory is expanded in package-vc-checkout
>>>
>>> * lisp/emacs-lisp/package-vc.el (package-vc-checkout)
>>> ---
>>>  lisp/emacs-lisp/package-vc.el | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>>> index 29b540d86b8..47d8c996ff0 100644
>>> --- a/lisp/emacs-lisp/package-vc.el
>>> +++ b/lisp/emacs-lisp/package-vc.el
>>> @@ -834,6 +834,7 @@ for the last released version of the package."
>>>               (setf dir subdir)
>>>             (user-error "Directory not empty: %S" (expand-file-name dir)))))
>>>       (list desc dir (and current-prefix-arg :last-release))))
>>> +  (setf directory (expand-file-name directory))
>>>    (package-vc--archives-initialize)
>>>    (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
>>>                        (and-let* ((extras (package-desc-extras pkg-desc))
>>
>> DIRECTORY is passed on to `package-vc--clone' and in turn `vc-clone'.
>> Wouldn't it be more robust to ensure that `vc-clone' can handle
>> unexpanded directory names, eg. like this:
>>
>> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
>> index 2f4b028bb4a..7f334397a5e 100644
>> --- a/lisp/vc/vc.el
>> +++ b/lisp/vc/vc.el
>> @@ -3676,8 +3676,7 @@ vc-clone
>>  checkout.  If BACKEND is nil, iterate through every known backend
>>  in `vc-handled-backends' until one succeeds.  If REV is non-nil,
>>  it indicates a specific revision to check out."
>> -  (unless directory
>> -    (setq directory default-directory))
>> +  (setq directory (expand-file-name (or directory default-directory)))
>>    (if backend
>>        (progn
>>          (unless (memq backend vc-handled-backends)
>
> Yes, certainly. Your solution is better.

OK, closing the issue.

Subject: [PATCH] Ensure that directory is expanded in package-vc-checkout
From: Joseph Turner <[email-masked]>
To: [email-masked]
Date: Wed, 20 Sep 2023 00:14:02 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Tags: patch

This patch fixes a serious bug which caused package-vc-checkout to fail
entirely when its second argument `directory' was not expanded.

>From 75a6ec74ff5e31edc7592b68e7ad9d1ec26f515c Mon Sep 17 00:00:00 2001
From: Joseph Turner <[email-masked]>
Date: Wed, 20 Sep 2023 00:12:10 -0700
Subject: [PATCH] Ensure that directory is expanded in package-vc-checkout

* lisp/emacs-lisp/package-vc.el (package-vc-checkout)
---
 lisp/emacs-lisp/package-vc.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 29b540d86b8..47d8c996ff0 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -834,6 +834,7 @@ for the last released version of the package."
              (setf dir subdir)
            (user-error "Directory not empty: %S" (expand-file-name dir)))))
      (list desc dir (and current-prefix-arg :last-release))))
+  (setf directory (expand-file-name directory))
   (package-vc--archives-initialize)
   (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
                       (and-let* ((extras (package-desc-extras pkg-desc))
-- 
2.41.0