--- installwatch-0.6.3.orig/Makefile
+++ installwatch-0.6.3/Makefile
@@ -1,17 +1,20 @@
 # Makefile for installwatch
 # $Id: Makefile,v 0.6.2.1 2001/12/13 23:59:58 izto Exp $
 
+# Edited for Debian GNU/Linux
+DESTDIR=
+
 # Well, the only configurable part is the following variable.
 # Make sure the directory you specify exists.
 
-PREFIX=/usr/local
+PREFIX=/usr
 
 # End of configurable part
 
-VERSION=0.6.2
+VERSION=0.6.3
 
-BINDIR=$(PREFIX)/bin
-LIBDIR=$(PREFIX)/lib
+BINDIR=$(DESTDIR)$(PREFIX)/bin
+LIBDIR=$(DESTDIR)$(PREFIX)/lib
 
 all: installwatch.so
 
--- installwatch-0.6.3.orig/installwatch
+++ installwatch-0.6.3/installwatch
@@ -54,14 +54,14 @@
 
 LD_PRELOAD=$LIBDIR/installwatch.so
 export LD_PRELOAD
-$*
+"$@"
 if [ $? -eq 0 ]; then
    FAIL=0
 else
    FAIL=1
 fi
 
-[ "$INSTALLWATCH_BACKUP_PATH" ] && rm -rf ${INSTALLWATCH_BACKUP_PATH}/no-backup
+[ "$INSTALLWATCH_BACKUP_PATH" ] && rm -rf "${INSTALLWATCH_BACKUP_PATH}/no-backup"
 
  exit $FAIL
 
--- installwatch-0.6.3.orig/installwatch.c
+++ installwatch-0.6.3/installwatch.c
@@ -158,7 +158,11 @@
 		syslog(LOGLEVEL, buffer);
 }
 
-static void canonicalize(const char *path, char *resolved_path) {
+char * canonicalize(const char *path) {
+#if defined(MAXPATHLEN)
+	char *resolved_path = malloc (MAXPATHLEN);
+	if (!resolved_path)
+		return 0;
 	if(!realpath(path, resolved_path) && (path[0] != '/')) {
 		/* The path could not be canonicalized, append it
 		 * to the current working directory if it was not 
@@ -167,6 +171,12 @@
 		strcat(resolved_path, "/");
 		strncat(resolved_path, path, MAXPATHLEN - 1);
 	}
+	return resolved_path;
+#elif defined(__GLIBC__)
+	return canonicalize_file_name (path);
+#else
+# error No way to allocate a canonicalized buffer!
+#endif
 } 
 
 static void make_path (char *path) {
@@ -393,10 +403,10 @@
 
 int chmod(const char *path, mode_t mode) {
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
-	canonicalize(path, canonic);
+	canonic = canonicalize(path);
 	
      #if DEBUG
 	puts ("in installwatch chmod\n");
@@ -410,10 +420,10 @@
 
 int chown(const char *path, uid_t owner, gid_t group) {
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
-	canonicalize(path, canonic);
+	canonic = canonicalize(path);
 
 #if DEBUG
 	puts("chown\n");
@@ -427,10 +437,10 @@
 
 int chroot(const char *path) {
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
-	canonicalize(path, canonic);
+	canonic = canonicalize(path);
 	result = true_chroot(path);
 	/* From now on, another log file will be written if *
 	 * INSTALLWATCHFILE is set                          */
@@ -441,10 +451,10 @@
 int creat(const char *pathname, mode_t mode) {
 /* Is it a system call? */
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
-	canonicalize(pathname, canonic);
+	canonic = canonicalize(pathname);
 
 #if DEBUG
 	printf("creat\n");
@@ -487,10 +497,10 @@
 
 FILE *fopen(const char *pathname, const char *mode) {
 	FILE *result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
-	canonicalize(pathname, canonic);
+	canonic = canonicalize(pathname);
 
 #if DEBUG
 	puts("fopen\n");
@@ -521,14 +531,14 @@
 int lchown(const char *path, uid_t owner, gid_t group) {
 /* Linux specific? */
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
 
 #if DEBUG
 	puts ("lchown\n");
 #endif
-	canonicalize(path, canonic);
+	canonic = canonicalize(path);
 
 	backup (canonic);
 
@@ -539,7 +549,7 @@
 
 int link(const char *oldpath, const char *newpath) {
 	int result;
-	char old_canonic[MAXPATHLEN], new_canonic[MAXPATHLEN];
+	char *old_canonic, *new_canonic;
 
 	REFCOUNT;
 
@@ -547,8 +557,8 @@
 	puts ("link\n");
 #endif
 
-	canonicalize(oldpath, old_canonic);
-	canonicalize(newpath, new_canonic);
+	old_canonic = canonicalize(oldpath);
+	new_canonic = canonicalize(newpath);
 	result = true_link(oldpath, newpath);
 	log("%d\tlink\t%s\t%s\t#%s\n", result, old_canonic, new_canonic, error(result));
 	return result;
@@ -556,10 +566,10 @@
 
 int mkdir(const char *pathname, mode_t mode) {
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
-	canonicalize(pathname, canonic);
+	canonic = canonicalize(pathname);
 	result = true_mkdir(pathname, mode);
 	log("%d\tmkdir\t%s\t#%s\n", result, canonic, error(result));
 	return result;
@@ -570,13 +580,13 @@
 	va_list ap;
 	mode_t mode;
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
 	va_start(ap, flags);
 	mode = va_arg(ap, mode_t);
 	va_end(ap);
-	canonicalize(pathname, canonic);
+	canonic = canonicalize(pathname);
 
 #if DEBUG
 	printf ("open\n");
@@ -592,17 +602,17 @@
 
 int rename(const char *oldpath, const char *newpath) {
 	int result;
-	char old_canonic[MAXPATHLEN], new_canonic[MAXPATHLEN];
+	char *old_canonic, *new_canonic;
 
 	REFCOUNT;
-	canonicalize(oldpath, old_canonic);
+	old_canonic = canonicalize(oldpath);
 
 #if DEBUG
 	puts ("rename\n");	
 #endif
 	backup (old_canonic);
 
-	canonicalize(newpath, new_canonic);
+	new_canonic = canonicalize(newpath);
 	result = true_rename(oldpath, newpath);
 	log("%d\trename\t%s\t%s\t#%s\n", result, old_canonic, new_canonic, error(result));
 	return result;
@@ -610,10 +620,10 @@
 
 int rmdir(const char *pathname) {
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
-	canonicalize(pathname, canonic);
+	canonic = canonicalize(pathname);
 
 #if DEBUG
 	printf ("rmdir\n");
@@ -627,7 +637,7 @@
 
 int symlink(const char *oldpath, const char *newpath) {
 	int result;
-	char old_canonic[MAXPATHLEN], new_canonic[MAXPATHLEN];
+	char *old_canonic, *new_canonic;
 
 	REFCOUNT;
 
@@ -635,8 +645,8 @@
 	puts ("symlink\n");
 #endif
 
-	canonicalize(oldpath, old_canonic);
-	canonicalize(newpath, new_canonic);
+	old_canonic = canonicalize(oldpath);
+	new_canonic = canonicalize(newpath);
 	result = true_symlink(oldpath, newpath);
 	log("%d\tsymlink\t%s\t%s\t#%s\n", result, old_canonic, new_canonic, error(result));
 	return result;
@@ -644,7 +654,7 @@
 
 int truncate(const char *path, TRUNCATE_T length) {
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
 
@@ -652,7 +662,7 @@
 	puts ("truncate\n");
 #endif
 
-	canonicalize(path, canonic);
+	canonic = canonicalize(path);
 
 	backup (canonic);
 
@@ -663,10 +673,10 @@
 
 int unlink(const char *pathname) {
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
-	canonicalize(pathname, canonic);
+	canonic = canonicalize(pathname);
 
 #if DEBUG
 	printf ("unlink\n");
@@ -683,10 +693,10 @@
 int creat64(const char *pathname, __mode_t mode) {
 /* Is it a system call? */
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
-	canonicalize(pathname, canonic);
+	canonic = canonicalize(pathname);
 
 #if DEBUG
         puts ("creat64\n");
@@ -714,10 +724,10 @@
 
 FILE *fopen64(const char *pathname, const char *mode) {
 	FILE *result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
-	canonicalize(pathname, canonic);
+	canonic = canonicalize(pathname);
 
 #if DEBUG
 	puts("fopen64\n");
@@ -736,7 +746,7 @@
 	va_list ap;
 	mode_t mode;
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
 
@@ -747,7 +757,7 @@
 	va_start(ap, flags);
 	mode = va_arg(ap, mode_t);
 	va_end(ap);
-	canonicalize(pathname, canonic);
+	canonic = canonicalize(pathname);
 	if(flags & (O_WRONLY | O_RDWR)) 
 	   backup(canonic);
 	result = true_open64(pathname, flags, mode);
@@ -758,7 +768,7 @@
 
 int truncate64(const char *path, __off64_t length) {
 	int result;
-	char canonic[MAXPATHLEN];
+	char *canonic;
 
 	REFCOUNT;
 
@@ -766,7 +776,7 @@
         puts ("truncate64\n");
 #endif
 
-	canonicalize(path, canonic);
+	canonic = canonicalize(path);
 
 	backup(canonic);
 
--- installwatch-0.6.3.orig/debian/changelog
+++ installwatch-0.6.3/debian/changelog
@@ -0,0 +1,57 @@
+installwatch (0.6.3-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Greg Norris <adric@debian.org>  Wed, 26 Jun 2002 16:42:52 -0500
+
+installwatch (0.5.5-4) unstable; urgency=low
+
+  * Applied patch from Adam Olsen, to allow compiling on systems without
+    MAXPATHLEN... Hurd, in this case.  Closes: #109951
+  * Updated to standards version 3.5.6.
+
+ -- Gregory T. Norris <adric@debian.org>  Fri,  7 Sep 2001 17:08:29 -0500
+
+installwatch (0.5.5-3) unstable; urgency=low
+
+  * Command line arguments which contained embedded whitespace could be
+    inadvertently split when passed to the installation command.  Fixed.
+  * Added `-D_GNU_SOURCE' to the compile command in the makefile, in order to
+    allow building under glibc2.2.
+  * Updated to standards version 3.2.1.
+
+ -- Gregory T. Norris <adric@debian.org>  Sat, 17 Feb 2001 17:20:14 -0600
+
+installwatch (0.5.5-2) unstable; urgency=low
+
+  * Cleaned up lintian errors/warnings
+
+ -- Gregory T. Norris <adric@debian.org>  Sat, 30 Oct 1999 09:54:05 -0500
+
+installwatch (0.5.5-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Gregory T. Norris <adric@debian.org>  Sat, 15 May 1999 09:52:46 -0500
+
+installwatch (0.5.4-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Gregory T. Norris <adric@debian.org>  Thu,  1 Apr 1999 20:28:04 +0000
+
+installwatch (0.5.3-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Gregory T. Norris <adric@debian.org>  Mon, 29 Mar 1999 04:34:33 -0600
+
+installwatch (0.5.1-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Gregory T. Norris <haphazard@socketis.net>  Sun, 20 Dec 1998 11:10:58 -0600
+
+Local variables:
+mode: debian-changelog
+End:
--- installwatch-0.6.3.orig/debian/rules
+++ installwatch-0.6.3/debian/rules
@@ -0,0 +1,83 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=2
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+	
+
+	touch configure-stamp
+
+build: configure-stamp build-stamp
+build-stamp:
+	dh_testdir
+
+	# Add here commands to compile the package.
+	$(MAKE)
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	-$(MAKE) clean
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Add here commands to install the package into debian/installwatch.
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/installwatch
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+#	dh_installdebconf	
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installinit
+	dh_installcron
+	dh_installmanpages
+	dh_installinfo
+#	dh_undocumented
+	dh_installchangelogs CHANGELOG
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	# You may want to make some executables suid here.
+#	dh_suidregister
+#	dh_makeshlibs
+	dh_installdeb
+#	dh_perl
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- installwatch-0.6.3.orig/debian/copyright
+++ installwatch-0.6.3/debian/copyright
@@ -0,0 +1,11 @@
+This package was debianized by Greg Norris <adric@debian.org> on
+Sun, 20 Dec 1998 11:10:58 -0600.
+
+It is available at: http://asic-linux.com.mx/~izto/installwatch.html
+
+It was written by Pancrazio `Ezio' de Mauro <pdm@datanord.it>, and licensed
+under the GNU GPL.  The upstream sources are currently maintained by
+Felipe Eduardo Sanchez Diaz Duran <izto@asic-linux.com.mx>.
+
+On Debian systems, the complete text of the GNU General Public License may
+be found in `/usr/share/common-licenses/GPL'.
--- installwatch-0.6.3.orig/debian/dirs
+++ installwatch-0.6.3/debian/dirs
@@ -0,0 +1,2 @@
+usr/bin
+usr/lib
--- installwatch-0.6.3.orig/debian/installwatch.1
+++ installwatch-0.6.3/debian/installwatch.1
@@ -0,0 +1,66 @@
+.TH INSTALLWATCH 1
+.SH NAME
+installwatch \- tracks installation of local software
+.SH SYNOPSIS
+.B installwatch
+.I "[options] command"
+.SH "DESCRIPTION"
+This manual page documents briefly the
+.B installwatch
+command. This manual page was written for the Debian GNU/Linux
+distribution because the original program does not have a manual page.
+.PP
+.B installwatch
+is a program that is used in order to track the changes made while
+installing local software (i.e. "make install"). It monitors the
+requested command, and produces a log which indicates all created and
+modified files. By default it outputs to
+.BR syslog (3),
+using a priority of ``LOG_USER | LOG_INFO''... this may be overridden
+by the use of the
+.B -o
+option, however.
+.PP
+The log format is as follows:
+.PP
+.I \t<return-value> <syscall-name> <argument> #<comment>
+.PP
+Each field is delimited by a ``^I'' character if logging to
+.BR syslog (3),
+or by a TAB when logging to a file.
+.SH ENVIRONMENT
+.TP
+.B INSTALLWATCH_BACKUP_PATH
+Set this variable to the location that you want installwatch
+to copy the original version of files which get modified.
+The directory will be created if it does not exist, assuming
+that the parent is writeable.
+.SH OPTIONS
+.TP
+.B \-o
+Directs that output from the logged command be written to
+.B filename
+, rather than being output to
+.BR syslog (3).
+If the specified file already exists, it will be truncated.
+.SH EXAMPLES
+A typical usage would look something like this:
+.IP
+installwatch -o ~/install/package.log make install
+.PP
+This of course would execute the command ``make install'',
+while logging to the file ``~/install/package.log''.
+.SH BUGS
+.B installwatch
+does not work with programs which are statically linked with libc.
+.PP
+Due to
+.B LD_PRELOAD
+limitations, it does not work with suid programs (this would
+probably introduce security problems, anyway).
+.PP
+.BR mknod (2)
+is not monitored.
+.SH AUTHOR
+This manual page was written by Greg Norris <adric@debian.org>,
+for the Debian GNU/Linux system (but may be used by others).
--- installwatch-0.6.3.orig/debian/docs
+++ installwatch-0.6.3/debian/docs
@@ -0,0 +1 @@
+BUGS README TODO 
--- installwatch-0.6.3.orig/debian/control
+++ installwatch-0.6.3/debian/control
@@ -0,0 +1,13 @@
+Source: installwatch
+Section: utils
+Priority: optional
+Maintainer: Greg Norris <adric@debian.org>
+Build-Depends: debhelper (>> 2.0.0)
+Standards-Version: 3.5.6
+
+Package: installwatch
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Track installation of local software
+ Installwatch is used to track the changes made during the installation of
+ local (i.e. non-deb) software.
