Hundreds of new open source software projects are published on Internet each day. The vast majority are built by private individuals in their spare time, or at least this is how the projects are starting. The usefulness of these projects is secondary in nature, most of the time the goal is learning and personal development, or how somebody else put it, scratching one developer’s personal itch.
This blog post is about how to package and publish an open-source project. I have this source code just sitting there on my hard drive, I wrote it some time ago, other people might find it interesting. Let’s start with the itch.
Many people are very surprised when they find out telnet protocol requires more than a TCP socket connection between a client and a server. There are two tty terminals involved, one on the server side, and one on the client side. These terminals are synchronized by special messages sent over the socket connection, mangled with the session data.
To figure it out, I can start by reading a long list of RFCs, or I can take a shortcut and try to lift it from a wireshark trace:
Recent versions of Linux glibc (2.x) include a a malloc() implementation tunable using environment variables. This allows the user to diagnose allocation problems such as heap corruption, double free etc.
When MALLOC_CHECK_ is set to 3, a diagnostic message is printed on stderr and the program is aborted. A value of 0 disables the diagnostic – see man malloc for more details.
Setting the MALLOC_PERTURB_ environment variable causes the malloc functions in libc to return memory which has been wiped and initialized with the byte value of the environment variable. Setting MALLOC_PERTURB_ to zero disables the feature.
No special arguments need to be passed during program compilation. These diagnostics work on any precompiled programs. Unlike valgrind, the speed of execution is not affected.
$ export MALLOC_CHECK_=3
$ export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
SendEmail is a lightweight command line SMTP agent. It was designed to be easily integrated in bash scripts, Perl programs etc. The program is in fact a Perl script, and it is distributed under GPL license. This is how you can send emails from command line using SendEmail and a regular gmail or yahoo account.
ezchroot is a small script to chroot into OpenVZ containers. Once inside, you can update or modify the container software. The operation is similar to ezlxc.
if [ $# -gt 0 ]; then
echo "Usage: ezchroot directory"
cp -L /etc/resolv.conf $1/etc/.
mount -t proc none $1/proc
mount --rbind /dev $1/dev
mount --rbind /sys $1/sys
echo "entering chroot directory"
env NAME=chroot chroot $1 /bin/bash
echo "chroot exited"
This is a simple telnet client written in C. In the negotiation phase of the connection it will respond with WONT to any DO coming from the server, and it will encourage the server to DO anything it offers with WILL. The only exception is the screen size setting, advertised as 24 x 80 by the client.
if [ expression ]
elif [ expression2 ]