GNU bug report logs -
#58360
28.2; tramp-archive and file-directory-p
Previous Next
Reported by: Gustavo Barros <gusbrs.2016 <at> gmail.com>
Date: Fri, 7 Oct 2022 15:37:01 UTC
Severity: normal
Tags: notabug, wontfix
Found in version 28.2
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 58360 <at> debbugs.gnu.org (full text, mbox):
Gustavo Barros <gusbrs.2016 <at> gmail.com> writes:
> Hi All,
Hi Gustavo,
> The thing started with `counsel-find-file' which, instead of opening
> an ODT file as I wished to do, would auto mount a volume on the system
> and then navigate inside it as a directory.
>
> I went down the rabbit hole, and it turns out that `file-directory-p'
> returns `t' for an ODT file appended with a slash. And the reason it
> does is that `tramp-archive' is enabled by default, and that
> OpenDocument format extensions are included in
> `tramp-archive-suffixes'.
>
> So, if you try:
>
> (file-directory-p (expand-file-name "~/file.odt/"))
>
> provided that "~/file.odt" exists, will return `t' on an "emacs -Q"
> session.
>
> Is this really intended? It was baffling to me (to the point that
> I've personally set `tramp-archive-enabled' to nil, as Tramp's manual
> taught me to), but perhaps there are use cases which I'm missing that
> may justify it.
This is intended. There is no need for packages like counsel to check
(file-directory-p (expand-file-name "~/file.odt/"))
It is a misuse to add a slash to an existing regular file and pray that
it works. There has been a similar error in ange-ftp, see bug#56078. It
has fixed. I recommend to contact the counsel author for a fix.
> A side comment on this. Even assuming this is intended behavior, is
> it really the case to bundle up every file type extension supported by
> "libarchive" in `tramp-archive-suffixes'? There may be people who
> wish to navigate into "tar", "iso", "rar" or "zip" files as
> directories. But why should this be the default for OpenDocument
> formats, or for "exe", or "deb" files, for example, for which the
> desired behavior is likely something else?
There might be people who wish to navigate into "odt", "exe", or "deb"
files. It shall be possible. It happens only if you access
"/path/to/file.odt/" (the trailing slash is important), for which there
is no other desired behavior I could imagine.
> Furthermore, `tramp-archive-suffixes' is a defconst, not a
> defcustom. So users are stuck with "all or nothing", unable to select
> for which file types tramp-archive should be used or not. (Of course,
> I know one can always change things regardless, but that's not the
> point.)
I doubt that people would change such a user option. What would be the
use case? There is still tramp-archive-enabled, and if a package really
really really wants to access "file.odt/" for another purpose than the
intended, the package shall let-bind this variable.
> Best regards,
> Gustavo.
Best regards, Michael.
This bug report was last modified 2 years and 227 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.