Legacy Man

Legacy Man

by Mauriat Miranda
(with apologies to Billy Joel)

It’s nine o’clock on a Wednesday
The regular files are looking neat
There’s an old dev sitting next to me
Trackin’ bugs in his Excel spreadsheet

He says, “Son, can you debug this memory
I’m not really sure how it works
But it’s bad and discrete and I knew it complete
When I wrote a younger man’s code.”

La la la, di da da
La la, di di da da dum

Write us a hack, you’re the legacy man
Write us a hack tonight
Well, we’re not in the mood for an upgrade
And you’ve got it compiling all right

Now John in support is a friend of mine
He helps me debug in C
And he’s quick with a fix or promoting Linux
But there’s some apps that he’d rather see

He says, “Bill, I believe this is boring me.”
As his mouse clicks away through his trace
“Well I’m sure that I could sell iPhone apps
If I could get out of this place”

Oh, la la la, di da da
La la, di da da da dum

Now Santosh is a database analyst
Who never has time for his wife
And he’s talkin’ with Louie, who codes like a newbie
And probably will do for life

And the IT are enforcing policies
As the senior devs slowly check nodes
Yes, they’re using an app they call hopelessness
But it’s better than writing new code

Write us a hack, you’re the legacy man
Write us a hack tonight
Well, we’re not in the mood for an upgrade
And you’ve got it compiling all right

It’s a pretty big patch for a testing day
And the managers change the release
‘Cause they know that today, there is nothing I’d say
To cause their process to cease

And the desktop, it looks like a Commodore
And the Microsoft disks are near
And they run all their builds and think bugs are all killed
And say, “Man, how is this workin’ here?”

Oh, la la la, di da da
La la, di da da da dum

Write us a hack, you’re the legacy man
Write us a hack tonight
Well, we’re not in the mood for an upgrade
And you’ve got it compiling all right

Automated FTP Script

I’ve been doing some development for some embedded Linux devices which only support ftp and telnet. In order to automate transfer of binaries from my Fedora development host to the target embedded device I’m using this handy ftp script: pushftp.sh

#!/bin/bash

# arg1 = dest hostname
# arg2 = local file
# arg3 = dest dir

HOST=$1
SRCFILE=$2

USER=root
PASSWD=password
#DESTDIR=/usr/local/data
DESTDIR=$3

ftp -inv $HOST<<ENDFTP
user $USER $PASSWD
cd $DESTDIR
bin
put $SRCFILE
chmod 755 $SRCFILE
bye
ENDFTP

Then I added something like this to my Makefile after cross-compiling:

push:
        sh ~/bin/pushftp.sh $(TEST_BOX) $(APP_BIN) /usr/local/data

So after I run make all, I run make push. I still need to telnet to the host to test/debug the application, but this makes the process much faster (and less error-prone).

I’m just noting this for myself, hopefully it’s useful to someone else.

Downside to Enterprise Linux

(Note: For the purpose of this post CentOS is equivalent to RHEL)

It has been about 2 and 1/2 years since I built a dedicated server and chose CentOS instead of Fedora. Since I installed CentOS 5.1 I have used the upgrade process 4 times with no problems bringing me to version 5.5 with practically no re-installation, re-configuration or troubleshooting upgrade issues. This is the goal of enterprise linux. A long term stable solution with no major changes to preserve compatibility with every piece of software that was provided since it was released (in this case April 2007). In the time I’ve been on CentOS I’ve upgrade/replaced Fedora at least 5 times on other machines. Each time learning the changes to software, languages, security and many other components.

I’m very pleased with CentOS knowing that after the next yum update all my software will keep working. And everything is 100% secure.

However the exact reason enterprise linux is so great is also the exact reason why it can be a major pain. Once a main component is locked down, Red Hat will not provide updates unless needed for security or stability.

An objective for my server was for web development. The state of web as defined in 2007 when RHEL was created is coming close to obsolete. CentOS 5 includes PHP version 5.1.6. However PHP 5.2, which was released before RHEL 5, has become the default standard requirements for many PHP applications. I was updating some code to utilize JSON when I realized I would have to deviate from standard updates to install PHP 5.2 on CentOS. (This wasn’t too bad)

Another objective was a file server and backups. I’ve been playing with DropBox (*) as means of an off-site backup solution. What makes it great is it’s support for Linux! Even text-based linux which is what my server is. However the first requirement is Python 2.5. CentOS uses 2.4, and you can’t do a major update of Python in a CentOS/Fedora install without breaking many things since this is a critical component. You can do a parellel install for Python 2.5 but this is a bit annoying to maintain as you have 2 versions of python installed. (I have yet to get Dropbox working well on my server)

I also have been writing C++ software using boost. I recently realized the asio library was standard in boost 1.37 and later. I was locked to 1.33 in CentOS 5. No big deal since, the boost package was not critical for me in CentOS and it could be easily replaced. So I decided to recompile a newer Fedora boost src.rpm. However I would see errors like this:

error: unpacking of archive failed on file /home/mirandam/rpmbuild/SOURCES/boost-1.41.0-iostreams-zlib.patch;4c7880e5: cpio: MD5 sum mismatch

The above error is simply because Fedora 12 changed the RPM compression algorithm used and rendered older versions of RPM incompatible with newer packages. I don’t dare meddle with RPM as it is a core component, so I ended up compiling an older Fedora 11 version of boost 1.37 src.rpm which did the job.

Overall I’m still happy with my setup, but slowly I’m spending a great deal of time patching different pieces as my needs have slowly evolved. Interestingly Red Hat recently announced extended support lasting up to 10 years. That seems way too long considering the state of software (although everyone still uses Windows XP – now 9 years old).

I’m getting a little antsy running 3 year old software. The good news is that RHEL 6 is in beta, which means that soon after release the totally free CentOS 6 will follow as well. Which I’m eagerly waiting for, because all my issues will be addressed … at least for the time being.

(*) Affiliate link – I highly recommend Dropbox.

Sun Java Changes

Sun has made a significant step for providing users and developers better access and freedom with Java. Sun announced this week they will be open sourcing key parts of Java under the GPL. In effect most users should not see a direct impact on their Java usage, however in the long term Java will have a more widespread usage, subject to fewer problem and more readily available on different systems.

Due to licensing and Sun’s tight control of Java (TM), an open implementation of a Java compiler (GCJ) is being actively developed. Previously any Java developer risked the possibility that an adverse change in policy by Sun could affect their Java development. Although the intention is good, the vast majority of developers still used Sun Java, leaving GCJ very immature. Distributions like Fedora included GCJ, but prohibited Sun Java. However since most GPL software is acceptable in Linux distributions, Java will most likely will show up in Fedora, Debian and others which formerly banned it. At least it should make for an easier installation of Java in Fedora Core!

In other developments, Sun has release the Java 1.6 RC (Release Candidate). Included in the Desktop Features are improvements to the GTK look and feel. Hopefully this should make Gnome Eclipse users happier!

For those who wish to try Java 1.6 along side 1.5 in Fedora Core:

Download the JRE (jre-6-rc-linux-i586.bin) from … Sun Early Access Downloads.

As root:

# sh jre-6-rc-linux-i586.bin
# mv jre1.6.0 /opt/jre1.6
# alternatives --install /usr/bin/java java /opt/jre1.6/bin/java 3
# echo 3 | /usr/sbin/alternatives --config java

# java -version
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b104)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b104, mixed mode, sharing)

I don’t recommend testing the web browser plugin (as if Firefox doesn’t have enough reasons to crash). However playing around with Eclipse may be nice to see if you notice any changes!

Linux Kernel Documentation

Within every release of the official kernel source from kernel.org there is a provided /Documentation directory. This directory contains various notes, guides, tips, documentation, explanations and otherwise useful information. Majority of this content is provided in pure text format.

I thought it would be convenient if I could navigate through this infomation on the internet. So I decided to host it myself.

Information on my Kernel Documentation pages

Linux Kernel Documentation

I converted every file into web formatted pages with the following features:

  • All URL’s are converted to clickable links (anchors). (There are some bugs)
  • All email addresses have been (simply) obfuscated.
  • Every page is connected to the directory in which it resides.
  • All files have line numbers to easily point to specific content.
  • Line numbers can be temporarily disabled to allow for east cut-and-paste without numbers. (Javascript required)

I know that others have done this before, but I wanted to do this for my own personal usage and convenience. I wanted to be able to link to content easily from my own Linux Resources guides and documentation.

I tried to put in as many features as I thought would be helpful for myself as well as others. However I wouldn’t mind adding more features for others.

I will try to update with every new kernel release that has updated documentation files.

Finally I want to express my appreciation and respect for every person who has contributed to the Linux kernel and to open source projects in general. The content provided is from the official kernel source and copyrighted its respective authors.

Using Alternate Compilers

Users of Fedora Core 4, SuSE 10.0 and other distributions with GCC v4 may have found some open source softwares may not compile properly. Using alternate compilers may resolve the problem. FC4 also ships with GCC v3.2. There are many ways to specify alternate compilers during the build process, below are some ways.

Environment Variables
Most softwares support the CC and CXX environment variables. First assign them, then run configure or make. Example:

# export CC=gcc32
# export CXX=g++32
# ./configure

A good example can be found on the Redhat Mailing List.

Configure Support
If the software is using the standard GNU automake and configure, then there is a chance it supports other compilers by passing in a setting to the configure script. First run configure --help to see if it mentions anything. The following example is from MPlayer:

# ./configure --help
# ./configure --cc=gcc32

Makefile Support
Sometimes the software may just come with a Makefile. Open the Makefile and look inside to see if there are variables that specify the compiler. You can either edit those variables or set them at compile time. For example:

(in Makefile)

C_COMPILER = cc
CPLUSPLUS_COMPILER = c++

Then using the makefile, you can run:

# make CPLUSPLUS_COMPILER=g++32

Although the above examples are not exhaustive they should provide some ideas for using alternate compilers in Fedora Core and other Linux distributions.

I am also providing some notes from my FC4 Guide on GCC and GCC Compatability Libraries.