unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43409: 28.0.50; Segfault on non-UTF-8 path
@ 2020-09-15  0:16 Lars Ingebrigtsen
  2020-09-15 14:15 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-15  0:16 UTC (permalink / raw)
  To: 43409

[-- Attachment #1: Type: text/plain, Size: 71 bytes --]


On Debian bullseye, with a file looking like this in a dired buffer:


[-- Attachment #2: Type: image/png, Size: 856 bytes --]

[-- Attachment #3: Type: text/plain, Size: 2696 bytes --]


Hitting RET on that kills Emacs.  Running under gdb, I get this
backtrace:

#0  terminate_due_to_signal
    (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at emacs.c:378
#1  0x00005555555984fe in emacs_abort () at sysdep.c:2280
#2  0x0000555555596a9a in multibyte_chars_in_text (ptr=<optimized out>, 
    ptr@entry=0x5555565f0870 "f\363o", nbytes=nbytes@entry=3)
    at character.c:447
#3  0x00005555555d412b in display_mode_element
    (it=<optimized out>, depth=<optimized out>, field_width=<optimized out>, precision=<optimized out>, elt=<optimized out>, props=<optimized out>, risky=<optimized out>) at xdisp.c:25644
#4  0x00005555555d54b0 in display_mode_element
    (it=0x7fffffffb840, depth=2, field_width=-1, precision=-1, elt=<optimized out>, props=XIL(0), risky=<optimized out>) at lisp.h:1423
#5  0x00005555555d63c2 in gui_consider_frame_title (frame=XIL(0x555555f64c45))
    at lisp.h:1007
#6  0x00005555555e15d9 in prepare_menu_bars () at xdisp.c:12666
#7  redisplay_internal () at xdisp.c:15514
#8  0x000055555568baeb in read_char
    (commandflag=1, map=XIL(0x5555563fb2b3), prev_event=XIL(0), used_mouse_menu=0x7fffffffe52b, end_time=0x0) at keyboard.c:2493
#9  0x000055555568e9c4 in read_key_sequence
    (keybuf=<optimized out>, prompt=XIL(0), dont_downcase_last=<optimized out>, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=<optimized out>) at keyboard.c:9547
#10 0x000055555569034c in command_loop_1 () at lisp.h:1007
#11 0x00005555556fbf17 in internal_condition_case
    (bfun=bfun@entry=0x555555690170 <command_loop_1>, handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x555555686ad0 <cmd_error>) at eval.c:1356
#12 0x0000555555681504 in command_loop_2 (ignore=ignore@entry=XIL(0))
    at lisp.h:1007
#13 0x00005555556fbe71 in internal_catch
    (tag=tag@entry=XIL(0xd200), func=func@entry=0x5555556814e0 <command_loop_2>, arg=arg@entry=XIL(0)) at eval.c:1117
#14 0x00005555556814ab in command_loop () at lisp.h:1007
#15 0x00005555556866e6 in recursive_edit_1 () at keyboard.c:714
#16 0x0000555555686a12 in Frecursive_edit () at keyboard.c:786
#17 0x000055555559fb54 in main (argc=2, argv=<optimized out>) at emacs.c:2047

This is with

[larsi@stories ~]$ echo $LANG
en_US.UTF-8



In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cairo version 1.16.0)
 of 2020-09-14 built on stories
Repository revision: e408f2fab24ea81f74d9b84dc83ee67d562846dc
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Debian GNU/Linux bullseye/sid


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: https://lars.ingebrigtsen.no


^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#43409: 28.0.50; Segfault on non-UTF-8 path
  2020-09-15  0:16 bug#43409: 28.0.50; Segfault on non-UTF-8 path Lars Ingebrigtsen
@ 2020-09-15 14:15 ` Eli Zaretskii
  2020-09-15 15:12   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2020-09-15 14:15 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43409

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Tue, 15 Sep 2020 02:16:36 +0200
> 
> Hitting RET on that kills Emacs.  Running under gdb, I get this
> backtrace:
> 
> #0  terminate_due_to_signal
>     (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at emacs.c:378
> #1  0x00005555555984fe in emacs_abort () at sysdep.c:2280
> #2  0x0000555555596a9a in multibyte_chars_in_text (ptr=<optimized out>, 
>     ptr@entry=0x5555565f0870 "f\363o", nbytes=nbytes@entry=3)
>     at character.c:447
> #3  0x00005555555d412b in display_mode_element
>     (it=<optimized out>, depth=<optimized out>, field_width=<optimized out>, precision=<optimized out>, elt=<optimized out>, props=<optimized out>, risky=<optimized out>) at xdisp.c:25644

My bad, sorry: I used a wrong API for the job.  Does the below solve
the problem?

diff --git a/src/xdisp.c b/src/xdisp.c
index 10ddb53dba..615f0ca7cf 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -25641,8 +25641,10 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
 		    /* Non-ASCII characters in SPEC should cause mode-line
 		       element be displayed as a multibyte string.  */
 		    ptrdiff_t nbytes = strlen (spec);
-		    if (multibyte_chars_in_text ((const unsigned char *)spec,
-						 nbytes) != nbytes)
+		    ptrdiff_t nchars, mb_nbytes;
+		    parse_str_as_multibyte ((const unsigned char *)spec, nbytes,
+					    &nchars, &mb_nbytes);
+		    if (!(nbytes == nchars || nbytes != mb_nbytes))
 		      multibyte = true;
 
 		    switch (mode_line_target)





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#43409: 28.0.50; Segfault on non-UTF-8 path
  2020-09-15 14:15 ` Eli Zaretskii
@ 2020-09-15 15:12   ` Lars Ingebrigtsen
  2020-09-15 15:45     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-15 15:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43409

Eli Zaretskii <eliz@gnu.org> writes:

> My bad, sorry: I used a wrong API for the job.  Does the below solve
> the problem?

Yup, that fixes the problem.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#43409: 28.0.50; Segfault on non-UTF-8 path
  2020-09-15 15:12   ` Lars Ingebrigtsen
@ 2020-09-15 15:45     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2020-09-15 15:45 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43409-done

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: 43409@debbugs.gnu.org
> Date: Tue, 15 Sep 2020 17:12:08 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > My bad, sorry: I used a wrong API for the job.  Does the below solve
> > the problem?
> 
> Yup, that fixes the problem.

Thanks, installed.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-15 15:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15  0:16 bug#43409: 28.0.50; Segfault on non-UTF-8 path Lars Ingebrigtsen
2020-09-15 14:15 ` Eli Zaretskii
2020-09-15 15:12   ` Lars Ingebrigtsen
2020-09-15 15:45     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).