bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34350: 27.0.50; ediff-revision broken with SVN backend + non ascii c


From: Eli Zaretskii
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

> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]