Wednesday, July 27, 2005

Subversion Bug of libintl_dgettext

> /usr/local/bin/msgfmt -o subversion/po/es.mo subversion/po/es.po
> cd subversion/libsvn_subr && /bin/bash /usr/src/svn/libtool --silent --mode=link cc -g -g
> -DNEON_ZLIB -DNEON_SSL -R/usr/local/db42/lib -L/usr/local/db42/lib -L/usr/local/lib -rpath
> /usr/local/svn11/lib -o libsvn_subr-1.la -no-undefined auth.lo cmdline.lo config.lo config_auth.lo
> config_file.lo config_win.lo date.lo error.lo hash.lo io.lo md5.lo opt.lo path.lo pool.lo
> quoprint.lo sorts.lo stream.lo subst.lo svn_base64.lo svn_string.lo target.lo time.lo utf.lo
> utf_validate.lo validate.lo xml.lo /usr/local/lib/libaprutil-0.la -ldb -lexpat
> /usr/local/lib/libapr-0.la -lsendfile -lrt -lm -lsocket -lnsl -lresolv -lpthread -ldl -lsocket
> "subversion/svnserve/main.c", line 492: warning: statement not reached
> "subversion/clients/cmdline/util.c", line 398: warning: statement not reached
> Undefined first referenced
> symbol in file
> libintl_bindtextdomain cmdline.lo
> libintl_dgettext opt.lo
> libintl_textdomain cmdline.lo
> ld: fatal: Symbol referencing errors. No output written to .libs/libsvn_subr-1.so.0.0.0

I think Solaris needs to link against libintl but I don't see and
-lintl in your link command, I guess that's a bug in the new nls
stuff. You could try

$ ./configure --disable-nls
or
$ LDFLAGS='-lintl' ./configure
or
$ make EXTRA_LDFLAGS='-lintl'

So the steps to follow are

1. sh ./autogen.sh ( played around with build/buildcheck.sh lt_pversion=1.5)
2. ./configure --disable-shared --diable-nls prefix=
3. make
4, make install

-kalyan

Tuesday, July 26, 2005

Syslog

1. To study the working of logsurfer

Which files it parses , the conf files in /etc/logsurfer.conf
rules needs to be manipulated

More on this later

-Kalyan

Friday, July 22, 2005

installing subversion on solaris

Building Subversion 1.2 on Solaris 9

I’ve just spent a couple of days trying to get Subversion to build on a Solaris 9 environment. For some reason, it wasn’t as easy as it has been in the past and I’ve had a boat load of trouble, so I wanted to document the final solution I came to.

The Source Control System

We are running Solaris 9 and access the Subversion repository via HTTP/HTTPS through Apache. This means that I have to compile in SSL support for the client, in addition to mod_svn_dav support for the Apache Server. We also use the mod_svn_authz module for access control to the repository.

Software installed On The System

The following software is installed on the system:

Description of the Problem

The normal process I use for building these components is the following:

  1. Download the source tarball
  2. Untar the contents of the tarball to the a /tmp/subversion directory
  3. Configure the software with the following commands:
    ./configure --with-ssl --with-berkeley-db=/usr/local/BerkeleyDB4.2 --with-apxs=/usr/local/apache2/bin/apxs
    make
  4. Build the software with the make command

The software builds until it hits the neon module, after which I would receive pages of the following errors:

make[1]: Entering directory `/tmp/subversion-1.2.0/neon'
cd src && make
make[2]: Entering directory `/tmp/subversion-1.2.0/neon/src'
/bin/bash ../libtool --quiet --mode=link gcc -rpath /usr/local/lib -version-info 24:7:0 -o libneon.la ne_request.lo ne_session.lo ne_basic.lo ne_string.lo ne_uri.lo ne_dates.lo ne_alloc.lo ne_md5.lo ne_utils.lo ne_socket.lo ne_auth.lo ne_cookies.lo ne_redirect.lo ne_compress.lo ne_207.lo ne_xml.lo ne_props.lo ne_locks.lo ne_acl.lo ne_openssl.lo -lssl -lcrypto -lnsl -lsocket -lz /tmp/subversion-1.2.0/apr-util/xml/expat/lib/libexpat.la
Text relocation remains referenced
against symbol offset in file
0xd44 /usr/local/ssl/lib/libssl.a(t1_enc.o)
0xd48 /usr/local/ssl/lib/libssl.a(t1_enc.o)
0xd4c /usr/local/ssl/lib/libssl.a(t1_enc.o)
0xd50 /usr/local/ssl/lib/libssl.a(t1_enc.o)
0xd54 /usr/local/ssl/lib/libssl.a(t1_enc.o)
0xd58 /usr/local/ssl/lib/libssl.a(t1_enc.o)
0xd5c /usr/local/ssl/lib/libssl.a(t1_enc.o)
0xd60 /usr/local/ssl/lib/libssl.a(t1_enc.o)
0xd64 /usr/local/ssl/lib/libssl.a(t1_enc.o)
0xd68 /usr/local/ssl/lib/libssl.a(t1_enc.o)


When I saw the errors streaming across the screen, I remembered that I had gotten them before. To fix them previously, I changed into the neon directory and typed the following:

./configure --with-ssl --disable-shared

This had previously fixed the problem (I have no idea why). This time it didn’t and after rebuilding I had the same results.

Finally Getting Things To Build

On a fluke, I decided to run the autogen.sh shell script file in the neon directory and reconfigure neon, enabling shared libraries. Then I went back up to the root of the tree and built again. This time the software built cleanly and all tests ran successfully.

Installing The Software

Since I finally had a clean build and all tests had ran successfully, I decided to go ahead and install it. Upon installing it I received errors that linking failed on the shared libraries being installed and I had to relink everything. This pretty much rendered my source control unuseable until I could figure out why linking failed. Just to be clear, this was not on the production repository box, but on another Solaris machine.

I went through my /usr/local/bin and /usr/local/lib directory and removed every libsvn* shared library, all apr and apr-util shared libraries and all neon libraries that were present on the system. Once this completed, I was able to install the software successfully.

One of the symptoms of old libraries in the path or linking errors is the ‘undefined symbol’ error some have reported on the mailing list when upgrading. When you run into an error like this, you might want to try finding and removing all of these libraries as stated above, as this is an error I was getting as well. Removing the old directories and running make install fixed the problem.

Conclusion

This install was pretty painful. I attribute most of the pain to the fact that I was doing most of this work between meetings, so the constant start / stop took a toll on entering “flow state” to really think about the problem. As I was experiencing these problems, I couldn’t find any really good write ups on installation of the Subversion software on Solaris, so I figured I’d throw this together in the event that someone else was experiencing this level of frustration. Plus, I figure it will help me next time I need to do this to have an actual documented process to follow.

A summary of what I did follows, for those who don’t want to wade through this whole post again:

  1. After exploding the tarball, change to the neon directory and run autogen.sh
  2. Run the configure script with your desired options
  3. Build the software
  4. Run make check and ensure all of your tests pass
  5. Take the server down
  6. Back up your current installation
  7. Remove your old Subversion, apr, and neon libraries from the installed version
  8. Install the software
  9. Bring the server up
  10. Test

On the bright side, I also upgraded a SuSE 9.1 box to the new software. This took about five minutes after I found these RPM packages for SuSE 9.1.

Technorati Tags:

No Comments so far
Leave a comment

Wednesday, July 20, 2005

System Administration

Essential tasks of system administrators

1. Adding and removing users
1.1 Adding or removing hardware
2. Performing backups ( how is it done ....)
3. Installing new software
4. Monitoring the system
5. Troubleshooting
6. Maintaining documentation local
7. Auditing security
8. Helping users

Sites to lookout
freshmeat.com
ugu.com
stokley.com
tucows.com
securityfocus.com
cpan.prg
slashdot.org

Solaris9 exploit

http://sunsolve.sun.com/search/document.do?assetkey=1-26-56740-1

PHP security vulnerabilities

http://www.sklar.com/page/article/owasp-top-ten

Question of the day?

I need to find out the
1) How to find the php version ? which I predict is nothing more than i beleive php -version
php --version
PHP 4.3.11 (cli) (built: Jun 20 2005 10:55:09)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

2) How to find the mod_perl version?
#!/usr/local/bin/perl

use mod_perl;
print "mod_perl version is: $mod_perl::VERSION \n";

mod_perl version is 1.9909

Explots in the version which are installed?

-Kalyan

Friday, July 15, 2005

Windows Remote login


When I try to log on, why do I get the error message, "Unable to log you on because of an account restriction"?


A.

This message can appear because a user trying to log on is not in the Remote Desktop Users group, or because an account has no password. Starting with Windows XP, accessing network resources such as Remote Desktop and file shares requires that you have a password associated with an account.

Thursday, July 07, 2005

Bulk loading data in SQL Server

This example combines dynamic SQL, BULK INSERT and the proper handling of double-quotes to solve a client's problem with loading various text file formats into a database.
One of my clients contacted me recently and said they needed some help creating a stored procedure that imported data from a text file. They wanted the procedure to accept three parameters: PathFileName, OrderID, and FileType. The PathFileName is simply the name and physical location of the source file on the hard drive, the OrderID is generated in the program that calls the procedure and the FileType indicates the format of the data in the source file. The two possible formats for the source data are shown here:

FileType=1 (TxtFile1.txt)

"Kelly","Reynold","kelly@reynold.com"
"John","Smith","bill@smith.com"
"Sara","Parker","sara@parker.com"

FileType=2 (TxtFile2.txt)

Kelly,Reynold,kelly@reynold.com
John,Smith,bill@smith.com
Sara,Parker,sara@parker.com

BULK INSERT

I decided to use BULK INSERT to implement the solution. The BULK INSERT statement was introduced in SQL Server 7 and allows you to interact with bcp (bulk copy program) via a script. In pre-7 versions the only way you could access bcp functionality was from a command prompt. I am not going to list the full syntax of BULK INSERT here (but you can find it here), because it is a little long and most of it does not apply to the problem I am solving. Instead, I will show the valid BULK INSERT statements used to load the data shown above.

BULK INSERT TmpStList FROM 'c:\TxtFile1.txt' WITH (FIELDTERMINATOR = '","')

TmpStList is the target table and TxtFile1.txt is the source data file. The source file is located in the root of the C drive. The FIELDTERMINATOR argument allows you to specify the delimeter used to discern column values.

The valid statement for FileType=2 is shown here:

BULK INSERT tmpStList FROM 'c:\TxtFile2.txt' WITH (FIELDTERMINATOR = ',')

The only difference is the value of the FIELDTERMINATOR argument.

The Solution

The stored procedure used to implement the solution is fairly straigtforward once you master the BULK INSERT statement. The only real trick is loading the data that comes to you in FileType=1 format. Because a double-quote starts and ends a data row, it too is loaded in the table. The FIELDTERMINATOR works between columns, not at the beginning or end of a row. To workaround this I simply load the data into a temporary table and then use a CASE statement and the SUBSTRING and DATALENGTH functions to load the correct data in the final table. The FileType=2 data will load as-is, but I still put in the temporary table for consistency (easier programming).

The SQL statements that create the temporary and final table are shown here.

CREATE TABLE StudentList
(
StID int IDENTITY NOT NULL,
StFName varchar(50) NOT NULL,
StLName varchar(50) NOT NULL,
StEmail varchar(100) NOT NULL,
OrderID int NOT NULL
)
go
CREATE TABLE TmpStList
(
stFName varchar (50) NOT NULL,
stLName varchar (50) NOT NULL,
stEmail varchar (100) NOT NULL
)
go

Wednesday, July 06, 2005

File processing using shell scripts

cat myfile |
( while read LINE ; do
PART1=$( echo $LINE | cut -d ":" -f 1 )
PART2=$( echo $LINE | cut -d ":" -f 2 )
# let the shell assist your aim here
echo P1:$PART1
echo P2:$PART2
# ..
done )

executes the while loop in a subshell in all Bournish shells whereas

while IFS=: read PART1 PART2
do
...
done < myfile

#################################################################

while read line
do
set -- $line
done

Friday, July 01, 2005

Oracle administration site

http://www.arikaplan.com/sql.html

-Kalyan