Bug 1277996

Summary: loading of zsh modules broken by global enforcement of the '-z now' linker flag
Product: [Fedora] Fedora Reporter: Will Thompson <will>
Component: zshAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: dmaphy, ismail, james.antill, j, kdudka
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: zsh-5.1.1-3.fc24 zsh-5.1.1-3.fc23 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-27 18:23:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Will Thompson 2015-11-04 14:04:12 UTC
My .zshrc has this line:

zmodload zsh/zftp

Since upgrading to F23 this morning, loading this module fails:

/home/wjt/.zshrc:99: failed to load module `zsh/zftp': /usr/lib64/zsh/5.1.1/zsh/zftp.so: undefined symbol: freehostent

A no-op freehostent() is provided by zsh/lib/tcp -- apparently for the sole use of zftp! https://github.com/johan/zsh/search?utf8=%E2%9C%93&q=freehostent -- and indeed if I manually load that module before zftp:

zmodload zsh/net/tcp
zmodload zsh/zftp

Then everything works fine:

% zftp
zftp: not enough arguments

Version-Release number of selected component (if applicable):

zsh-5.1.1-2.fc23.x86_64

Comment 1 Kamil Dudka 2015-11-04 15:42:30 UTC
(In reply to Will Thompson from comment #0)
> A no-op freehostent() is provided by zsh/lib/tcp -- apparently for the sole
> use of zftp!
> https://github.com/johan/zsh/search?utf8=%E2%9C%93&q=freehostent -- and
> indeed if I manually load that module before zftp:
> 
> zmodload zsh/net/tcp
> zmodload zsh/zftp

The above dependency should be handled by zsh as it is part of the metadata:

https://sourceforge.net/p/zsh/code/ci/master/tree/Src/Modules/zftp.mdd

> Version-Release number of selected component (if applicable):
> 
> zsh-5.1.1-2.fc23.x86_64

This is really strange.  If I build zsh-5.1.1-2.fc23.src.rpm in f22 buildroot, the resulting packages work as expected.  If I build it in f23 buildroot, the dependency loading stops working.  Something must have changed in the toolchain between f22 and f23.

Comment 2 Kamil Dudka 2015-11-04 16:21:49 UTC
This seems to be caused by hardening linker flags that were introduced in f23.

I tried to remove '-z now' from the default linker flags:

sudo sed 's/-z now//' -i /usr/lib/rpm/redhat/redhat-hardened-ld

... rebuild zsh-5.1.1-2.fc23 and the problem went away.  So we either need to make zsh module loading work with the '-z now' linker flag, or make its build system drop the flag during the build.

Comment 3 Kamil Dudka 2015-11-05 12:45:25 UTC
The related Fesco ticket:
https://fedorahosted.org/fesco/ticket/1384

A comment on this topic on the upstream mailing-list:
http://www.zsh.org/mla/workers/2015/msg02981.html

Comment 4 Kamil Dudka 2015-11-05 13:27:17 UTC
fixed in zsh-5.1.1-3.fc24

Comment 5 Fedora Update System 2015-11-05 13:51:14 UTC
zsh-5.1.1-3.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-9e91841c99

Comment 6 Fedora Update System 2015-11-06 02:34:31 UTC
zsh-5.1.1-3.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update zsh'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-9e91841c99

Comment 7 Fedora Update System 2015-11-27 18:23:22 UTC
zsh-5.1.1-3.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.