[CWB] Segmentation fault
Hardie, Andrew
a.hardie at lancaster.ac.uk
Fri May 1 20:47:52 CEST 2020
I’ve reproduced this, minimal steps:
* download the 3.0.0 distribution tar.gz file for Linux x64
* extract only the CQP binary and place into any folder
* run cqp
* see:
andrew at ninja:~/Share/Transfer$ ./cqp
Segmentation fault
andrew at ninja:~/Share/Transfer$ ./cqp -c
Segmentation fault
andrew at ninja:~/Share/Transfer$ ./cqp -h
Segmentation fault
andrew at ninja:~/Share/Transfer$ ./cqp -v
Segmentation fault
HOWEVER, when I export the 3.0 branch and build it on my current desktop VM (which runs Debian buster), it starts without any segfault. Albeit this is 3.0.3 not 3.0.0.
I suspect this is going to be almost impossible to debug as recreating a circa 2010 build environment for the purpose is going to be a tall order.
The answer is probably either to rebuild 3.0.0 from source, or to use 3.0.3 instead.
best
Andrew.
From: cwb-bounces at sslmit.unibo.it <cwb-bounces at sslmit.unibo.it> On Behalf Of Maarten Janssen
Sent: 01 May 2020 15:42
To: Stefan Evert <stefanML at collocations.de>
Cc: CWBdev Mailing List <cwb at sslmit.unibo.it>
Subject: Re: [CWB] Segmentation fault
Hi Stefan,
Sorry for the delay in response, but I am trying this on quite a few Linux flavours atm, so my Debian installation was gone for a while. It is strange not many more people have this problem, since it is really just an out-of-the-box Debian 10 (buster) installation, fresh and clean, where I run the standard CWB install script; it works without a problem on other Debian flavours like Mint and Ubuntu, but on buster it gives this problem. Maybe I am doing something wrong, but like I said, it works like a charm on Ubuntu and Mint - so the idea behind it cannot be all bad. The only thing it runs is what it says on the website - here is the underlying Perl code of what the installer tries to do - which should be straightforward, but hence does not work on buster:
if ( $os eq 'debian' ) {
$cwbname = "cwb-3.0.0-osx-10.5-universal.tar";
$cwbpath = "https://sourceforge.net/projects/cwb/files/cwb/cwb-3.0.0/cwb-3.0.0-osx-10.5-universal.tar.gz/download<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fcwb%2Ffiles%2Fcwb%2Fcwb-3.0.0%2Fcwb-3.0.0-osx-10.5-universal.tar.gz%2Fdownload&data=02%7C01%7Ca.hardie%40lancaster.ac.uk%7C58a1d14686ba4a18343908d7eddde327%7C9c9bcd11977a4e9ca9a0bc734090164a%7C0%7C1%7C637239409577942936&sdata=E8t8PzFxgMyT%2B32gITaff0pNsHmIEgqimmx0s54CorQ%3D&reserved=0>";
} elsif ( $os eq 'solaris') {
$cwbname = "cwb-3.0.0-solaris-sparc";
$cwbpath = "https://sourceforge.net/projects/cwb/files/cwb/cwb-3.0.0/cwb-3.0.0-solaris-sparc.tar.gz/download<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fcwb%2Ffiles%2Fcwb%2Fcwb-3.0.0%2Fcwb-3.0.0-solaris-sparc.tar.gz%2Fdownload&data=02%7C01%7Ca.hardie%40lancaster.ac.uk%7C58a1d14686ba4a18343908d7eddde327%7C9c9bcd11977a4e9ca9a0bc734090164a%7C0%7C1%7C637239409577942936&sdata=RiceNybCSCBRrisAyqxB53ZWzv1Qf1cJI5Guqb5bAqA%3D&reserved=0>";
} elsif ( !$Config{use64bitint} ) {
$cwbname = "cwb-3.0.0-linux-i386";
$cwbpath = "https://sourceforge.net/projects/cwb/files/cwb/cwb-3.0.0/cwb-3.0.0-linux-i386.tar.gz/download<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fcwb%2Ffiles%2Fcwb%2Fcwb-3.0.0%2Fcwb-3.0.0-linux-i386.tar.gz%2Fdownload&data=02%7C01%7Ca.hardie%40lancaster.ac.uk%7C58a1d14686ba4a18343908d7eddde327%7C9c9bcd11977a4e9ca9a0bc734090164a%7C0%7C1%7C637239409577952886&sdata=IM47s2mtUpox9dqK0cNv%2FemePDnAovCk23%2BjjL6ZxcQ%3D&reserved=0>";
} else {
$cwbname = "cwb-3.0.0-linux-x86_64";
$cwbpath = "https://sourceforge.net/projects/cwb/files/cwb/cwb-3.0.0/cwb-3.0.0-linux-x86_64.tar.gz/download<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fcwb%2Ffiles%2Fcwb%2Fcwb-3.0.0%2Fcwb-3.0.0-linux-x86_64.tar.gz%2Fdownload&data=02%7C01%7Ca.hardie%40lancaster.ac.uk%7C58a1d14686ba4a18343908d7eddde327%7C9c9bcd11977a4e9ca9a0bc734090164a%7C0%7C1%7C637239409577952886&sdata=Gr5tPrayQW85yaFpzryMe%2FpbPsY63XcmGEPViMqKeH0%3D&reserved=0>";
};
print "Attempting to install CWB - version $cwbname\n";
print "Downloading\n";
print `wget $cwbpath`;
print "Installing\n";
`tar -zxvf download`;
print `cd $cwbname ; sh install-cwb.sh`;
The “set h off” indeed solveds the problem with the (null), and you get the output you would expect; but still, only while running under valgrind; just running cqp (with any arguments) still gives a segmentation fault. Under valgrind it works, but it does throw a whole lot of warning, as pasted below (in TEITOK, the registry is stored in the project folder, hence the -r but that should not change anything). Any idea what I would have to do different to make this work under Debian 10?
Maarten
root at debian:/var/www/html/teitok/new# valgrind cqp -e -r cqp -D TT-DEFMIN
==3104== Memcheck, a memory error detector
==3104== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3104== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==3104== Command: cqp -e -r cqp -D TT-DEFMIN
==3104==
==3104== Conditional jump or move depends on uninitialised value(s)
==3104== at 0x490053: __linkin_atfork (in /usr/local/bin/cqp)
==3104== by 0x4660A2: ptmalloc_init (in /usr/local/bin/cqp)
==3104== by 0x46A313: malloc_hook_ini (in /usr/local/bin/cqp)
==3104== by 0x4C0BF2: _dl_init_paths (in /usr/local/bin/cqp)
==3104== by 0x49126A: _dl_non_dynamic_init (in /usr/local/bin/cqp)
==3104== by 0x491B22: __libc_init_first (in /usr/local/bin/cqp)
==3104== by 0x44F752: (below main) (in /usr/local/bin/cqp)
==3104==
==3104== Conditional jump or move depends on uninitialised value(s)
==3104== at 0x4902DD: __strcpy_chk (in /usr/local/bin/cqp)
==3104== by 0x40D357: load_corpusnames (in /usr/local/bin/cqp)
==3104== by 0x40D4F7: check_available_corpora (in /usr/local/bin/cqp)
==3104== by 0x40154C: initialize_cqp (in /usr/local/bin/cqp)
==3104== by 0x400695: main (in /usr/local/bin/cqp)
==3104==
==3104== Conditional jump or move depends on uninitialised value(s)
==3104== at 0x46C7ED: strcat (in /usr/local/bin/cqp)
==3104== by 0x40D221: load_corpusnames (in /usr/local/bin/cqp)
==3104== by 0x40D4F7: check_available_corpora (in /usr/local/bin/cqp)
==3104== by 0x40154C: initialize_cqp (in /usr/local/bin/cqp)
==3104== by 0x400695: main (in /usr/local/bin/cqp)
==3104==
==3104== Conditional jump or move depends on uninitialised value(s)
==3104== at 0x46C8CD: strcat (in /usr/local/bin/cqp)
==3104== by 0x40D221: load_corpusnames (in /usr/local/bin/cqp)
==3104== by 0x40D4F7: check_available_corpora (in /usr/local/bin/cqp)
==3104== by 0x40154C: initialize_cqp (in /usr/local/bin/cqp)
==3104== by 0x400695: main (in /usr/local/bin/cqp)
==3104==
==3104== Conditional jump or move depends on uninitialised value(s)
==3104== at 0x46C7ED: strcat (in /usr/local/bin/cqp)
==3104== by 0x40D24B: load_corpusnames (in /usr/local/bin/cqp)
==3104== by 0x40D4F7: check_available_corpora (in /usr/local/bin/cqp)
==3104== by 0x40154C: initialize_cqp (in /usr/local/bin/cqp)
==3104== by 0x400695: main (in /usr/local/bin/cqp)
==3104==
==3104== Conditional jump or move depends on uninitialised value(s)
==3104== at 0x451E4C: __ctype_toupper_loc (in /usr/local/bin/cqp)
==3104== by 0x40D2AE: load_corpusnames (in /usr/local/bin/cqp)
==3104== by 0x40D4F7: check_available_corpora (in /usr/local/bin/cqp)
==3104== by 0x40154C: initialize_cqp (in /usr/local/bin/cqp)
==3104== by 0x400695: main (in /usr/local/bin/cqp)
==3104==
==3104== Conditional jump or move depends on uninitialised value(s)
==3104== at 0x451E0C: __ctype_tolower_loc (in /usr/local/bin/cqp)
==3104== by 0x40C1FC: changecase_string (in /usr/local/bin/cqp)
==3104== by 0x40C8D4: GetSystemCorpus (in /usr/local/bin/cqp)
==3104== by 0x40D304: load_corpusnames (in /usr/local/bin/cqp)
==3104== by 0x40D4F7: check_available_corpora (in /usr/local/bin/cqp)
==3104== by 0x40154C: initialize_cqp (in /usr/local/bin/cqp)
==3104== by 0x400695: main (in /usr/local/bin/cqp)
==3104==
==3104== Conditional jump or move depends on uninitialised value(s)
==3104== at 0x451E8C: __ctype_b_loc (in /usr/local/bin/cqp)
==3104== by 0x4335F3: component_full_name (in /usr/local/bin/cqp)
==3104== by 0x4334B4: declare_component (in /usr/local/bin/cqp)
==3104== by 0x4337EB: declare_default_components (in /usr/local/bin/cqp)
==3104== by 0x434454: cregparse (in /usr/local/bin/cqp)
==3104== by 0x431C08: setup_corpus (in /usr/local/bin/cqp)
==3104== by 0x40C8E2: GetSystemCorpus (in /usr/local/bin/cqp)
==3104== by 0x40D304: load_corpusnames (in /usr/local/bin/cqp)
==3104== by 0x40D4F7: check_available_corpora (in /usr/local/bin/cqp)
==3104== by 0x40154C: initialize_cqp (in /usr/local/bin/cqp)
==3104== by 0x400695: main (in /usr/local/bin/cqp)
==3104==
==3104== Conditional jump or move depends on uninitialised value(s)
==3104== at 0x46C9DB: index (in /usr/local/bin/cqp)
==3104== by 0x40DD7D: findcorpus (in /usr/local/bin/cqp)
==3104== by 0x40E0AE: set_current_corpus_name (in /usr/local/bin/cqp)
==3104== by 0x401562: initialize_cqp (in /usr/local/bin/cqp)
==3104== by 0x400695: main (in /usr/local/bin/cqp)
==3104==
==3104== Conditional jump or move depends on uninitialised value(s)
==3104== at 0x46C9DB: index (in /usr/local/bin/cqp)
==3104== by 0x40DE64: findcorpus (in /usr/local/bin/cqp)
==3104== by 0x40E0AE: set_current_corpus_name (in /usr/local/bin/cqp)
==3104== by 0x401562: initialize_cqp (in /usr/local/bin/cqp)
==3104== by 0x400695: main (in /usr/local/bin/cqp)
==3104==
TT-DEFMIN>
On 23 Apr 2020, at 10:49, Stefan Evert <stefanML at collocations.de<mailto:stefanML at collocations.de>> wrote:
On 22 Apr 2020, at 19:14, Maarten Janssen <maartenpt at gmail.com<mailto:maartenpt at gmail.com>> wrote:
I am trying to create a TEITOK installer that installs all the required dependencies automatically, but when testing system, I ran into this weird issue with issue with CWB: on Debian, when I run the standard install script of CWB, it gives me a segmentation fault; and when trying to pinpoint the problem, running it with valgrind avoids the problem altogether, and it happily starts cqp -e - but it somehow does give a very strange type of output on a simple [word=".*"]:
0: <(null)This(null)> is my first little TEITO
1: This <(null)is(null)> my first little TEITOK c
Did anybody see that problem before, and/or have any clue how to solve it
Wild guess after a quick look at the source code: the (null) values are probably where CQP tries to emit terminal escapes for highlighting.
If this is the case, then something must be wrong with your termcap library, especially if it also segfaults during compilation. CQP does check for NULL values and changes them to empty strings, so it's a bit mysterious how this would lead to a segfault.
Quick test: in CQP enter
set h off;
before carrying out the search and see if you still get a segfault / NULL values. You can also run CQP in child mode (cqp -c), but keep in mind that autoshow is off then and you need to "cat;" after the query do display results.
Best,
Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://liste.sslmit.unibo.it/pipermail/cwb/attachments/20200501/15d354c5/attachment-0001.html>
More information about the CWB
mailing list