[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#2659: open 1.3-1 segfaults with default args - patch included



Package: open
Version: 1.3-1

The "open" command segfaults if it is not given the name of a program to
run.  The documentation suggests it should default to running a shell.

The following patch fixes the problem:

================
diff -ruN open-1.3.orig/open.c open-1.3/open.c
--- open-1.3.orig/open.c	Wed May  3 00:07:56 1995
+++ open-1.3/open.c	Mon Apr  1 17:14:00 1996
@@ -113,7 +113,10 @@
    if (verbose)
 	fprintf(stderr,	"open: using VT %s\n", vtname);

-   cmd = malloc(strlen(argv[optind] + 2));
+   if (def_cmd)
+      cmd = malloc(strlen(def_cmd) + 2);
+   else
+      cmd = malloc(strlen(argv[optind]) + 2);

    if (login)
       strcpy(cmd, "-");
================

When I was looking for this problem, I found the following changes to the
debian.rules file helpful:

================
diff -ruN open-1.3.orig/debian.rules open-1.3/debian.rules
--- open-1.3.orig/debian.rules	Fri Mar  1 14:44:16 1996
+++ open-1.3/debian.rules	Mon Apr  1 17:30:43 1996
@@ -25,7 +25,7 @@

 build:
 # Builds the binary package.
-	make CFLAGS='-O2' LDFLAGS=''
+	make CFLAGS='-O2 -g -Wall -ansi' LDFLAGS=''
 	touch stamp-build

 clean:
@@ -44,10 +44,10 @@
 	sed -e '4s/=V/$(v)-$(d)/' debian.control > debian-tmp/DEBIAN/control
 	chmod 644 debian-tmp/DEBIAN/control

-	install -d debian-tmp/usr/doc/copyright
+	install -d -m 755 debian-tmp/usr/doc/copyright
 	install -m 644 debian.README debian-tmp/usr/doc/copyright/$(p)

-	install -d debian-tmp/usr/doc/open
+	install -d -m 755 debian-tmp/usr/doc/open
 	install -m 644 README debian-tmp/usr/doc/open
 	install -m 644 README.cad debian-tmp/usr/doc/open
 	install -m 644 cad debian-tmp/usr/doc/open/cad.sh
@@ -60,6 +60,8 @@
 	install -s -m 4755 switchto debian-tmp/bin
 	install -c -m 644 open.1 debian-tmp/usr/man/man1
 	install -c -m 644 switchto.1 debian-tmp/usr/man/man1
+
+	chown -R root.root debian-tmp

 	dpkg --build debian-tmp
 	mv debian-tmp.deb ../$(p)-$(v)-$(d).deb
================

Michael.

--
Michael Nonweiler <mrn20@cam.ac.uk>
Trinity College, Cambridge. CB2 1TQ



Reply to: