Bug 2236684

Summary: Vim-9.0.1822 Perl module segfaults in S_parse_gv_stash_name()
Product: [Fedora] Fedora Reporter: Zdenek Dohnal <zdohnal>
Component: vimAssignee: Zdenek Dohnal <zdohnal>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: gchamoul, iarnell, jplesnik, karsten, kasal, mmaslano, mspacek, perl-devel, ppisar, psabata, rhughes, spotrh, zdohnal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: vim-9.0.1872-1.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-05 13:08:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Full backtrace
none
perl -V from Fedora 40, manually built
none
perl -V - shipped in Ubuntu none

Description Zdenek Dohnal 2023-09-01 08:34:52 UTC
Vim upstream fixed issue with dynamic Perl load in https://github.com/vim/vim/commit/55460da26c2756ec057c03c7d8641eda861bfcd2 - previously Perl was dynamically linked with VIm, which ended up with Vim depending on perl-libs, which was unintentional.

Since the new patchlevel Vim started to segfault when perl module is used. The segfault happens with Perl in all current Fedora releases (F37+).

I've tried to compile Perl 5.38 by myself from upstream tarball and segfault disappeared. The issue is not present in Ubuntu either (compiled upstream Vim with their local Perl).

I'll attach 'perl -V' from my compilation (Fedora 40) and from Ubuntu 23.04, and backtrace from Fedora 40 with packaged Perl.

Reproducible: Always

Steps to Reproduce:
$ sudo dnf -y install https://kojipkgs.fedoraproject.org//packages/vim/9.0.1822/1.fc40/noarch/vim-data-9.0.1822-1.fc40.noarch.rpm https://kojipkgs.fedoraproject.org//packages/vim/9.0.1822/1.fc40/noarch/vim-filesystem-9.0.1822-1.fc40.noarch.rpm https://kojipkgs.fedoraproject.org//packages/vim/9.0.1822/1.fc40/x86_64/vim-common-9.0.1822-1.fc40.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/vim/9.0.1822/1.fc40/x86_64/vim-enhanced-9.0.1822-1.fc40.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/vim/9.0.1822/1.fc40/x86_64/vim-minimal-9.0.1822-1.fc40.x86_64.rpm
$ sudo dnf -y install perl-devel
$ vim -c 'perl print 'hello'' -c 'q!'
Vim: Caught deadly signal SEGV
Vim: Finished.
Segmentation fault (core dumped)
Actual Results:  
Segfault

Expected Results:  
No segfault, return value 0

Comment 1 Zdenek Dohnal 2023-09-01 08:41:38 UTC
Created attachment 1986524 [details]
Full backtrace

Comment 2 Zdenek Dohnal 2023-09-01 08:42:50 UTC
Created attachment 1986525 [details]
perl -V from Fedora 40, manually built

Comment 3 Zdenek Dohnal 2023-09-01 08:43:31 UTC
Created attachment 1986526 [details]
perl -V - shipped in Ubuntu

Comment 4 Zdenek Dohnal 2023-09-01 08:47:54 UTC
In case you would like to try building Vim from upstream, here are steps (in Fedora 40 virtual machine from tmt):

# dnf -y install libtool git-core
# dnf download --source vim
# dnf -y builddep *.src.rpm
# git clone https://github.com/vim/vim
# cd vim
# make distclean && export CFLAGS=""; export CFLAGS="$CFLAGS -fPIC -fPIE"; ./configure --enable-perlinterp=dynamic --with-x=no --enable-gui=no && make && ./src/vim -c 'perl print 'hello'' -c 'q!'

Comment 5 Jitka Plesnikova 2023-09-01 09:00:54 UTC
Thanks for the report. I can reproduce the issue.
I look at it.

Comment 6 Zdenek Dohnal 2023-09-05 13:08:13 UTC
Perl works with the newest Vim patchlevel.

Comment 7 Zdenek Dohnal 2023-09-05 13:09:07 UTC
The current CI run still fails, but no due Perl https://artifacts.dev.testing-farm.io/79be01d0-25f2-4b02-be54-27983d6e8b82/ .