Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
ldapvi: apply upstream patch
Browse files Browse the repository at this point in the history
Closes #45241.

Closes #50270.

Signed-off-by: Dominyk Tiller <[email protected]>
  • Loading branch information
DomT4 committed Mar 20, 2016
1 parent f7ae591 commit fc57ef8
Showing 1 changed file with 17 additions and 56 deletions.
73 changes: 17 additions & 56 deletions Library/Formula/ldapvi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,41 @@ class Ldapvi < Formula
desc "Update LDAP entries with a text editor"
homepage "http://www.lichteblau.com/ldapvi/"
url "http://www.lichteblau.com/download/ldapvi-1.7.tar.gz"
mirror "https://mirrors.kernel.org/debian/pool/main/l/ldapvi/ldapvi_1.7.orig.tar.gz"
mirror "https://mirrors.ocf.berkeley.edu/debian/pool/main/l/ldapvi/ldapvi_1.7.orig.tar.gz"
sha256 "6f62e92d20ff2ac0d06125024a914b8622e5b8a0a0c2d390bf3e7990cbd2e153"
revision 2

bottle do
cellar :any
sha256 "bd3f055256d05adb1e88e9641c57b4b01be37677f7991699606c2cee6af52f2f" => :yosemite
sha256 "ae6758ad1cb44a31377015f015c5c20626fb1bedbf90dfd33efdcd85447bb183" => :mavericks
sha256 "b26d6f88dad7109ac4b5cb48005366a0b103c8f6851e765f7797b187aaafd58b" => :mountain_lion
end

revision 1

depends_on "pkg-config" => :build
depends_on "xz" => :build # Homebrew bug. Shouldn't need declaring explicitly.
depends_on "gettext"
depends_on "glib"
depends_on "popt"
depends_on "readline"
depends_on "openssl"

# Backporting the fix from the devel version
# (namespace conflict with Lion's getline function)
# These patches are applied upstream but release process seems to be dead.
# http://www.lichteblau.com/git/?p=ldapvi.git;a=commit;h=256ced029c235687bfafdffd07be7d47bf7af39b
# Also fix compilation with clang by changing `return` to `return 0`.
patch :DATA
# http://www.lichteblau.com/git/?p=ldapvi.git;a=commit;h=a2717927f297ff9bc6752f281d4eecab8bd34aad
patch do
url "https://mirrors.ocf.berkeley.edu/debian/pool/main/l/ldapvi/ldapvi_1.7-10.debian.tar.xz"
mirror "https://mirrorservice.org/sites/ftp.debian.org/debian/pool/main/l/ldapvi/ldapvi_1.7-10.debian.tar.xz"
sha256 "93be20cf717228d01272eab5940337399b344bb262dc8bc9a59428ca604eb6cb"
apply "patches/05_getline-conflict",
"patches/06_fix-vim-modeline"
end

def install
# Fix compilation with clang by changing `return` to `return 0`.
inreplace "ldapvi.c", "if (lstat(sasl, &st) == -1) return;",
"if (lstat(sasl, &st) == -1) return 0;"

system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make", "install"
Expand All @@ -36,52 +46,3 @@ def install
system "#{bin}/ldapvi", "--version"
end
end

__END__
diff -rupN ldapvi-1.7-orig/common.h ldapvi-1.7-new/common.h
--- ldapvi-1.7-orig/common.h 2007-05-05 12:17:26.000000000 +0200
+++ ldapvi-1.7-new/common.h 2011-09-02 21:40:45.000000000 +0200
@@ -273,7 +273,7 @@ void pipeview_wait(int pid);
char *home_filename(char *name);
void read_ldapvi_history(void);
void write_ldapvi_history(void);
-char *getline(char *prompt, char *value);
+char *ldapvi_getline(char *prompt, char *value);
char *get_password();
char *append(char *a, char *b);
void *xalloc(size_t size);
diff -rupN ldapvi-1.7-orig/ldapvi.c ldapvi-1.7-new/ldapvi.c
--- ldapvi-1.7-orig/ldapvi.c 2007-05-05 12:17:26.000000000 +0200
+++ ldapvi-1.7-new/ldapvi.c 2011-09-02 21:41:17.000000000 +0200
@@ -470,7 +470,7 @@ change_mechanism(bind_options *bo)
bo->authmethod = LDAP_AUTH_SASL;
puts("Switching to SASL authentication.");
}
- bo->sasl_mech = getline("SASL mechanism", bo->sasl_mech);
+ bo->sasl_mech = ldapvi_getline("SASL mechanism", bo->sasl_mech);
}

static int
diff -rupN ldapvi-1.7-orig/misc.c ldapvi-1.7-new/misc.c
--- ldapvi-1.7-orig/misc.c 2007-05-05 12:17:26.000000000 +0200
+++ ldapvi-1.7-new/misc.c 2011-09-02 21:41:45.000000000 +0200
@@ -315,7 +315,7 @@ write_ldapvi_history()
}

char *
-getline(char *prompt, char *value)
+ldapvi_getline(char *prompt, char *value)
{
tdialog d;
init_dialog(&d, DIALOG_DEFAULT, prompt, value);
--- ldapvi-1.7/ldapvi.c 2012-08-15 10:58:23.000000000 -0400
+++ ldapvi-1.7/ldapvi.c.new 2012-08-15 10:58:12.000000000 -0400
@@ -1465,7 +1465,7 @@
int line = 0;
int c;

- if (lstat(sasl, &st) == -1) return;
+ if (lstat(sasl, &st) == -1) return 0;
if ( !(in = fopen(sasl, "r"))) syserr();

if (st.st_size > 0) {

0 comments on commit fc57ef8

Please sign in to comment.