Showing posts with label rhel. Show all posts
Showing posts with label rhel. Show all posts

Wednesday, August 4, 2010

Windows telnet client displays garbage characters when connected to Red Hat Enterprise Linux

When user connects to Red Hat Enterprise Linux Server 5 using Windows telnet client, and compiles C programs, junk or garbage characters are displayed.

[test@test ~]$ gcc test.c   
test1.c: In function ΓÇÿmainΓÇÖ:

When one connects via telnet from a Windows system to Red Hat Enterprise Linux 5 system, the telnet client uses the character encoding from Windows. This results in the strange characters. Windows does not use utf-8 character encoding like RHEL.




Using putty on Windows as the telnet client solves the issue. In putty, go to Translation -- > change 'ISO-8859-1:1998 (Latin-1, West Europe)' to UTF-8 and then connect .



Monday, March 9, 2009

How to create rpm packages with non stripped binaries in Red Hat Enterprise Linux?

Usually binaries are stripped of the debug information for making them compact. Non-stripped binaries are binaries which have debug information built into them. Non stripped binaries are generally build by passing -g option to gcc.

Rpms shipped with Red Hat Enterprise Linux provides stripped binaries. A separate debuginfo package is provided with all debugging information. Debuginfo rpms for Red Hat Enterprise Linux could be found in following url.

http://people.redhat.com/anderson/debuginfo.html

'file' command could tell if a binary is stripped or not.

# file /usr/bin/python
/usr/bin/python: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), stripped

Some times a non stripped binary will be useful for profiling and debugging.

Below steps could be followed to create an rpm package which provides a non stripped binary. Following is an example of building a python rpm package with non stripped binary.

1. Download the source rpm for the package from rhn.redhat.com.

2. Install the source rpm in the system with following command.

# rpm -ivh python-2.3.4-14.2.src.rpm


3. Edit /etc/rpm/macros and add following line.

%debug_package %{nil}


4. Build the rpm using rpmbuild command.

# rpmbuild -bb /usr/src/redhat/SPECS/python.spec


'-bb' option is given so that a binary package is only created. '-ba' option could build binary and source packages

Binary package will be created under /usr/src/redhat/RPMS/x86_64/

5. Now remove the current rpm with stripped binary and install the new binary rpm package win non stripped binary.

# rpm -e python --nodeps

# rpm -ivh /usr/src/redhat/RPMS/x86_64/python-2.3.4-14.2.x86_64.rpm
Preparing... ########################################### [100%]
1:python ########################################### [100%]

# file /usr/bin/python
/usr/bin/python: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), not stripped

6. For listing symbols from the non stripped binary 'nm' command could be used.

# nm /usr/bin/python


I used RHEL in this example because of familiarity. This should work with almost all rpm based operating system flavors.