Subject: bug#74202: 31.0.50; package-el fails to delete outdated elpa packages

From: Eli Zaretskii <[email-masked]>
Date: Mon, 04 Nov 2024 15:11:51 +0200

[Please don't change the Subject of the responses and followups.]

> From: Johann Höchtl <[email-masked]>
> Date: Mon, 4 Nov 2024 09:06:12 +0100
> 
> The full error message is:
> 
> Error when expiring the cache: (permission-denied Removing directory Permission denied
> c:/Users/HoechtlJ/OneDrive - WKO Online/Dokumente/.emacs.d/url/cache/HoechtlJ/https/org/gnu/www)

What is the Lisp code which triggers this error message?  IOW, please
show the Lisp code which "expires the cache".

> The directory unfortunately contains blanks, so it's possibly not a permission error at all but emacs actually
> trying to delete another directory but the one for which the error message gets printed?

Why would blanks in the directory name cause Emacs to try to delete a
different directory?  Emacs doesn't delete directories via the shell,
where this could be a problem, it deletes them by calling Windows
APIs.

Since this directory seems to be on OneDrive, I suspect that these are
not "normal" Windows files, but some kind of junction points or some
other filesystem wizardry that Emacs doesn't understand.  Please try
producing a standalone self-contained recipe for reproducing the
problem starting from "emacs -Q", preferably without installing any
ELPA packages.  Since the issue is with removing files from a
directory, presumably the problem has nothing to do with package.el
per se, but with basic file I/O, and so you should be able to find a
way of reproducing it by simply removing files from a directory,
perhaps if the directory is on OneDrive.