[PATCH v1 2/2] lib: Fix use after free
[notmuch-archives.git] / 42 / e0a90fb812619f08e539baa41b3b2e1e97e124
1 Return-Path: <blakej@foo.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id A9B9E429E2F\r
6         for <notmuch@notmuchmail.org>; Mon,  5 Nov 2012 11:02:28 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id gxMQYNq-j+BZ for <notmuch@notmuchmail.org>;\r
16         Mon,  5 Nov 2012 11:02:26 -0800 (PST)\r
17 Received: from foo.net (70-36-235-136.dsl.static.sonic.net [70.36.235.136])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 0A33B429E32\r
21         for <notmuch@notmuchmail.org>; Mon,  5 Nov 2012 11:02:23 -0800 (PST)\r
22 Received: from foo.net (localhost [127.0.0.1])\r
23         by foo.net (8.14.5+Sun/8.14.5) with ESMTP id qA5J2Mv1019113;\r
24         Mon, 5 Nov 2012 11:02:22 -0800 (PST)\r
25 Received: (from blakej@localhost)\r
26         by foo.net (8.14.5+Sun/8.14.5/Submit) id qA5J2McW019112;\r
27         Mon, 5 Nov 2012 11:02:22 -0800 (PST)\r
28 From: Blake Jones <blakej@foo.net>\r
29 To: notmuch@notmuchmail.org\r
30 Subject: [PATCH v2 05/10] install: check for non-SysV version (Solaris\r
31  support)\r
32 Date: Mon,  5 Nov 2012 11:01:58 -0800\r
33 Message-Id: <1352142123-18286-6-git-send-email-blakej@foo.net>\r
34 X-Mailer: git-send-email 1.7.3.2\r
35 In-Reply-To: <1352142123-18286-1-git-send-email-blakej@foo.net>\r
36 References: <1352142123-18286-1-git-send-email-blakej@foo.net>\r
37 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2\r
38         (foo.net [127.0.0.1]); Mon, 05 Nov 2012 11:02:22 -0800 (PST)\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Mon, 05 Nov 2012 19:02:29 -0000\r
52 \r
53 Solaris ships a program called "install" in /usr/sbin, which performs a\r
54 task that's fairly similar to the GNU and BSD "install" programs but\r
55 which uses very different command line arguments.  In particular, if it\r
56 is invoked without "-c", "-f", or "-n", it will search the target\r
57 directory for a file with the same name as the one being installed, and\r
58 it will only install the file if it finds a matching name.  More\r
59 excitingly, if it doesn't find a match, it will look in /bin, /usr/bin,\r
60 /etc, /lib, and /usr/lib and try to do the same there.\r
61 \r
62 The standard workaround for this is to use GNU install.\r
63 It is available via the standard Solaris packaging system (in\r
64 "file/gnu-coreutils"), and installs itself as /usr/bin/ginstall.\r
65 \r
66 This patch adds a check to "configure" to see if "install" behaves in a\r
67 way that's compatible with GNU and BSD install, and if not, it uses a\r
68 program called "ginstall" instead.  It also modifies "configure" to set\r
69 the $(INSTALL) variable, and changes various Makefiles to use it.\r
70 ---\r
71  Makefile.local            |    2 +-\r
72  completion/Makefile.local |    4 ++--\r
73  configure                 |   19 +++++++++++++++++++\r
74  emacs/Makefile.local      |    6 +++---\r
75  lib/Makefile.local        |    4 ++--\r
76  man/Makefile.local        |    6 +++---\r
77  vim/Makefile              |    6 ++----\r
78  7 files changed, 32 insertions(+), 15 deletions(-)\r
79 \r
80 diff --git a/Makefile.local b/Makefile.local\r
81 index 2b91946..7ccb1cd 100644\r
82 --- a/Makefile.local\r
83 +++ b/Makefile.local\r
84 @@ -286,7 +286,7 @@ notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)\r
85  .PHONY: install\r
86  install: all install-man\r
87         mkdir -p "$(DESTDIR)$(prefix)/bin/"\r
88 -       install notmuch-shared "$(DESTDIR)$(prefix)/bin/notmuch"\r
89 +       $(INSTALL) notmuch-shared "$(DESTDIR)$(prefix)/bin/notmuch"\r
90  ifeq ($(MAKECMDGOALS), install)\r
91         @echo ""\r
92         @echo "Notmuch is now installed to $(DESTDIR)$(prefix)"\r
93 diff --git a/completion/Makefile.local b/completion/Makefile.local\r
94 index dfc1271..a648a78 100644\r
95 --- a/completion/Makefile.local\r
96 +++ b/completion/Makefile.local\r
97 @@ -14,9 +14,9 @@ install-$(dir):\r
98         @echo $@\r
99  ifeq ($(WITH_BASH),1)\r
100         mkdir -p "$(DESTDIR)$(bash_completion_dir)"\r
101 -       install -m0644 $(bash_script) "$(DESTDIR)$(bash_completion_dir)/notmuch"\r
102 +       $(INSTALL) -m0644 $(bash_script) "$(DESTDIR)$(bash_completion_dir)/notmuch"\r
103  endif\r
104  ifeq ($(WITH_ZSH),1)\r
105         mkdir -p "$(DESTDIR)$(zsh_completion_dir)"\r
106 -       install -m0644 $(zsh_script) "$(DESTDIR)$(zsh_completion_dir)/_notmuch"\r
107 +       $(INSTALL) -m0644 $(zsh_script) "$(DESTDIR)$(zsh_completion_dir)/_notmuch"\r
108  endif\r
109 diff --git a/configure b/configure\r
110 index c9da667..d9a101f 100755\r
111 --- a/configure\r
112 +++ b/configure\r
113 @@ -591,6 +591,21 @@ for flag in -Wmissing-declarations; do\r
114  done\r
115  printf "\n\t${WARN_CFLAGS}\n"\r
116  \r
117 +INSTALL="install"\r
118 +printf "Checking for working \"install\" program... "\r
119 +mkdir _tmp_\r
120 +cd _tmp_\r
121 +echo 1 > 1\r
122 +mkdir dest\r
123 +if install 1 dest > /dev/null 2>&1 ; then\r
124 +      printf "\"install\" works fine.\n"\r
125 +else\r
126 +      INSTALL="ginstall"\r
127 +      printf "using \"ginstall\".\n"\r
128 +fi\r
129 +cd ..\r
130 +rm -rf _tmp_\r
131 +\r
132  rm -f minimal minimal.c\r
133  \r
134  cat <<EOF\r
135 @@ -777,4 +792,8 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\\r
136                      -DSTD_ASCTIME=\$(STD_ASCTIME)\r
137  CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS) \\\r
138                      \$(LIBNSL_LDFLAGS)\r
139 +\r
140 +# Which "install" program to use\r
141 +INSTALL = ${INSTALL}\r
142 +\r
143  EOF\r
144 diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
145 index fb82247..ee778cb 100644\r
146 --- a/emacs/Makefile.local\r
147 +++ b/emacs/Makefile.local\r
148 @@ -36,11 +36,11 @@ endif\r
149  .PHONY: install-emacs\r
150  install-emacs:\r
151         mkdir -p "$(DESTDIR)$(emacslispdir)"\r
152 -       install -m0644 $(emacs_sources) "$(DESTDIR)$(emacslispdir)"\r
153 +       $(INSTALL) -m0644 $(emacs_sources) "$(DESTDIR)$(emacslispdir)"\r
154  ifeq ($(HAVE_EMACS),1)\r
155 -       install -m0644 $(emacs_bytecode) "$(DESTDIR)$(emacslispdir)"\r
156 +       $(INSTALL) -m0644 $(emacs_bytecode) "$(DESTDIR)$(emacslispdir)"\r
157  endif\r
158         mkdir -p "$(DESTDIR)$(emacsetcdir)"\r
159 -       install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"\r
160 +       $(INSTALL) -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"\r
161  \r
162  CLEAN := $(CLEAN) $(emacs_bytecode)\r
163 diff --git a/lib/Makefile.local b/lib/Makefile.local\r
164 index 7785944..0c6b258 100644\r
165 --- a/lib/Makefile.local\r
166 +++ b/lib/Makefile.local\r
167 @@ -89,11 +89,11 @@ install: install-$(dir)\r
168  \r
169  install-$(dir): $(dir)/$(LIBNAME)\r
170         mkdir -p "$(DESTDIR)$(libdir)/"\r
171 -       install -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"\r
172 +       $(INSTALL) -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"\r
173         ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(SONAME)"\r
174         ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(LINKER_NAME)"\r
175         mkdir -p "$(DESTDIR)$(includedir)"\r
176 -       install -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"\r
177 +       $(INSTALL) -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"\r
178         $(LIBRARY_INSTALL_POST_COMMAND)\r
179  \r
180  SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)\r
181 diff --git a/man/Makefile.local b/man/Makefile.local\r
182 index 72e2a18..07dcf4c 100644\r
183 --- a/man/Makefile.local\r
184 +++ b/man/Makefile.local\r
185 @@ -38,9 +38,9 @@ install-man: $(COMPRESSED_MAN)\r
186         mkdir -p "$(DESTDIR)$(mandir)/man1"\r
187         mkdir -p "$(DESTDIR)$(mandir)/man5"\r
188         mkdir -p "$(DESTDIR)$(mandir)/man7"\r
189 -       install -m0644 $(MAN1_GZ) $(DESTDIR)/$(mandir)/man1\r
190 -       install -m0644 $(MAN5_GZ) $(DESTDIR)/$(mandir)/man5\r
191 -       install -m0644 $(MAN7_GZ) $(DESTDIR)/$(mandir)/man7\r
192 +       $(INSTALL) -m0644 $(MAN1_GZ) $(DESTDIR)/$(mandir)/man1\r
193 +       $(INSTALL) -m0644 $(MAN5_GZ) $(DESTDIR)/$(mandir)/man5\r
194 +       $(INSTALL) -m0644 $(MAN7_GZ) $(DESTDIR)/$(mandir)/man7\r
195         cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz\r
196  \r
197  update-man-versions: $(MAN_SOURCE)\r
198 diff --git a/vim/Makefile b/vim/Makefile\r
199 index f17bebf..7ceba7a 100644\r
200 --- a/vim/Makefile\r
201 +++ b/vim/Makefile\r
202 @@ -5,8 +5,6 @@ files = plugin/notmuch.vim \\r
203  prefix = $(HOME)/.vim\r
204  destdir = $(prefix)/plugin\r
205  \r
206 -INSTALL = install -D -m644\r
207 -\r
208  all: help\r
209  \r
210  help:\r
211 @@ -17,7 +15,7 @@ help:\r
212         @echo "    make symlink     - create symlinks in ~/.vim (useful for development)"\r
213  \r
214  install:\r
215 -       @for x in $(files); do $(INSTALL) $(CURDIR)/$$x $(prefix)/$$x; done\r
216 +       @for x in $(files); do $(INSTALL) -D -m644 $(CURDIR)/$$x $(prefix)/$$x; done\r
217  \r
218 -link symlink: INSTALL = ln -fs\r
219  link symlink: install\r
220 +       @for x in $(files); do ln -fs $(CURDIR)/$$x $(prefix)/$$x; done\r
221 -- \r
222 1.7.3.2\r
223 \r