From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 34350@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#34350: 27.0.50; ediff-revision broken with SVN backend + non ascii chars both in directory and in filename
Date: Sat, 09 Feb 2019 11:01:18 +0200 [thread overview]
Message-ID: <83o97lnxnl.fsf@gnu.org> (raw)
In-Reply-To: <jwv7ee9uc6o.fsf-monnier+emacsbugs@gnu.org> (message from Stefan Monnier on Fri, 08 Feb 2019 18:03:49 -0500)
> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: dgutov@yandex.ru, 34350@debbugs.gnu.org
> Date: Fri, 08 Feb 2019 18:03:49 -0500
>
> >> > It's a waste of cycles to do decoding manually in Lisp,
> >>
> >> It'd be better to decode "on the fly" rather than first insert the byte
> >> stream in a buffer and then decode it. No doubt.
> >> But I can't see how to do that and handle -*-coding-*-,
> >> auto-coding-regexp-alist, and friends.
> > What do you mean by "how"? Just do the normal I/O, and all of those
> > will be taken care of. Like when we visit a file. What am I missing?
>
> The `find-revision` backend operation must put the revision's bytes into
> the provided buffer, indeed similarly to when we visit a file.
> But the difference is that in 99% of the cases, the bytes don't come
> from a file but from a process's stdout, so the backed can't directly
> use the "visit a file" trick.
Isn't that sub-optimal design, then? Those back-ends that can produce
a file for a given revision (there are at least 3 of them, AFAIK)
should be left to their devices; those which cannot and use some kind
of 'cat' command instead can be invoked with output redirected to a
file. This should be lightning-fast with most (all?) VCSes. Instead,
we invoke the VCS with output redirected to a pipe, slowly read that
output from the pipe into a buffer, then write the resulting buffer to
a file. Why?
> - vc-find-revision-save
> - vc-find-revision-no-save
> - vc-default-revert
>
> The last one should indeed call the backend directly (as it currently
> does) and should be changed not to bind coding-system-for-read/write and
> instead to assume that the backend deals with bytes.
>
> The other two are begging to be unified to reduce code redundancy and
> are the ones that need the do the file-like decoding (and they indeed do
> it).
If vc-find-revision and vc-find-revision-no-save need to enforce
no-conversion, then why do most of the back-ends do that as well? If
we decide that back-ends produce undecoded buffers, then vc.el
shouldn't be bothered with forcing coding-system-for-read/write at
all, right? This duplication is a large part of the problem here.
In addition, while I could understand binding of
coding-system-for-read in the backend's find-revision (assuming we
want the resulting buffer remain undecoded), why should the back-end
also bind coding-system-for-write? I see absolutely no reason for
that. E.g., look at this example:
(defun vc-hg-find-revision (file rev buffer)
(let ((coding-system-for-read 'binary)
(coding-system-for-write 'binary))
(if rev
(vc-hg-command buffer 0 file "cat" "-r" rev)
(vc-hg-command buffer 0 file "cat"))))
Why on earth does this bind coding-system-for-write, when it doesn't
write anything at all, it only reads?
> > You forget VCS operations that return stuff other than the complete
> > file's contents, like vc-log or vc-dff or calls that return file names
> > etc.
>
> Not really forgetting, no. Instead I was talking specifically about
> things like `find-revision` (i.e. about the content of files).
> For filenames, commit messages and other metadata the situation is quite
> different, indeed.
But vc-git.el, for example, uses both in its find-revision
implementation. It therefore must use more complicated juggling with
binding the various coding-system variables. Once again, this is an
argument in favor of leaving the encoding/decoding stuff to the
back-end.
next prev parent reply other threads:[~2019-02-09 9:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-06 19:52 bug#34350: 27.0.50; ediff-revision broken with SVN backend + non ascii chars both in directory and in filename Vincent Belaïche
2019-02-07 15:41 ` Eli Zaretskii
2019-02-07 22:27 ` Vincent Belaïche
2019-02-08 7:02 ` Eli Zaretskii
2019-02-07 15:50 ` Eli Zaretskii
2019-02-08 16:08 ` Stefan Monnier
2019-02-08 21:18 ` Eli Zaretskii
2019-02-08 21:50 ` Stefan Monnier
2019-02-08 22:10 ` Eli Zaretskii
2019-02-08 23:03 ` Stefan Monnier
2019-02-09 9:01 ` Eli Zaretskii [this message]
2019-02-09 13:12 ` Stefan Monnier
2019-02-09 13:42 ` Eli Zaretskii
2019-02-09 14:03 ` Stefan Monnier
2019-02-11 21:20 ` Vincent Belaïche
2019-02-11 22:00 ` Stefan Monnier
2019-02-08 17:25 ` Dmitry Gutov
2019-02-08 21:45 ` Eli Zaretskii
2019-02-09 7:58 ` Dmitry Gutov
2019-02-09 8:23 ` Eli Zaretskii
2019-02-10 19:52 ` Vincent Belaïche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83o97lnxnl.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=34350@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.