all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andrew Hyatt <ahyatt@gmail.com>
To: Toru TSUNEYOSHI <t_tuneyosi@hotmail.com>
Cc: 5251@debbugs.gnu.org
Subject: bug#5251: 23.1; problem in decode_eol of coding.c
Date: Tue, 16 Feb 2016 22:41:32 -0500	[thread overview]
Message-ID: <m2bn7gypeb.fsf@gmail.com> (raw)
In-Reply-To: <BLU0-SMTP704B8524D8ADDE7CE11CB3E2830@phx.gbl> (Toru TSUNEYOSHI's message of "Sun, 20 Dec 2009 17:57:09 +0900")


I can verify that this issue still happens in Emacs 25.  This simple fix
seems to have slipped by unnoticed many years ago, hopefully someone
that is qualified to comment on the patch will see it now.

BTW, this seems like a nice thing to unit test with ert, if a fix does
take place.

Toru TSUNEYOSHI <t_tuneyosi@hotmail.com> writes:

> In GNU Emacs 23.1, there is a problem in decode_eol of coding.c.
>
> In buffer of which enable-multibyte-characters is nil,
> the function `decode-coding-region' should delete the character '^M'
> (code: 0x0d) at the end of line,
> in case that the function parameter `coding-system' is *-dos (and
> the variable `inhibit-eol-conversion' is nil).
> But, in practice, the function doesn't delete all of the character '^M'.
>
> You can watch the problem with the following.
>
> ========================================================================
> (progn
>   (pop-to-buffer (generate-new-buffer-name "*scratch*"))
>   (set-buffer-multibyte nil)
>   (insert (encode-coding-string "あ" 'euc-jp) "\xd" "\n")
>   (read-char "(press any key)")
>   (decode-coding-region (point-min) (point-max) 'euc-jp-dos)
>   (read-char "doesn't delete all of the character '^M'. (press any key)")
>   (set-buffer-multibyte t))
> ========================================================================
>
> I made a patch to fix the problem. Please check it.
>
> --- coding.c.orig	2009-07-08 12:09:16.000000000 +0900
> +++ coding.c	2009-12-20 16:36:45.887121600 +0900
> @@ -6598,7 +6598,8 @@
>  	{
>  	  int pos_byte = coding->dst_pos_byte;
>  	  int pos = coding->dst_pos;
> -	  int pos_end = pos + coding->produced_char - 1;
> +	  int pos_end = pos + (coding->dst_multibyte
> +			       ? coding->produced_char : coding->produced) - 1;
>  
>  	  while (pos < pos_end)
>  	    {





  reply	other threads:[~2016-02-17  3:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-20  8:57 bug#5251: 23.1; problem in decode_eol of coding.c Toru TSUNEYOSHI
2016-02-17  3:41 ` Andrew Hyatt [this message]
2016-02-17 15:53   ` Eli Zaretskii
2016-02-17 17:03     ` Toru TSUNEYOSHI
2016-02-17 19:24       ` Eli Zaretskii
2016-02-18  2:56         ` Toru TSUNEYOSHI

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=m2bn7gypeb.fsf@gmail.com \
    --to=ahyatt@gmail.com \
    --cc=5251@debbugs.gnu.org \
    --cc=t_tuneyosi@hotmail.com \
    /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.