Here’s a better patch that also fixes a crash on 64-bit systems (due to
execl(…, 0) instead of execl(…, (char *) NULL)). Also sent upstream:
http://lists.askja.de/pipermail/ldapvi/2010-December/000085.html
http://lists.askja.de/pipermail/ldapvi/2010-December/000086.html
Anders
diff -u ldapvi-1.7/debian/changelog ldapvi-1.7/debian/changelog
--- ldapvi-1.7/debian/changelog
+++ ldapvi-1.7/debian/changelog
@@ -1,3 +1,12 @@
+ldapvi (1.7-8) unstable; urgency=low
+
+ * debian/patches/06_execlp-null: Cast the trailing NULL on execl()
+ calls.
+ * debian/patches/07_editor-arguments: Handle editor commands with
+ arguments. (Closes: #550843)
+
+ -- Anders Kaseorg <ande...@mit.edu> Tue, 14 Dec 2010 17:21:22 -0500
+
ldapvi (1.7-7) unstable; urgency=low
* Change libreadline5-dev to libreadline-dev (closes: #553795)
diff -u ldapvi-1.7/debian/patches/series ldapvi-1.7/debian/patches/series
--- ldapvi-1.7/debian/patches/series
+++ ldapvi-1.7/debian/patches/series
@@ -5,0 +6,2 @@
+06_execlp-null
+07_editor-arguments
only in patch2:
unchanged:
--- ldapvi-1.7.orig/debian/patches/06_execlp-null
+++ ldapvi-1.7/debian/patches/06_execlp-null
@@ -0,0 +1,53 @@
+From: Anders Kaseorg <ande...@mit.edu>
+Subject: Cast the trailing NULL on execl() calls
+
+From exec(3): “The list of arguments must be terminated by a NULL
+pointer, and, since these are variadic functions, this pointer must be
+cast (char *) NULL.”
+
+This prevents crashes on 64-bit systems, where 0 is a 32-bit integer
+and (char *) NULL is a 64-bit pointer.
+
+Forwarded: http://lists.askja.de/pipermail/ldapvi/2010-December/000085.html
+Last-Update: 2010-12-14
+---
+ misc.c | 8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/misc.c b/misc.c
+index 3b6896e..e9a0d4c 100644
+--- a/misc.c
++++ b/misc.c
+@@ -172,9 +172,9 @@ edit(char *pathname, long line)
+ if (line > 0) {
+ char buf[20];
+ snprintf(buf, 20, "+%ld", line);
+- execlp(vi, vi, buf, pathname, 0);
++ execlp(vi, vi, buf, pathname, (char *) NULL);
+ } else
+- execlp(vi, vi, pathname, 0);
++ execlp(vi, vi, pathname, (char *) NULL);
+ syserr();
+ }
+
+@@ -213,7 +213,7 @@ view(char *pathname)
+ case -1:
+ syserr();
+ case 0:
+- execlp(pg, pg, pathname, 0);
++ execlp(pg, pg, pathname, (char *) NULL);
+ syserr();
+ }
+
+@@ -245,7 +245,7 @@ pipeview(int *fd)
+ close(fds[1]);
+ dup2(fds[0], 0);
+ close(fds[0]);
+- execlp(pg, pg, 0);
++ execlp(pg, pg, (char *) NULL);
+ syserr();
+ }
+
+--
+1.7.3.3
+
only in patch2:
unchanged:
--- ldapvi-1.7.orig/debian/patches/07_editor-arguments
+++ ldapvi-1.7/debian/patches/07_editor-arguments
@@ -0,0 +1,43 @@
+From: Anders Kaseorg <ande...@mit.edu>
+Subject: Handle editor commands with arguments
+
+Previously when the EDITOR environment variable is set to a command
+with arguments, such as ‘emacsclient --alternate-editor emacs’, ldapvi
+would fail to launch the editor:
+
+$ ldapvi
+ 26 entries read
+error (misc.c line 180): No such file or directory
+editor died
+error (ldapvi.c line 83): No such file or directory
+
+Fix this by launching the editor via /bin/sh.
+
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550843
+Forwarded: http://lists.askja.de/pipermail/ldapvi/2010-December/000086.html
+Last-Update: 2010-12-14
+---
+ misc.c | 6 ++++--
+ 1 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/misc.c b/misc.c
+index e9a0d4c..2e3a1f5 100644
+--- a/misc.c
++++ b/misc.c
+@@ -172,9 +172,11 @@ edit(char *pathname, long line)
+ if (line > 0) {
+ char buf[20];
+ snprintf(buf, 20, "+%ld", line);
+- execlp(vi, vi, buf, pathname, (char *) NULL);
++ execl("/bin/sh", "sh", "-c", "exec $0 \"$...@\"", vi,
++ buf, pathname, (char *) NULL);
+ } else
+- execlp(vi, vi, pathname, (char *) NULL);
++ execl("/bin/sh", "sh", "-c", "exec $0 \"$...@\"", vi,
++ pathname, (char *) NULL);
+ syserr();
+ }
+
+--
+1.7.3.3
+