Dr. Werner Fink 2018-03-01 13:42:38 +00:00 committed by Git OBS Bridge
parent 0fa74aba45
commit 653080d4bb
3 changed files with 148 additions and 10 deletions

View File

@ -0,0 +1,47 @@
With ncurses-6.0-20170701.patch
+ improve compatibility between different configurations of new_prescr,
fixing a case with threaded code and term-driver where c++/demo did
not work (cf: 20160213).
the pthread_self(3) function call had been called without checking if the
library libpthread has been linked. This break e.g. grub (boo#1058509) if
statically linked.
---
ncurses/tinfo/lib_setup.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- ncurses/tinfo/lib_setup.c
+++ ncurses/tinfo/lib_setup.c 2018-03-01 10:58:23.280319133 +0000
@@ -830,8 +830,9 @@ _nc_find_prescr(void)
{
SCREEN *result = 0;
PRESCREEN_LIST *p;
+ pthread_t id = ((pthread_self)) ? pthread_self() : (pthread_t)getpid();
for (p = _nc_prescreen.allocated; p != 0; p = p->next) {
- if (p->id == pthread_self()) {
+ if (p->id == id) {
result = p->sp;
break;
}
@@ -848,8 +849,9 @@ NCURSES_EXPORT(void)
_nc_forget_prescr(void)
{
PRESCREEN_LIST *p, *q;
+ pthread_t id = ((pthread_self)) ? pthread_self() : (pthread_t)getpid();
for (p = _nc_prescreen.allocated, q = 0; p != 0; q = p, p = p->next) {
- if (p->id == pthread_self()) {
+ if (p->id == id) {
if (q) {
q->next = p->next;
} else {
@@ -885,7 +887,7 @@ new_prescr(void)
#ifdef USE_PTHREADS
PRESCREEN_LIST *p = typeCalloc(PRESCREEN_LIST, 1);
if (p != 0) {
- p->id = pthread_self();
+ p->id = ((pthread_self)) ? pthread_self() : (pthread_t)getpid();
p->sp = sp;
p->next = _nc_prescreen.allocated;
_nc_prescreen.allocated = p;

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Mar 1 13:39:02 UTC 2018 - werner@suse.de
- Add patch ncurses-6.1-weakpthreads.dif
+ Be aware that libtinfo/libtinfw is also used without libpthread
(boo#1058509)
- Use expect to run at least two test for normal and wide character
version of newdemo from test suite
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Feb 26 09:10:07 UTC 2018 - werner@suse.de Mon Feb 26 09:10:07 UTC 2018 - werner@suse.de

View File

@ -29,6 +29,7 @@ Name: ncurses
%if %{with hasheddb} %if %{with hasheddb}
BuildRequires: db-devel BuildRequires: db-devel
%endif %endif
BuildRequires: expect
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: pkg-config BuildRequires: pkg-config
BuildRequires: screen BuildRequires: screen
@ -66,6 +67,7 @@ Source6: edit.sed
Source7: baselibs.conf Source7: baselibs.conf
Patch0: ncurses-6.1.dif Patch0: ncurses-6.1.dif
Patch1: ncurses-5.9-ibm327x.dif Patch1: ncurses-5.9-ibm327x.dif
Patch2: ncurses-6.1-weakpthreads.dif
Patch4: ncurses-5.7-tack.dif Patch4: ncurses-5.7-tack.dif
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global _miscdir %{_datadir}/misc %global _miscdir %{_datadir}/misc
@ -221,7 +223,7 @@ the ncurses library in its ABI version 5 form.
%package -n tack %package -n tack
Summary: Terminfo action checker Summary: Terminfo action checker
License: GPL-2.0+ License: GPL-2.0-or-later
Group: Development/Tools/Building Group: Development/Tools/Building
Provides: ncurses-devel:%{_bindir}/tack Provides: ncurses-devel:%{_bindir}/tack
Requires: ncurses = %{version}-%{release} Requires: ncurses = %{version}-%{release}
@ -251,6 +253,7 @@ rm -fr tack
tar -xzf %{S:5} tar -xzf %{S:5}
mv tack-* tack mv tack-* tack
%patch1 -p0 -b .327x %patch1 -p0 -b .327x
%patch2 -p0 -b .pth
%patch4 -p0 -b .hs %patch4 -p0 -b .hs
%patch0 -p0 -b .p0 %patch0 -p0 -b .p0
@ -388,6 +391,7 @@ mv tack-* tack
--without-debug \ --without-debug \
--without-profile \ --without-profile \
--without-manpage-tbl \ --without-manpage-tbl \
--without-tests \
--with-shared \ --with-shared \
--with-normal \ --with-normal \
--with-manpage-format=gzip \ --with-manpage-format=gzip \
@ -529,28 +533,46 @@ mv tack-* tack
sh %{S:6} --cflags "-D_GNU_SOURCE -I%{_incdir}/ncursesw" --libs "-lncursesw" --libs "-ltinfow" %{root}%{_bindir}/ncursesw6-config sh %{S:6} --cflags "-D_GNU_SOURCE -I%{_incdir}/ncursesw" --libs "-lncursesw" --libs "-ltinfow" %{root}%{_bindir}/ncursesw6-config
mkdir pc mkdir pc
mv -f %{root}%{_libdir}/pkgconfig/*.pc pc/ mv -f %{root}%{_libdir}/pkgconfig/*.pc pc/
#
# Some tests
#
%if 0%{?qemu_user_space_build:1}%{?_crossbuild}
echo "Skipping tests due to running under QEMU / cross-building"
%else
# #
# Check for tack program on base of above ncurses # Check for tack program on base of above ncurses
# #
LD_LIBRARY_PATH=$PWD/lib LD_LIBRARY_PATH=$PWD/lib
export LD_LIBRARY_PATH PATH export LD_LIBRARY_PATH PATH
pushd tack/ pushd tack/
%if 0%{?qemu_user_space_build:1}%{?_crossbuild}
echo "Skipping LDD test due to running under QEMU / cross-building"
%else
ldd ./tack ldd ./tack
%endif
popd popd
unset LD_LIBRARY_PATH unset LD_LIBRARY_PATH
#
# Make the test suite for ncursesw6
#
pushd test
CFLAGS="$CFLAGS -I%{root}%{_incdir}" LDFLAGS="$LDFLAGS -L%{root}%{_libdir}" \
./configure --with-ncursesw --enable-widec --prefix=$PWD
LD_LIBRARY_PATH=%{root}%{_libdir} \
make %{?_smp_mflags} TEST_ARGS='-lformw -lmenuw -lpanelw -lncursesw -lticw -ltinfow -Wl,--as-needed'
make install TEST_ARGS='-lformw -lmenuw -lpanelw -lncursesw -lticw -ltinfow -Wl,--as-needed'
mv bin binw
make distclean
popd
%endif
test ! -L tack || rm -f tack test ! -L tack || rm -f tack
make clean make clean
> $SCREENLOG
tail -q -s 0.5 -f $SCREENLOG & pid=$!
# #
# Now use --without-pthread to disable pthread support (abi == 5). # Now use --without-pthread to disable pthread support (abi == 5).
# #
> $SCREENLOG
tail -q -s 0.5 -f $SCREENLOG & pid=$!
eval screen -D -m ./${c#*./} --with-abi-version=5 \ eval screen -D -m ./${c#*./} --with-abi-version=5 \
--without-manpages \
--without-progs \
--without-tack \
--without-pthread \ --without-pthread \
--disable-reentrant \ --disable-reentrant \
--disable-opaque-curses \ --disable-opaque-curses \
@ -606,6 +628,9 @@ mv tack-* tack
> $SCREENLOG > $SCREENLOG
tail -q -s 0.5 -f $SCREENLOG & pid=$! tail -q -s 0.5 -f $SCREENLOG & pid=$!
eval screen -D -m ./${c#*./} --with-pthread \ eval screen -D -m ./${c#*./} --with-pthread \
--without-manpages \
--without-progs \
--without-tack \
--enable-reentrant \ --enable-reentrant \
--enable-opaque-curses \ --enable-opaque-curses \
--enable-opaque-form \ --enable-opaque-form \
@ -636,11 +661,29 @@ mv tack-* tack
sh ../edit_man.sh normal installing %{root}%{_mandir} . ncurses6-config.1 sh ../edit_man.sh normal installing %{root}%{_mandir} . ncurses6-config.1
popd popd
mv -f %{root}%{_libdir}/pkgconfig/*.pc pc/ mv -f %{root}%{_libdir}/pkgconfig/*.pc pc/
#
# Some tests
#
%if 0%{?qemu_user_space_build:1}%{?_crossbuild}
echo "Skipping tests due to running under QEMU / cross-building"
%else
#
# Make the test suite for ncurses6
#
pushd test
CFLAGS="$CFLAGS -I%{root}%{_incdir}" LDFLAGS="$LDFLAGS -L%{root}%{_libdir}" \
./configure --with-ncurses --disable-widec --prefix=$PWD
LD_LIBRARY_PATH=%{root}%{_libdir} \
make %{?_smp_mflags} TEST_ARGS='-lform -lmenu -lpanel -lncurses -ltic -ltinfo -Wl,--as-needed'
make install TEST_ARGS='-lform -lmenu -lpanel -lncurses -ltic -ltinfo -Wl,--as-needed'
make distclean
popd
%endif
test ! -L tack || rm -f tack
make clean
# #
# ABI == 5 # ABI == 5
# #
make clean
> $SCREENLOG > $SCREENLOG
tail -q -s 0.5 -f $SCREENLOG & pid=$! tail -q -s 0.5 -f $SCREENLOG & pid=$!
@ -648,6 +691,9 @@ mv tack-* tack
# Now use --without-pthread to disable pthread support (abi == 5). # Now use --without-pthread to disable pthread support (abi == 5).
# #
eval screen -D -m ./${c#*./} --with-abi-version=5 \ eval screen -D -m ./${c#*./} --with-abi-version=5 \
--without-manpages \
--without-progs \
--without-tack \
--without-pthread \ --without-pthread \
--disable-reentrant \ --disable-reentrant \
--disable-opaque-curses \ --disable-opaque-curses \
@ -905,6 +951,42 @@ mv tack-* tack
rm -f %{buildroot}%{_prefix}/lib/terminfo rm -f %{buildroot}%{_prefix}/lib/terminfo
mv pc/*.pc %{buildroot}%{_libdir}/pkgconfig/ mv pc/*.pc %{buildroot}%{_libdir}/pkgconfig/
%if 0%{?qemu_user_space_build:1}%{?_crossbuild}
# No test here
%else
%check
LD_LIBRARY_PATH=%{buildroot}/%{_lib}:%{buildroot}%{_libdir}
export LD_LIBRARY_PATH
pushd test
expect -d <<-'EOF'
set env(TERM) xterm
set timeout 10
spawn -noecho "binw/newdemo"
send -- "x"
sleep 5
send -- "x"
sleep 5
send -- "x"
sleep 5
send -- "q"
wait
EOF
expect -d <<-'EOF'
set env(TERM) xterm
set timeout 10
spawn -noecho "bin/newdemo"
send -- "x"
sleep 5
send -- "x"
sleep 5
send -- "x"
sleep 5
send -- "q"
wait
EOF
popd
%endif
%post -n libncurses5 -p /sbin/ldconfig %post -n libncurses5 -p /sbin/ldconfig
%postun -n libncurses5 -p /sbin/ldconfig %postun -n libncurses5 -p /sbin/ldconfig