[CentOS] Workaround for (EL6.4) rdesktop-1.6.0-10 Woe

Thu Nov 7 15:51:48 UTC 2013
Cal Webster <cwebster at ec.rr.com>

rdesktop has been spewing error messages since the update to CentOS 6.4.
Aside from the continuous stream of errors in the terminal window from
which it was launched, there are a number of usability issues in the
remote session. The pointer does not change shape when moving over
various window components such as column separators, window borders,
etc. The background doesn't refresh within scroll bars, making it
difficult to tell where the scroll handle is. We've also found that MS
Visio will crash and hang the remote system if run within rdesktop.
Other strange phenomenon are also manifest in various applications. In
short, rdesktop 1.6.0-10 is buggy and unstable. See this upstream bug
report for more:

Bug 914279 - regression in 1.6.0-10.el6: Mousepointer and selections not
drawn properly

We've been putting up with it, hoping that an update would be published
upstream. Even though this issue is affecting customers upstream, as
evidenced in the bugzilla report, a bug-fix update doesn't appear to be
imminent. I decided to rebuild the Fedora 19 SRPM on CentOS to resolve
the issue. It appears from the bugzilla remarks that others have done
this trivially. With a few simple precautions, we've done just that. I'm
sharing our work-around in the hope that it will benefit others in
similar circumstances.

This process assumes you have a build machine properly setup with an
rpmbuild environment. If you don't, see this article:

Set Up an RPM Build Environment under CentOS

Note: Watch for line-wrap below.

Best Regards,

--Cal Webster

=============[Rdesktop Workaround]=============

##>> Retrieve and install the CentOS source RPM:

rpm -iv

##>> Set aside the sources:

[iseo at jato ~]$ cd rpmbuild/SOURCES/
[iseo at jato SOURCES]$ mkdir rdesktop-1.6.0-10
[iseo at jato SOURCES]$ mv *.patch rdesktop-1.6.0.tar.gz rdesktop-1.6.0-10/

##>> Rename the CentOS spec file:

[iseo at jato SOURCES]$ cd ../SPECS/
[iseo at jato SPECS]$ mv rdesktop.spec rdesktop.spec.centos

##>> Retrieve and install the Fedora source RPM from your favorite
(watch for line-wrap in URL)

rpm -iv

##>> Rename the Fedora spec file then use the CentOS spec file:

[iseo at jato SPECS]$ mv rdesktop.spec rdesktop.spec.fc19
[iseo at jato SPECS]$ cp rdesktop.spec.centos rdesktop.spec

##>> Edit the CentOS spec file:

Change version and release to reflect FC19 package
Add version suffix to designate local RPM
Remove original CentOS patch references and replace with those from FC19
Add comments in change log

[iseo at jato SPECS]$ vi rdesktop.spec
Version:        1.7.1
Release:        2%{?dist}.1.iseo
Patch0:         %{name}-libao.patch
%setup -q
%patch0 -p1 -b .ao
* Fri Nov  1 2013 Cal Webster <cwebster at bizec.rr.com> 1.7.1-2
- Latest version not available upstream
- This version from FC19
- Fixes regression errors (NOT IMPLEMENTED RDP5 opcodes, get cursor,
- Fixes mouse cursor not changing and background showing through
- Fixes freeze on remote system
- See https://bugzilla.redhat.com/show_bug.cgi?id=914279

##>> You might need to install pcsc-lite-devel if you get a build
dependency error. It's not installed by default.

[root at jato ~]# yum install pcsc-lite-devel

[root at jato ~]# 

##>> You will also need to modify /usr/include/ao/ao.h to overcome this
build error:

[iseo at jato rpmbuild]$ rpmbuild -ba --sign --clean SPECS/rdesktop.spec
gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall
-I/usr/include   -pthread -I/usr/include/PCSC       -DPACKAGE_NAME=
\"rdesktop\" -DPACKAGE_TARNAME=\"rdesktop\" -DPACKAGE_VERSION=\"1.7.1\"
\"/usr\" -DHAVE_XRANDR=1 -DWITH_SCARD=1 -DEGD_SOCKET=\"/var/run/egd-pool
\"/usr/share/rdesktop/keymaps/\" -o orders.o -c orders.c
rdpsnd_libao.c: In function 'libao_open':
rdpsnd_libao.c:78: error: 'ao_sample_format' has no member named
rdpsnd_libao.c: In function 'libao_set_format':
rdpsnd_libao.c:117: error: 'ao_sample_format' has no member named
make: *** [rdpsnd_libao.o] Error 1
make: *** Waiting for unfinished jobs....
error: Bad exit status from /var/tmp/rpm-tmp.wkIC6X (%build)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.wkIC6X (%build)
[iseo at jato rpmbuild]$ 

##>> Make a backup copy of ao.h:

cp /usr/include/ao/ao.h /usr/include/ao/ao.h.orig

##>> Open ao.h in vi editor and search for the ao_sample_format type
definition. Then add the "matrix" line at the bottom.

vi /usr/include/ao/ao.h
typedef struct ao_sample_format {
	int bits; /* bits per sample */
	int rate; /* samples per second (in a single channel) */
	int channels; /* number of audio channels */
	int byte_format; /* Byte ordering in sample, see constants below */
	char *matrix; /* channel input matrix */
} ao_sample_format;

##>> Make a copy of the modified ao.h in case it gets overwritten later:

cp /usr/include/ao/ao.h /usr/include/ao/ao.h.withMatrix

##>> The build should now complete without incident:

[iseo at jato rpmbuild]$ rpmbuild -ba --sign --clean SPECS/rdesktop.spec
Generating signature: 1005
Wrote: /home/iseo/rpmbuild/SRPMS/rdesktop-1.7.1-2.el6.1.iseo.src.rpm
Generating signature: 1005
Wrote: /home/iseo/rpmbuild/RPMS/x86_64/rdesktop-1.7.1-2.el6.1.iseo.x86_64.rpm
Generating signature: 1005
Wrote: /home/iseo/rpmbuild/RPMS/x86_64/rdesktop-debuginfo-1.7.1-2.el6.1.iseo.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.JeWQeP
+ umask 022
+ cd /home/iseo/rpmbuild/BUILD
+ cd rdesktop-1.7.1
+ rm
-rf /home/iseo/rpmbuild/BUILDROOT/rdesktop-1.7.1-2.el6.1.iseo.x86_64
+ exit 0
Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.wRDJyS
+ umask 022
+ cd /home/iseo/rpmbuild/BUILD
+ rm -rf rdesktop-1.7.1
+ exit 0
[iseo at jato rpmbuild]$ 

Your install RPM is in ~/rpmbuild/RPMS/{i386,x86_64}/
You can now copy the RPM to any CentOS 6.4 machine of the same
architecture and update rdesktop.

yum localupdate rdesktop-1.7.1-2.el6.1.iseo.x86_64.rpm


If you maintain a local, custom repo like we do just copy the rpm there
and update your repo metadata so it'll be installed during the next
update cycle.

[root at pegasus ~]# yum list rdesktop
Loaded plugins: downloadonly, fastestmirror, priorities,
              : security
Loading mirror speeds from cached hostfile
 * base: ftpserver
56 packages excluded due to repository priority protections
Installed Packages
rdesktop.i686                  1.6.0-10.el6
Available Packages
rdesktop.i686                  1.7.1-2.el6.1.iseo
[root at pegasus ~]# 

=============[/Rdesktop Workaround]=============