Tíquete #47948

tmesh core dumps on EOF

: 2023-04-27 05:11 Última Atualização: 2023-05-01 10:10

Relator:
Dono:
(Nenhum)
Tipo:
Estado:
Aberto
Componente:
(Nenhum)
Marcos:
(Nenhum)
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Nenhum
Arquivo:
Nenhum

Details

Description:

When I start tmesh interactively and type Ctrl-d it segfaults.

Reproducing:

$ tmesh

Wed Apr 26 16:03:16 2023 library versions:

tmesh> ^d

Segmentation fault (core dumped)

Reproducibility:

Always happens

Versions:

tme tme-0.12rc10

gcc version 12.2.1 20230201 (GCC)

$ lsb_release -d

Description: Arch Linux

Codename: n/a

$ uname -rvs Linux 6.2.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 20 Apr 2023 16:11:55 +0000

Ticket History (3/9 Histories)

2023-04-27 05:11 Updated by: ambie
  • New Ticket "tmesh core dumps on EOF" created
2023-04-27 07:08 Updated by: ambie
Comentário

tme configure options:

./configure

2023-04-27 08:02 Updated by: phabrics
Comentário

Thank you for your feedback & congratulations on being the first bug reporter! Glad that someone is starting to use/test TME in the wild. Happy that you were able to successfully compile/run it on Arch Linux. I am working on bringing up Arch now so that I may add it to the Pacman repo.

Unfortunately, the "exit" is not graceful right now (Control-C). A signal handler will have to be added to explicitly handle this. I will definitely be adding the appropriate signal handler in the next release. The priority has not been on the command-line interface due to porting issues, but I would like to get it working better now that I see that people are actually starting to use this! Please let me know if you encounter any other issues or difficulties.

2023-04-28 23:01 Updated by: ambie
Comentário

Thanks for your reply. I actually didn't get it to compile on Arch Linux when I opened that bug report. Even though compilation failed it produced binaries somehow.

What went wrong with the compilation is that $as_echo is now completely obsolete even though it only produces a warning when you use it. The resulting shell script produced by M4SH is full of syntax errors due to this issue.

I went through every M4SH file and changed $as_echo to AS_ECHO([ "foo" ]) which was tedious to do.

I put the converted M4SH files in a shar file in a GitHub gist:

https://gist.github.com/ambiamber/3bf143025876dbec9c16c2e5f1f94898

Clicking on that link brings you to a web page with the shar file in it. You can either use "Download Zip" or click on Raw and copy-paste or save the contents. The shar file has instructions at the top (which were added automatically by Gnu shar).

Note that the M4SH files in the shar un-archive into a single directory: m4-files. You have to copy or move them to their correct locations.

Now with M4SH converted it crashes on ctrl-d like this:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Fri Apr 28 09:47:56 2023 library versions: 
tmesh> ^d
Program received signal SIGSEGV, Segmentation fault.
0x00007f78919bbe59 in free () from /usr/lib/libc.so.6
(gdb) where
#0  0x00007f78919bbe59 in free () from /usr/lib/libc.so.6
#1  0x00007f7891b87aca in tme_free (p=0x5589aff5d1b9) at alloc.c:84
#2  0x00005589aff5bf70 in yylex () at ../../tmesh/tmesh-input.y:482
#3  0x00005589aff5a1b7 in yyparse () at tmesh-input.c:1369
#4  0x00005589aff5c275 in _tmesh_yyparse (tmesh=0x5589b098fb50, value=0x7fffea9dc330, _output=0x7fffea9dc3a0, _yield=0x7fffea9dc394)
    at ../../tmesh/tmesh-input.y:631
#5  0x00005589aff5975c in tmesh_eval (_tmesh=0x5589b098fb50, _output=0x7fffea9dc3a0, _yield=0x7fffea9dc394) at tmesh-cmds.c:875
#6  0x00005589aff57b10 in _tmesh_eval () at tmesh.c:394
#7  0x00005589aff57d46 in _tmesh_th (interactive=0x7fffea9dc8f0) at tmesh.c:483
#8  0x00007f7891b880f2 in tme_sjlj_dispatch (passes=1) at threads-sjlj.c:385
#9  0x00007f7891b883d7 in tme_sjlj_threads_main_iter (unused=0x0) at threads-sjlj.c:482
#10 0x00007f7891b8381c in tme_threads_run () at threads.c:118
#11 0x00005589aff58446 in main (argc=1, argv=0x7fffea9dcaa8) at tmesh.c:904
(gdb) frame 1
#1  0x00007f7891b87aca in tme_free (p=0x5589aff5d1b9) at alloc.c:84
84	  free(p);
(gdb) print p
$1 = (void *) 0x5589aff5d1b9
(gdb) list
79	}
80	
81	void
82	tme_free(void *p)
83	{
84	  free(p);
85	}
86	
87	char *
88	tme_strdup(const char *s)
(gdb) frame 2
#2  0x00005589aff5bf70 in yylex () at ../../tmesh/tmesh-input.y:482
482	      tme_free(source->tmesh_io_name);
(gdb) p source
$2 = (struct tmesh_io *) 0x5589b098fbc8
(gdb) p *source
$3 = {tmesh_io_name = 0x5589aff5d1b9 "*stdin*", tmesh_io_private = 0x5589b098f730, tmesh_io_input_line = 2444225664, 
  tmesh_io_getc = 0x5589aff57534 <_tmesh_getc>, tmesh_io_close = 0x5589aff575a9 <_tmesh_close>, 
  tmesh_io_open = 0x5589aff57603 <_tmesh_open>}
(gdb) frame 6
#6  0x00005589aff57b10 in _tmesh_eval () at tmesh.c:394
394	    rc = tmesh_eval(_tmesh, &output, &yield);
(gdb) list
389	    
390	    /* all characters already read have been consumed: */
391	    consumed = input->_tmesh_input_buffer_tail;
392	    
393	    /* run a command: */
394	    rc = tmesh_eval(_tmesh, &output, &yield);
395	    
396	    /* if we're yielding: */
397	    if (yield || _tmesh_io == NULL) {
398	      
(gdb) print _tmesh
$4 = (void *) 0x5589b098fb50
(gdb) print output
$5 = 0x0
(gdb) print yield
$6 = 0
2023-04-29 20:44 Updated by: phabrics
Comentário

Thank you Ambie for doing this. That should be a big help. Note that this was done to improve shell portability to some older shells, particularly on Solaris. It does appear to be obsolete now. I will be adding it to the next commit. Please note that the repo is here but invisible for some reason. You will find it under Source Code->GIT->tme. The address for access is at top right on that page. It erroneously says the repo is empty. I don't know what is going on with OSDN, but it looks like this is the case for all the projects here. I don't know when or why that happened. The GIT repo is still visible under my TME chamber.

Also note that I have updated the AUR TME Package so that it should successfully compile & run without problems. It seems to work for me anyhow. Please see the Wikis or How-Tos in main project page for instructions on install/usage. Let me know if you still have problems with that. Hope this helps!

(Edited, 2023-04-29 20:45 Updated by: phabrics)
2023-04-30 23:22 Updated by: ambie
Comentário

I tried to clone your repo but this happened:

$ git clone https://scm.osdn.net/gitroot/nme/tme.git
Cloning into 'tme'...
remote: Counting objects: 4685, done.
remote: Compressing objects: 100% (1091/1091), done.
remote: Total 4685 (delta 3586), reused 4685 (delta 3586)
Receiving objects: 100% (4685/4685), 6.60 MiB | 3.58 MiB/s, done.
Resolving deltas: 100% (3586/3586), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout
$ cd tme
$ ls
(nothing)

$ git branch -a
  remotes/origin/main
$ git symbolic-ref HEAD refs/heads/master
$ ls
$ git checkout main
branch 'main' set up to track 'origin/main'.
Already on 'main'
$ ls
acinclude.m4 ... and so on for all the files
https://stackoverflow.com/questions/11893678/warning-remote-head-refers-to-nonexistent-ref-unable-to-checkout

(Edited, 2023-04-30 23:45 Updated by: ambie)
2023-05-01 06:53 Updated by: phabrics
Comentário

Specifying -b main to clone should also work. I keep forgetting to specify this. Sorry for the difficulties. I will put it in the Wiki.

2023-05-01 10:10 Updated by: ambie
Comentário
(This comment has been deleted)
2023-05-01 10:10 Updated by: ambie
Comentário

Reply To phabrics

Specifying -b main to clone should also work. I keep forgetting to specify this. Sorry for the difficulties. I will put it in the Wiki.

But your repo is invisible on the osdn website viewer probably because HEAD is not pointing to a ref.

Attachment File List

No attachments

Editar

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login