How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Olivier Berger
Hi.

Jameson Graef Rollins
 writes:

> On Wed, Apr 11 2012, Olivier Berger  wrote:
>> Is there a way to decrypt multipart/encrypted messages in notmuch-emacs
>
> Hi, Olivier.  Yes, it is possible.
>
>> I can only get a purple "Decryption error" message...
>
> The fact that you're getting this messages means that notmuch is
> attempting to decrypt the message, but there was a decryption problem.
>
> A typical problem is that gpg-agent is not running.  Notmuch uses gnupg
> to decrypt, but it requires that gpg-agent be running to get the
> passphrase from the user.  Do you have gpg-agent running?
>

Thanks for this suggestion.

As I've responded to Daniel Kahn Gillmor in another message, it seems
that I may have messed with my config, and gpg-agent may not have worked
properly.

That's now fixed, I think. See below.

>> The mail looks like :
>
> The format of the multipart/encrypted looks fine, so I see no problems
> there (assuming the encryption was done properly).
>
> You might also try decrypting the message on the command line, as that
> will take any emacs issues out of the loop:
>
> notmuch show --decrypt id:$msgid
>

That works now, but only on the command-line.

Still, in notmuch-emacs, I can still see the purple "Decryption error"
message :-/

Weird.

Any other ideas ?

Best regards,

-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)



Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Olivier Berger
Hi.

Daniel Kahn Gillmor
 writes:

> On 04/11/2012 12:58 PM, Olivier Berger wrote:
>> 
>> Dunno what happens. Anyone else ?
>
> Are you running gpg-agent?
>

I wasn't, but was using gnome's keyring daemon instead.

I have added 'use_agent' back in my ~/.gnupg/gpg.conf, rebooted and can
now see gpg-agent running, and all seems much better.

> what do you get if you do:
>
>  gpg-connect-agent /bye
>
> (please include the return code)?
>

Works now, with $? == 0.

> if you are running on a debian or debian-derived system, do you have the
> gnupg-agent package installed?
>
>   --dkg
>

Thanks for these hints : notmuch show --decrypt works now.

Thanks for your help.

Best regards,

P.S.: I have a somewhat special gpg setup, cause I'm wrapping it with a
script which tests its options and eventually add necessary bits to
access a crypted FS on a usb key... some that may have created some of a
mess in my GPG agent config :-/
-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)



bug fixes to emacs notmuch-tag-completion function

2012-04-11 Thread Tomi Ollila
On Mon, Apr 09 2012, Jameson Graef Rollins wrote:

> I had originally included this fixes as part of a more involved series
> to fix up tagging functions [0].  However, these are actually bug
> fixes that stand alone and should not be bogged down in a series
> that's likely going to take a while to come to fruition.  The changes
> here are pretty trivial, so hopefully they can get pushed quickly and
> I'll rework the rest of tagging fix up series on top of them.

LGTM.

>
> jamie.
>
> [0] id:"154853-25729-1-git-send-email-jrollins at finestructure.net"

Tomi


[PATCH 0/6] Finish show rewrite

2012-04-11 Thread Tomi Ollila
On Sun, Apr 08 2012, Austin Clements wrote:

> The long-awaited and oft-belated conclusion of the show rewrite.  All
> of the formatters have been converted to the new style, so this series
> just rips out unused code and does a little cleanup.

Looks good, tests pass.

+1

Tomi


[PATCH 2/4] dirent->d_type not available on Soalris

2012-04-11 Thread Tomi Ollila
On Mon, Apr 09 2012, Vladimir.Marek at oracle.com wrote:

> From: Vladimir Marek 
>
> The inspiration was taken from similar issue in mutt:
> http://does-not-exist.org/mail-archives/mutt-dev/msg11290.html
>
> Signed-off-by: Vladimir Marek 
> ---

Code looks pretty good, but 2 issues

1) Commit message should contain more verbose information what and 
   why something was done.

2) Does these #ifdefs break code indenters such as uncrustify(1),
   indent(1) and emacs(1) indent functionality.
   (That used to happen but maybe these indenters are smarted today.

Tomi

>  notmuch-new.c |   28 
>  1 files changed, 28 insertions(+), 0 deletions(-)


[PATCH 1/4] Make configure use /bin/bash instead of /bin/sh

2012-04-11 Thread Tomi Ollila
On Wed, Apr 11 2012, Vladimir Marek  wrote:

> Hi,
>

[ ... ]

>
>> Does the configure script work if you replace /bin/sh with /bin/ksh
>> in your Solaris box
>
> yes, it does work if executed by /bin/bash or /bin/ksh
>
>
>> If yes, something like the following could be added to the beginning
>> of 'configure'
>> 
>> option=option=value
>> if test ! x"${option$*=}" = x"value" 2>/dev/null; then
>>  if test x"${PREVENT_LOOPING-}" = x; then
>>  PREVENT_LOOPING=true; export PREVENT_LOOPING
>> test ! -x /bin/ksh || exec /bin/ksh "$0" "$@"
>> test ! -x /bin/bash || exec /bin/bash "$0" "$@"
>> fi
>> echo "Cannot find compatible shell for '$0'" >&2
>> exit 1
>> fi
>
> Unfortunately, no. The /bin/sh says "bad substitution" and does not run
> the script at all. I also tried
>
> eval 'echo ${A%%1}'; echo ok
>
> but that does not run the 'echo ok' and fails also.

You're right! I tested this stuff using heirloom-sh
from http://heirloom.sourceforge.net/sh.html

It is interesting that the shell stops executing when 
it finds this syntax (instead of contnuing, even without -e)

> I can see three possible solutions
>
> 1) use bash or ksh in the shebang line

Cannot do there are systems lacking /bin/bash & /bin/ksh

> 2) rewrite the script as I gave the overview

Some work todo; case construct can do option key matching to get 
identical interface and then cut or sed to get just option value.

> 3) declare that solaris 10 /bin/sh is not compatible with configure
> script
>
> Frankly even 3) is viable option, one just have to remember to run
> 'bash configure'. If everything else would work, I would be happy :)

Option 4) use the following heuristics:

case ~ in '~')
if test x"${PREVENT_LOOPING-}" = x; then
PREVENT_LOOPING=true; export PREVENT_LOOPING
for x in /bin/ksh /bin/bash /usr/bin/bash
do test ! -x "$x" || exec "$x" "$0" "$@"
done
fi
echo "Cannot find compatible shell for '$0'" >&2
exit 1
esac

i.e. if tilde expansion is not done guess this shell is not 
compatible enough

Option 5) do substitution check in subshell:

( option=option=value; : ${option$*=} ) 2>/dev/null || {
if test x"${PREVENT_LOOPING-}" = x; then
PREVENT_LOOPING=true; export PREVENT_LOOPING
for x in /bin/ksh /bin/bash /usr/bin/bash
do test ! -x "$x" || exec "$x" "$0" "$@"
done
fi
echo "Cannot find compatible shell for '$0'" >&2
exit 1
}

>
> Thank you
> -- 
>   Vlad

Tomi


[PATCH] notmuch-mutt: replace gnu sed and xargs with perl

2012-04-11 Thread Taylor Carpenter
External software dependencies removed: sed and xargs.

Sed shell escaping is handled automatically with perl symlink function.

The xargs usage is specific to gnu xargs (fails on bsd xargs, etc).

NOTE: The current query pulls the list of files into an array all at
once.  The larger the list the more memory used.
---
 contrib/notmuch-mutt/notmuch-mutt |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/contrib/notmuch-mutt/notmuch-mutt 
b/contrib/notmuch-mutt/notmuch-mutt
index 424f9a3..c995022 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -12,6 +12,7 @@ use strict;
 use warnings;

 use File::Path;
+use File::Basename;
 use Getopt::Long qw(:config no_getopt_compat);
 use Mail::Internet;
 use Mail::Box::Maildir;
@@ -41,9 +42,11 @@ sub search($$) {
 $query = shell_quote($query);

 empty_maildir($maildir);
-system("notmuch search --output=files $query"
-  . " | sed -e 's: : :g'"
-  . " | xargs --no-run-if-empty ln -s -t $maildir/cur/");
+my @filelist = `notmuch search --output=files $query`;
+foreach(@filelist) {
+chomp;
+symlink($_, "$maildir/cur/" . basename($_));
+}
 }

 sub prompt($$) {
-- 
1.7.7.4



[PATCH] notmuch-mutt: Using /usr/bin/env to call perl

2012-04-11 Thread Taylor Carpenter
Supports other perl install locations
---
 contrib/notmuch-mutt/notmuch-mutt |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/notmuch-mutt/notmuch-mutt 
b/contrib/notmuch-mutt/notmuch-mutt
index 71206c3..424f9a3 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
 #
 # notmuch-mutt - notmuch (of a) helper for Mutt
 #
-- 
1.7.7.4



Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Olivier Berger

Some more details :

Olivier Berger 
writes:

> Hi.
>
> Is there a way to decrypt multipart/encrypted messages in notmuch-emacs
> ?
>
> I can only get a purple "Decryption error" message...
>
> The mail looks like :
>
> MIME-Version: 1.0
> Content-Type: multipart/encrypted; boundary="=-=-=";
>   protocol="application/pgp-encrypted"
>
> --=-=-=
> Content-Type: application/pgp-encrypted
>
> Version: 1
>
> --=-=-=
> Content-Type: application/octet-stream
>
>
> --=-=-=--
>
> Note that gnus decrypts it without any problem.
>

I traced a bit what could be wrong and found out that it's not in the
emacs part :

$ notmuch show --decrypt "subject:whatever"

[...]

header{
olivier.berger at it-sudparis.eu (20 mins. ago) (encrypted)
Subject: whatever
From: olivier.ber...@it-sudparis.eu
To: whomever
Date: Wed, 11 Apr 2012 18:32:23 +0200

header}

body{
Failed to decrypt part: Canceled.

part{ ID: 1, Content-type: multipart/encrypted

part{ ID: 2, Filename: msg.asc, Content-type: application/pgp-encrypted
Non-text part: application/pgp-encrypted

part}

part{ ID: 3, Content-type: application/octet-stream
Non-text part: application/octet-stream

part}

part}

body}

message}


Dunno what happens. Anyone else ?

Thanks in advance.

Best regards,

-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)



How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Olivier Berger
Hi.

Is there a way to decrypt multipart/encrypted messages in notmuch-emacs
?

I can only get a purple "Decryption error" message...

The mail looks like :

MIME-Version: 1.0
Content-Type: multipart/encrypted; boundary="=-=-=";
protocol="application/pgp-encrypted"

--=-=-=
Content-Type: application/pgp-encrypted

Version: 1

--=-=-=
Content-Type: application/octet-stream

-BEGIN PGP MESSAGE-
Version: GnuPG v1.4.12 (GNU/Linux)

hQEMA5jnkYlGlgRTAQf9F6tXf5NsYR01YW/7kvOmlQRN6lFvu6O37Vl7hhy4abEA
[...]
N+EEwAHGxnSyHXZhhro00kZ/MJvc7w8ryafIP7IlbSj5FqjEl+olwrqgiAB0msZh
4A==
=wBO/
-END PGP MESSAGE-
--=-=-=--

Note that gnus decrypts it without any problem.

Thanks in advance.
-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)



[PATCH 2/4] dirent->d_type not available on Soalris

2012-04-11 Thread Austin Clements
Correct me if I'm mistaken, but d_name will only be a basename, so
your calls to stat will fail for files that are not in the current
directory.  I think in all of the situations you had to call stat, we
already construct the absolute path of the file (sometimes a little
later in the code, but it can easily be moved), so this should be easy
to fix.

Rather than sprinkling portability code throughout notmuch-new, it
seems like it would be simpler if this logic were wrapped in a
separate function.  For example, something along the (completely
untested) lines of,

static mode_t
dirent_type (const struct *entry, const char *abspath)
{
struct stat statbuf;
#ifdef _DIRENT_HAVE_D_TYPE
static const mode_t modes[] = {
[DT_BLK]  = S_IFBLK,
[DT_CHR]  = S_IFCHR,
[DT_DIR]  = S_IFDIR,
[DT_FIFO] = S_IFIFO,
[DT_LNK]  = S_IFLNK,
[DT_REG]  = S_IFREG,
[DT_SOCK] = S_IFSOCK
};
if (entry->d_type >= 0 && entry->d_type < sizeof(modes)/sizeof(modes[0]) &&
modes[entry->d_type])
return modes[entry->d_type];
#endif

if (stat(abspath, ) == -1)
return -1;
return statbuf.st_mode & S_IFMT;
}

This has the added benefit of correctly handling DT_UNKNOWN, which we
currently don't.

Instead of taking the absolute path of the file, this could take the
absolute path of the containing directory and construct the full path
from that and d_name; that would probably be a nicer interface, but it
would be redundant computation.

Quoth Vladimir.Marek at oracle.com on Apr 09 at  6:32 pm:
> From: Vladimir Marek 
> 
> The inspiration was taken from similar issue in mutt:
> http://does-not-exist.org/mail-archives/mutt-dev/msg11290.html
> 
> Signed-off-by: Vladimir Marek 
> ---
>  notmuch-new.c |   28 
>  1 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/notmuch-new.c b/notmuch-new.c
> index 4f13535..3d265bd 100644
> --- a/notmuch-new.c
> +++ b/notmuch-new.c
> @@ -21,6 +21,9 @@
>  #include "notmuch-client.h"
>  
>  #include 
> +#ifndef _DIRENT_HAVE_D_TYPE
> +#include 
> +#endif
>  
>  typedef struct _filename_node {
>  char *filename;
> @@ -167,7 +170,14 @@ _entries_resemble_maildir (struct dirent **entries, int 
> count)
>  int i, found = 0;
>  
>  for (i = 0; i < count; i++) {
> +#ifdef _DIRENT_HAVE_D_TYPE
>   if (entries[i]->d_type != DT_DIR && entries[i]->d_type != DT_UNKNOWN)
> +#else
> + struct stat statbuf;
> + if (stat(entries[i]->d_name, ) == -1)
> + continue;
> + if (! S_ISDIR(statbuf.st_mode))
> +#endif
>   continue;
>  
>   if (strcmp(entries[i]->d_name, "new") == 0 ||
> @@ -258,6 +268,9 @@ add_files_recursive (notmuch_database_t *notmuch,
>  struct stat st;
>  notmuch_bool_t is_maildir, new_directory;
>  const char **tag;
> +#ifndef _DIRENT_HAVE_D_TYPE
> +struct stat statbuf;
> +#endif
>  
>  if (stat (path, )) {
>   fprintf (stderr, "Error reading directory %s: %s\n",
> @@ -328,9 +341,16 @@ add_files_recursive (notmuch_database_t *notmuch,
>* scandir results, then it might be a directory (and if not,
>* then we'll stat and return immediately in the next level of
>* recursion). */
> +#ifdef _DIRENT_HAVE_D_TYPE
>   if (entry->d_type != DT_DIR &&
>   entry->d_type != DT_LNK &&
>   entry->d_type != DT_UNKNOWN)
> +#else
> + if (stat(entry->d_name, ) == -1)
> + continue;
> + if (!(statbuf.st_mode & S_IFDIR) &&
> + !(statbuf.st_mode & S_IFLNK))
> +#endif
>   {
>   continue;
>   }
> @@ -427,7 +447,11 @@ add_files_recursive (notmuch_database_t *notmuch,
>*
>* In either case, a stat does the trick.
>*/
> +#ifdef _DIRENT_HAVE_D_TYPE
>   if (entry->d_type == DT_LNK || entry->d_type == DT_UNKNOWN) {
> +#else
> + if (stat(entry->d_name, ) == -1 || statbuf.st_mode & S_IFLNK) {
> +#endif
>   int err;
>  
>   next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
> @@ -443,7 +467,11 @@ add_files_recursive (notmuch_database_t *notmuch,
>  
>   if (! S_ISREG (st.st_mode))
>   continue;
> +#ifdef _DIRENT_HAVE_D_TYPE
>   } else if (entry->d_type != DT_REG) {
> +#else
> + } else if (statbuf.st_mode & S_IFREG) {
> +#endif
>   continue;
>   }
>  


idea - (dream?) - tagging based on gmail folders - offlineimap, notmuch or both together?

2012-04-11 Thread Alex Botero-Lowry
I've implemented a bi-directional notmuch/gmail sync. It does a full
sync fine, but doesn't do partial syncs at all, and it's too slow to
run a full sync over and over again. I've started working on it again
recently, trying to speed up the full sync process by adding
multiprocessing. The source is at
http://alexbl.net/~alexbl/imapsync.py (older version but the logic
itself hasn't changed), if you're interested in working on it.

On Wed, Apr 11, 2012 at 1:06 AM, Rainer M Krug  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi
>
> I am dreaming again (necessary from time to time...)
>
> I am using offlineimap and notmuch. With offlineimap I sync the "all mail" 
> folder only and with
> notmuch I do the indexing for searching (my normanl mail client is still 
> thunderbird...).
>
> I thought: When I am syncing "all mail" with offlineimap, all my folder 
> (tags) from gmail are
> gone. To avoid this, I could sync all folders, but that would multiply the 
> amound I need to sync
> and likely cause problems.
>
> But what about notmuch could tag my mails based on the gmail folders / tags?
>
> That would be brilliant. Would this be possible? *Is* it possible? I mean - 
> tags in notmuch and in
> gmail - how to sync them? Or would this be a task for offlineimap?
>
> I just know this would be a brilliant solution for using gmail "locally" and, 
> if on the road, from
> the web interface or smartphone.
>
> Any ideas on how to achieve this? Would this be a task for offlineimap, 
> notmuch or a combination
> of both?
>
> Cheers and thanks for a your work on notmuch,
>
> Rainer
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk+FO4wACgkQoYgNqgF2egoiBACdHtIBDpOllw0B/jvTEkzEr4wA
> OTcAnjSj3nd3gt4/k21rkKsY6iQEDs09
> =65Xc
> -END PGP SIGNATURE-
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Jameson Graef Rollins
On Wed, Apr 11 2012, Olivier Berger  wrote:
> Thanks for this suggestion.
>
> As I've responded to Daniel Kahn Gillmor in another message, it seems
> that I may have messed with my config, and gpg-agent may not have worked
> properly.
>
> That's now fixed, I think. See below.

That's great!  I'm glad you got it working.

On Wed, Apr 11 2012, Olivier Berger  wrote:
> Oh, I've spotted why it fails.
>
> So : if I launch emacs (23) from bash running in gnome-terminal in my gnome
> (fallback) session, decryption works.
>
> If I use Alt+F2 to trigger gnome's launcher, and type emacs, then
> decryption won't work :-/
>
> Both emacses run in X, but they don't have same ancestry, which may
> explain why agent connection runs or not ?
>
> Bug, feature ?

I'm not sure what to say here, but it's almost certainly not a notmuch
issue.  It sounds like it may be related to your fairly complicated gpg
setup.  You might want to see what the GPG_AGENT_INFO environment
variable is in the two cases.

In any event, I'm glad you've got it sort of working.  Good luck!

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20120411/28c73a80/attachment.pgp>


Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Daniel Kahn Gillmor
On 04/11/2012 12:58 PM, Olivier Berger wrote:
> 
> Dunno what happens. Anyone else ?

Are you running gpg-agent?

what do you get if you do:

 gpg-connect-agent /bye

(please include the return code)?

if you are running on a debian or debian-derived system, do you have the
gnupg-agent package installed?

--dkg

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1030 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20120411/ef86fcc8/attachment.pgp>


[PATCH 1/4] Make configure use /bin/bash instead of /bin/sh

2012-04-11 Thread Vladimir Marek
Hi,

> >> > Posix /bin/sh is not capable of running this configure and fails.
> >> 
> >> What fails? What would it take to make this work on posix sh instead?
> >> 
> >> The tests do require bash, but generally I think it would be preferable to
> >> not depend on bash to build.
> >
> > Well I gave it a quick stab. This is not posix:
> >
> > BLAH=$( ... )
> > BLAH=$(( ... ))
> > ${option%=*}
> > ${option%%=*}
> > ${option#=*}
> > ${option##=*}
> 
> According to 
> 
> http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
> 
> all of those are part of Shell Command Language...

Hmm, you are right. The solaris /bin/sh is older revision of posix.



> Does the configure script work if you replace /bin/sh with /bin/ksh
> in your Solaris box

yes, it does work if executed by /bin/bash or /bin/ksh


> If yes, something like the following could be added to the beginning
> of 'configure'
> 
> option=option=value
> if test ! x"${option$*=}" = x"value" 2>/dev/null; then
>   if test x"${PREVENT_LOOPING-}" = x; then
>   PREVENT_LOOPING=true; export PREVENT_LOOPING
> test ! -x /bin/ksh || exec /bin/ksh "$0" "$@"
> test ! -x /bin/bash || exec /bin/bash "$0" "$@"
> fi
> echo "Cannot find compatible shell for '$0'" >&2
> exit 1
> fi

Unfortunately, no. The /bin/sh says "bad substitution" and does not run
the script at all. I also tried

eval 'echo ${A%%1}'; echo ok

but that does not run the 'echo ok' and fails also.


I can see three possible solutions

1) use bash or ksh in the shebang line
2) rewrite the script as I gave the overview
3) declare that solaris 10 /bin/sh is not compatible with configure
script


Frankly even 3) is viable option, one just have to remember to run
'bash configure'. If everything else would work, I would be happy :)

Thank you
-- 
Vlad


[PATCH] debian: add gnupg-agent to notmuch recommends

2012-04-11 Thread Jameson Graef Rollins
gnupg-agent is required for message decryption, so this should help
stem some issues encountered by users trying to decrypt messages.
---
 debian/control |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/debian/control b/debian/control
index ada9d3d..bb1974e 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,7 @@ Dm-Upload-Allowed: yes
 Package: notmuch
 Architecture: any
 Depends: libnotmuch2 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
-Recommends: notmuch-emacs | notmuch-vim
+Recommends: notmuch-emacs | notmuch-vim,  gnupg-agent
 Description: thread-based email index, search and tagging
  Notmuch is a system for indexing, searching, reading, and tagging
  large collections of email messages in maildir or mh format. It uses
-- 
1.7.9.1



idea - (dream?) - tagging based on gmail folders - offlineimap, notmuch or both together?

2012-04-11 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi

I am dreaming again (necessary from time to time...)

I am using offlineimap and notmuch. With offlineimap I sync the "all mail" 
folder only and with
notmuch I do the indexing for searching (my normanl mail client is still 
thunderbird...).

I thought: When I am syncing "all mail" with offlineimap, all my folder (tags) 
from gmail are
gone. To avoid this, I could sync all folders, but that would multiply the 
amound I need to sync
and likely cause problems.

But what about notmuch could tag my mails based on the gmail folders / tags?

That would be brilliant. Would this be possible? *Is* it possible? I mean - 
tags in notmuch and in
gmail - how to sync them? Or would this be a task for offlineimap?

I just know this would be a brilliant solution for using gmail "locally" and, 
if on the road, from
the web interface or smartphone.

Any ideas on how to achieve this? Would this be a task for offlineimap, notmuch 
or a combination
of both?

Cheers and thanks for a your work on notmuch,

Rainer
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+FO4wACgkQoYgNqgF2egoiBACdHtIBDpOllw0B/jvTEkzEr4wA
OTcAnjSj3nd3gt4/k21rkKsY6iQEDs09
=65Xc
-END PGP SIGNATURE-



How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Jameson Graef Rollins
On Wed, Apr 11 2012, Olivier Berger  wrote:
> Is there a way to decrypt multipart/encrypted messages in notmuch-emacs

Hi, Olivier.  Yes, it is possible.

> I can only get a purple "Decryption error" message...

The fact that you're getting this messages means that notmuch is
attempting to decrypt the message, but there was a decryption problem.

A typical problem is that gpg-agent is not running.  Notmuch uses gnupg
to decrypt, but it requires that gpg-agent be running to get the
passphrase from the user.  Do you have gpg-agent running?

> The mail looks like :

The format of the multipart/encrypted looks fine, so I see no problems
there (assuming the encryption was done properly).

You might also try decrypting the message on the command line, as that
will take any emacs issues out of the loop:

notmuch show --decrypt id:$msgid

It might help to redirect stdout to /dev/null to make it easier to see
any gnupg error messages

I hope that helps.  Let us know if you still can't figure it out, or if
you have other questions.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20120411/7918ba58/attachment-0001.pgp>


idea - (dream?) - tagging based on gmail folders - offlineimap, notmuch or both together?

2012-04-11 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi

I am dreaming again (necessary from time to time...)

I am using offlineimap and notmuch. With offlineimap I sync the all mail 
folder only and with
notmuch I do the indexing for searching (my normanl mail client is still 
thunderbird...).

I thought: When I am syncing all mail with offlineimap, all my folder (tags) 
from gmail are
gone. To avoid this, I could sync all folders, but that would multiply the 
amound I need to sync
and likely cause problems.

But what about notmuch could tag my mails based on the gmail folders / tags?

That would be brilliant. Would this be possible? *Is* it possible? I mean - 
tags in notmuch and in
gmail - how to sync them? Or would this be a task for offlineimap?

I just know this would be a brilliant solution for using gmail locally and, 
if on the road, from
the web interface or smartphone.

Any ideas on how to achieve this? Would this be a task for offlineimap, notmuch 
or a combination
of both?

Cheers and thanks for a your work on notmuch,

Rainer
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+FO4wACgkQoYgNqgF2egoiBACdHtIBDpOllw0B/jvTEkzEr4wA
OTcAnjSj3nd3gt4/k21rkKsY6iQEDs09
=65Xc
-END PGP SIGNATURE-

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/4] Make configure use /bin/bash instead of /bin/sh

2012-04-11 Thread Vladimir Marek
Hi,

   Posix /bin/sh is not capable of running this configure and fails.
  
  What fails? What would it take to make this work on posix sh instead?
  
  The tests do require bash, but generally I think it would be preferable to
  not depend on bash to build.
 
  Well I gave it a quick stab. This is not posix:
 
  BLAH=$( ... )
  BLAH=$(( ... ))
  ${option%=*}
  ${option%%=*}
  ${option#=*}
  ${option##=*}
 
 According to 
 
 http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
 
 all of those are part of Shell Command Language...

Hmm, you are right. The solaris /bin/sh is older revision of posix.



 Does the configure script work if you replace /bin/sh with /bin/ksh
 in your Solaris box

yes, it does work if executed by /bin/bash or /bin/ksh


 If yes, something like the following could be added to the beginning
 of 'configure'
 
 option=option=value
 if test ! x${option$*=} = xvalue 2/dev/null; then
   if test x${PREVENT_LOOPING-} = x; then
   PREVENT_LOOPING=true; export PREVENT_LOOPING
 test ! -x /bin/ksh || exec /bin/ksh $0 $@
 test ! -x /bin/bash || exec /bin/bash $0 $@
 fi
 echo Cannot find compatible shell for '$0' 2
 exit 1
 fi

Unfortunately, no. The /bin/sh says bad substitution and does not run
the script at all. I also tried

eval 'echo ${A%%1}'; echo ok

but that does not run the 'echo ok' and fails also.


I can see three possible solutions

1) use bash or ksh in the shebang line
2) rewrite the script as I gave the overview
3) declare that solaris 10 /bin/sh is not compatible with configure
script


Frankly even 3) is viable option, one just have to remember to run
'bash configure'. If everything else would work, I would be happy :)

Thank you
-- 
Vlad
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Olivier Berger
Hi.

Is there a way to decrypt multipart/encrypted messages in notmuch-emacs
?

I can only get a purple Decryption error message...

The mail looks like :

MIME-Version: 1.0
Content-Type: multipart/encrypted; boundary==-=-=;
protocol=application/pgp-encrypted

--=-=-=
Content-Type: application/pgp-encrypted

Version: 1

--=-=-=
Content-Type: application/octet-stream

-BEGIN PGP MESSAGE-
Version: GnuPG v1.4.12 (GNU/Linux)

hQEMA5jnkYlGlgRTAQf9F6tXf5NsYR01YW/7kvOmlQRN6lFvu6O37Vl7hhy4abEA
[...]
N+EEwAHGxnSyHXZhhro00kZ/MJvc7w8ryafIP7IlbSj5FqjEl+olwrqgiAB0msZh
4A==
=wBO/
-END PGP MESSAGE-
--=-=-=--

Note that gnus decrypts it without any problem.

Thanks in advance.
-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Jameson Graef Rollins
On Wed, Apr 11 2012, Olivier Berger olivier.ber...@it-sudparis.eu wrote:
 Is there a way to decrypt multipart/encrypted messages in notmuch-emacs

Hi, Olivier.  Yes, it is possible.

 I can only get a purple Decryption error message...

The fact that you're getting this messages means that notmuch is
attempting to decrypt the message, but there was a decryption problem.

A typical problem is that gpg-agent is not running.  Notmuch uses gnupg
to decrypt, but it requires that gpg-agent be running to get the
passphrase from the user.  Do you have gpg-agent running?

 The mail looks like :

The format of the multipart/encrypted looks fine, so I see no problems
there (assuming the encryption was done properly).

You might also try decrypting the message on the command line, as that
will take any emacs issues out of the loop:

notmuch show --decrypt id:$msgid

It might help to redirect stdout to /dev/null to make it easier to see
any gnupg error messages

I hope that helps.  Let us know if you still can't figure it out, or if
you have other questions.

jamie.


pgpt3PcktnRP4.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Olivier Berger

Some more details :

Olivier Berger olivier.ber...@it-sudparis.eu
writes:

 Hi.

 Is there a way to decrypt multipart/encrypted messages in notmuch-emacs
 ?

 I can only get a purple Decryption error message...

 The mail looks like :

 MIME-Version: 1.0
 Content-Type: multipart/encrypted; boundary==-=-=;
   protocol=application/pgp-encrypted

 --=-=-=
 Content-Type: application/pgp-encrypted

 Version: 1

 --=-=-=
 Content-Type: application/octet-stream


 --=-=-=--

 Note that gnus decrypts it without any problem.


I traced a bit what could be wrong and found out that it's not in the
emacs part :

$ notmuch show --decrypt subject:whatever

[...]

header{
olivier.ber...@it-sudparis.eu (20 mins. ago) (encrypted)
Subject: whatever
From: olivier.ber...@it-sudparis.eu
To: whomever
Date: Wed, 11 Apr 2012 18:32:23 +0200

header}

body{
Failed to decrypt part: Canceled.

part{ ID: 1, Content-type: multipart/encrypted

part{ ID: 2, Filename: msg.asc, Content-type: application/pgp-encrypted
Non-text part: application/pgp-encrypted

part}

part{ ID: 3, Content-type: application/octet-stream
Non-text part: application/octet-stream

part}

part}

body}

message}


Dunno what happens. Anyone else ?

Thanks in advance.

Best regards,

-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Daniel Kahn Gillmor
On 04/11/2012 12:58 PM, Olivier Berger wrote:
 
 Dunno what happens. Anyone else ?

Are you running gpg-agent?

what do you get if you do:

 gpg-connect-agent /bye

(please include the return code)?

if you are running on a debian or debian-derived system, do you have the
gnupg-agent package installed?

--dkg



signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] debian: add gnupg-agent to notmuch recommends

2012-04-11 Thread Jameson Graef Rollins
gnupg-agent is required for message decryption, so this should help
stem some issues encountered by users trying to decrypt messages.
---
 debian/control |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/debian/control b/debian/control
index ada9d3d..bb1974e 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,7 @@ Dm-Upload-Allowed: yes
 Package: notmuch
 Architecture: any
 Depends: libnotmuch2 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
-Recommends: notmuch-emacs | notmuch-vim
+Recommends: notmuch-emacs | notmuch-vim,  gnupg-agent
 Description: thread-based email index, search and tagging
  Notmuch is a system for indexing, searching, reading, and tagging
  large collections of email messages in maildir or mh format. It uses
-- 
1.7.9.1

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/4] Make configure use /bin/bash instead of /bin/sh

2012-04-11 Thread Tomi Ollila
On Wed, Apr 11 2012, Vladimir Marek vladimir.ma...@oracle.com wrote:

 Hi,


[ ... ]


 Does the configure script work if you replace /bin/sh with /bin/ksh
 in your Solaris box

 yes, it does work if executed by /bin/bash or /bin/ksh


 If yes, something like the following could be added to the beginning
 of 'configure'
 
 option=option=value
 if test ! x${option$*=} = xvalue 2/dev/null; then
  if test x${PREVENT_LOOPING-} = x; then
  PREVENT_LOOPING=true; export PREVENT_LOOPING
 test ! -x /bin/ksh || exec /bin/ksh $0 $@
 test ! -x /bin/bash || exec /bin/bash $0 $@
 fi
 echo Cannot find compatible shell for '$0' 2
 exit 1
 fi

 Unfortunately, no. The /bin/sh says bad substitution and does not run
 the script at all. I also tried

 eval 'echo ${A%%1}'; echo ok

 but that does not run the 'echo ok' and fails also.

You're right! I tested this stuff using heirloom-sh
from http://heirloom.sourceforge.net/sh.html

It is interesting that the shell stops executing when 
it finds this syntax (instead of contnuing, even without -e)

 I can see three possible solutions

 1) use bash or ksh in the shebang line

Cannot do there are systems lacking /bin/bash  /bin/ksh

 2) rewrite the script as I gave the overview

Some work todo; case construct can do option key matching to get 
identical interface and then cut or sed to get just option value.

 3) declare that solaris 10 /bin/sh is not compatible with configure
 script

 Frankly even 3) is viable option, one just have to remember to run
 'bash configure'. If everything else would work, I would be happy :)

Option 4) use the following heuristics:

case ~ in '~')
if test x${PREVENT_LOOPING-} = x; then
PREVENT_LOOPING=true; export PREVENT_LOOPING
for x in /bin/ksh /bin/bash /usr/bin/bash
do test ! -x $x || exec $x $0 $@
done
fi
echo Cannot find compatible shell for '$0' 2
exit 1
esac

i.e. if tilde expansion is not done guess this shell is not 
compatible enough

Option 5) do substitution check in subshell:

( option=option=value; : ${option$*=} ) 2/dev/null || {
if test x${PREVENT_LOOPING-} = x; then
PREVENT_LOOPING=true; export PREVENT_LOOPING
for x in /bin/ksh /bin/bash /usr/bin/bash
do test ! -x $x || exec $x $0 $@
done
fi
echo Cannot find compatible shell for '$0' 2
exit 1
}


 Thank you
 -- 
   Vlad

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/4] dirent-d_type not available on Soalris

2012-04-11 Thread Tomi Ollila
On Mon, Apr 09 2012, vladimir.ma...@oracle.com wrote:

 From: Vladimir Marek vlma...@volny.cz

 The inspiration was taken from similar issue in mutt:
 http://does-not-exist.org/mail-archives/mutt-dev/msg11290.html

 Signed-off-by: Vladimir Marek vlma...@volny.cz
 ---

Code looks pretty good, but 2 issues

1) Commit message should contain more verbose information what and 
   why something was done.

2) Does these #ifdefs break code indenters such as uncrustify(1),
   indent(1) and emacs(1) indent functionality.
   (That used to happen but maybe these indenters are smarted today.

Tomi

  notmuch-new.c |   28 
  1 files changed, 28 insertions(+), 0 deletions(-)
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 0/6] Finish show rewrite

2012-04-11 Thread Tomi Ollila
On Sun, Apr 08 2012, Austin Clements wrote:

 The long-awaited and oft-belated conclusion of the show rewrite.  All
 of the formatters have been converted to the new style, so this series
 just rips out unused code and does a little cleanup.

Looks good, tests pass.

+1

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: bug fixes to emacs notmuch-tag-completion function

2012-04-11 Thread Tomi Ollila
On Mon, Apr 09 2012, Jameson Graef Rollins wrote:

 I had originally included this fixes as part of a more involved series
 to fix up tagging functions [0].  However, these are actually bug
 fixes that stand alone and should not be bogged down in a series
 that's likely going to take a while to come to fruition.  The changes
 here are pretty trivial, so hopefully they can get pushed quickly and
 I'll rework the rest of tagging fix up series on top of them.

LGTM.


 jamie.

 [0] id:154853-25729-1-git-send-email-jroll...@finestructure.net

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/4] dirent-d_type not available on Soalris

2012-04-11 Thread Austin Clements
Correct me if I'm mistaken, but d_name will only be a basename, so
your calls to stat will fail for files that are not in the current
directory.  I think in all of the situations you had to call stat, we
already construct the absolute path of the file (sometimes a little
later in the code, but it can easily be moved), so this should be easy
to fix.

Rather than sprinkling portability code throughout notmuch-new, it
seems like it would be simpler if this logic were wrapped in a
separate function.  For example, something along the (completely
untested) lines of,

static mode_t
dirent_type (const struct *entry, const char *abspath)
{
struct stat statbuf;
#ifdef _DIRENT_HAVE_D_TYPE
static const mode_t modes[] = {
[DT_BLK]  = S_IFBLK,
[DT_CHR]  = S_IFCHR,
[DT_DIR]  = S_IFDIR,
[DT_FIFO] = S_IFIFO,
[DT_LNK]  = S_IFLNK,
[DT_REG]  = S_IFREG,
[DT_SOCK] = S_IFSOCK
};
if (entry-d_type = 0  entry-d_type  sizeof(modes)/sizeof(modes[0]) 
modes[entry-d_type])
return modes[entry-d_type];
#endif

if (stat(abspath, statbuf) == -1)
return -1;
return statbuf.st_mode  S_IFMT;
}

This has the added benefit of correctly handling DT_UNKNOWN, which we
currently don't.

Instead of taking the absolute path of the file, this could take the
absolute path of the containing directory and construct the full path
from that and d_name; that would probably be a nicer interface, but it
would be redundant computation.

Quoth vladimir.ma...@oracle.com on Apr 09 at  6:32 pm:
 From: Vladimir Marek vlma...@volny.cz
 
 The inspiration was taken from similar issue in mutt:
 http://does-not-exist.org/mail-archives/mutt-dev/msg11290.html
 
 Signed-off-by: Vladimir Marek vlma...@volny.cz
 ---
  notmuch-new.c |   28 
  1 files changed, 28 insertions(+), 0 deletions(-)
 
 diff --git a/notmuch-new.c b/notmuch-new.c
 index 4f13535..3d265bd 100644
 --- a/notmuch-new.c
 +++ b/notmuch-new.c
 @@ -21,6 +21,9 @@
  #include notmuch-client.h
  
  #include unistd.h
 +#ifndef _DIRENT_HAVE_D_TYPE
 +#include sys/types.h
 +#endif
  
  typedef struct _filename_node {
  char *filename;
 @@ -167,7 +170,14 @@ _entries_resemble_maildir (struct dirent **entries, int 
 count)
  int i, found = 0;
  
  for (i = 0; i  count; i++) {
 +#ifdef _DIRENT_HAVE_D_TYPE
   if (entries[i]-d_type != DT_DIR  entries[i]-d_type != DT_UNKNOWN)
 +#else
 + struct stat statbuf;
 + if (stat(entries[i]-d_name, statbuf) == -1)
 + continue;
 + if (! S_ISDIR(statbuf.st_mode))
 +#endif
   continue;
  
   if (strcmp(entries[i]-d_name, new) == 0 ||
 @@ -258,6 +268,9 @@ add_files_recursive (notmuch_database_t *notmuch,
  struct stat st;
  notmuch_bool_t is_maildir, new_directory;
  const char **tag;
 +#ifndef _DIRENT_HAVE_D_TYPE
 +struct stat statbuf;
 +#endif
  
  if (stat (path, st)) {
   fprintf (stderr, Error reading directory %s: %s\n,
 @@ -328,9 +341,16 @@ add_files_recursive (notmuch_database_t *notmuch,
* scandir results, then it might be a directory (and if not,
* then we'll stat and return immediately in the next level of
* recursion). */
 +#ifdef _DIRENT_HAVE_D_TYPE
   if (entry-d_type != DT_DIR 
   entry-d_type != DT_LNK 
   entry-d_type != DT_UNKNOWN)
 +#else
 + if (stat(entry-d_name, statbuf) == -1)
 + continue;
 + if (!(statbuf.st_mode  S_IFDIR) 
 + !(statbuf.st_mode  S_IFLNK))
 +#endif
   {
   continue;
   }
 @@ -427,7 +447,11 @@ add_files_recursive (notmuch_database_t *notmuch,
*
* In either case, a stat does the trick.
*/
 +#ifdef _DIRENT_HAVE_D_TYPE
   if (entry-d_type == DT_LNK || entry-d_type == DT_UNKNOWN) {
 +#else
 + if (stat(entry-d_name, statbuf) == -1 || statbuf.st_mode  S_IFLNK) {
 +#endif
   int err;
  
   next = talloc_asprintf (notmuch, %s/%s, path, entry-d_name);
 @@ -443,7 +467,11 @@ add_files_recursive (notmuch_database_t *notmuch,
  
   if (! S_ISREG (st.st_mode))
   continue;
 +#ifdef _DIRENT_HAVE_D_TYPE
   } else if (entry-d_type != DT_REG) {
 +#else
 + } else if (statbuf.st_mode  S_IFREG) {
 +#endif
   continue;
   }
  
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] Record dependencies during build instead of before

2012-04-11 Thread Austin Clements
Previously, the makefile created dependency files in a separate, first
pass.  In particular, include-ing the dependency files would cause
make to attempt to rebuild those files using the dependency-generation
rules in the makefile.  Unfortunately, this approach required obtuse
rules and silently delayed the start of the build process (by quite a
bit on a clean tree without any dependency files).  Worse, this
required the dependency files to themselves depend on all of the
headers the source file depended on, which meant that, if a header
file was removed, the depedency file could not be updated because of a
missing dependency (!), which would cause make to silently fail.

This patch eliminates the dependency generation rules and instead
generates dependency files as a side-effect of the regular build rule.
On the first build, we don't need to know the dependencies beforehand;
the object file doesn't exist, so it will be built anyway.  On
subsequent builds, if a header file is updated, the dependency rules
generated by the previous build will force a rebuild.  If a source
file is updated, the dependency rules may be stale, but it doesn't
matter because the updated source file will force a rebuild.

In the final case above, the stale dependency rules may refer to a
header file that no longer exists but is also no longer needed.  In
order to prevent this from breaking the build, we also pass gcc the
-MP option, which generates phony targets for every depended-on header
file, so make won't complain if it can't find them during a later
build.
---
Sorry, the previous version of this patch was corrupted.  Hopefully
this one will be correct.

 Makefile.local |   18 --
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 1131dea..525eda0 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -256,22 +256,12 @@ endif
 quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
 
 %.o: %.cc $(global_deps)
+   @mkdir -p .deps/$(@D)
+   $(call quiet,CXX $(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $ -o $@ -MD -MP -MF 
.deps/$*.d
-   $(call quiet,CXX $(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $ -o $@
 
 %.o: %.c $(global_deps)
+   @mkdir -p .deps/$(@D)
+   $(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $ -o $@ -MD -MP -MF 
.deps/$*.d
-   $(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $ -o $@
-
-.deps/%.d: %.c $(global_deps)
-   @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
-   $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $  $@. 2/dev/null ; \
-   sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g'  $@.  $@; \
-   rm -f $@.
-
-.deps/%.d: %.cc $(global_deps)
-   @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
-   $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $  $@. 2/dev/null ; \
-   sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g'  $@.  $@; \
-   rm -f $@.
 
 .PHONY : clean
 clean:
-- 
1.7.9.1

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Olivier Berger
Hi.

Daniel Kahn Gillmor
d...@fifthhorseman.net writes:

 On 04/11/2012 12:58 PM, Olivier Berger wrote:
 
 Dunno what happens. Anyone else ?

 Are you running gpg-agent?


I wasn't, but was using gnome's keyring daemon instead.

I have added 'use_agent' back in my ~/.gnupg/gpg.conf, rebooted and can
now see gpg-agent running, and all seems much better.

 what do you get if you do:

  gpg-connect-agent /bye

 (please include the return code)?


Works now, with $? == 0.

 if you are running on a debian or debian-derived system, do you have the
 gnupg-agent package installed?

   --dkg


Thanks for these hints : notmuch show --decrypt works now.

Thanks for your help.

Best regards,

P.S.: I have a somewhat special gpg setup, cause I'm wrapping it with a
script which tests its options and eventually add necessary bits to
access a crypted FS on a usb key... some that may have created some of a
mess in my GPG agent config :-/
-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] Record dependencies during build instead of before

2012-04-11 Thread Tomi Ollila
On Wed, Apr 11 2012, Austin Clements amdra...@mit.edu wrote:

 Previously, the makefile created dependency files in a separate, first
 pass.  In particular, include-ing the dependency files would cause
 make to attempt to rebuild those files using the dependency-generation
 rules in the makefile.  Unfortunately, this approach required obtuse
 rules and silently delayed the start of the build process (by quite a
 bit on a clean tree without any dependency files).  Worse, this
 required the dependency files to themselves depend on all of the
 headers the source file depended on, which meant that, if a header
 file was removed, the depedency file could not be updated because of a
 missing dependency (!), which would cause make to silently fail.

 This patch eliminates the dependency generation rules and instead
 generates dependency files as a side-effect of the regular build rule.
 On the first build, we don't need to know the dependencies beforehand;
 the object file doesn't exist, so it will be built anyway.  On
 subsequent builds, if a header file is updated, the dependency rules
 generated by the previous build will force a rebuild.  If a source
 file is updated, the dependency rules may be stale, but it doesn't
 matter because the updated source file will force a rebuild.

 In the final case above, the stale dependency rules may refer to a
 header file that no longer exists but is also no longer needed.  In
 order to prevent this from breaking the build, we also pass gcc the
 -MP option, which generates phony targets for every depended-on header
 file, so make won't complain if it can't find them during a later
 build.
 ---

Looks good, patch applies and works (at least the cases I tested and
examined). And is definitely better than before.

+1

Tomi 

 Sorry, the previous version of this patch was corrupted.  Hopefully
 this one will be correct.

  Makefile.local |   18 --
  1 files changed, 4 insertions(+), 14 deletions(-)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Olivier Berger
Hi.

Jameson Graef Rollins
jroll...@finestructure.net writes:

 On Wed, Apr 11 2012, Olivier Berger olivier.ber...@it-sudparis.eu wrote:
 Is there a way to decrypt multipart/encrypted messages in notmuch-emacs

 Hi, Olivier.  Yes, it is possible.

 I can only get a purple Decryption error message...

 The fact that you're getting this messages means that notmuch is
 attempting to decrypt the message, but there was a decryption problem.

 A typical problem is that gpg-agent is not running.  Notmuch uses gnupg
 to decrypt, but it requires that gpg-agent be running to get the
 passphrase from the user.  Do you have gpg-agent running?


Thanks for this suggestion.

As I've responded to Daniel Kahn Gillmor in another message, it seems
that I may have messed with my config, and gpg-agent may not have worked
properly.

That's now fixed, I think. See below.

 The mail looks like :

 The format of the multipart/encrypted looks fine, so I see no problems
 there (assuming the encryption was done properly).

 You might also try decrypting the message on the command line, as that
 will take any emacs issues out of the loop:

 notmuch show --decrypt id:$msgid


That works now, but only on the command-line.

Still, in notmuch-emacs, I can still see the purple Decryption error
message :-/

Weird.

Any other ideas ?

Best regards,

-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Olivier Berger
Hi again.

Olivier Berger olivier.ber...@it-sudparis.eu
writes:

 Hi.

 Jameson Graef Rollins
 jroll...@finestructure.net writes:


 You might also try decrypting the message on the command line, as that
 will take any emacs issues out of the loop:

 notmuch show --decrypt id:$msgid


 That works now, but only on the command-line.

 Still, in notmuch-emacs, I can still see the purple Decryption error
 message :-/

 Weird.


Oh, I've spotted why it fails.

So : if I launch emacs (23) from bash running in gnome-terminal in my gnome
(fallback) session, decryption works.

If I use Alt+F2 to trigger gnome's launcher, and type emacs, then
decryption won't work :-/

Both emacses run in X, but they don't have same ancestry, which may
explain why agent connection runs or not ?

Bug, feature ?

Thanks in advance.

Best regards,

-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Daniel Kahn Gillmor
On 04/11/2012 05:02 PM, Olivier Berger wrote:
 So : if I launch emacs (23) from bash running in gnome-terminal in my gnome
 (fallback) session, decryption works.
 
 If I use Alt+F2 to trigger gnome's launcher, and type emacs, then
 decryption won't work :-/
 
 Both emacses run in X, but they don't have same ancestry, which may
 explain why agent connection runs or not ?

Can you try comparing their environments?

Assuming you're using the Linux kernel, if the two emacsen have process
IDs $PID0 and $PID1, then in bash you can do:

diff -u \
 (tr '\0' '\n'  /proc/$PID0/environ | sort) \
 (tr '\0' '\n'  /proc/$PID1/environ | sort) \

hth,

--dkg



signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 4/4] Explicitly type void* pointers

2012-04-11 Thread Austin Clements
On Mon, 09 Apr 2012, Jani Nikula j...@nikula.org wrote:
 Vladimir Marek vladimir.ma...@oracle.com writes:
 I'm throwing in a third alternative below. Does it work for you? I think
 it's both prettier and uglier than the above at the same time! ;)

 A middle ground would be to change the callers to use
 notmuch_talloc_steal, and just #define notmuch_talloc_steal
 talloc_steal if __GNUC__ = 3.

 One could argue upstream talloc should have this, but OTOH it's a C
 library.

 BR,
 Jani.


 diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
 index ea836f7..83b46e8 100644
 --- a/lib/notmuch-private.h
 +++ b/lib/notmuch-private.h
 @@ -499,4 +499,22 @@ _notmuch_filenames_create (const void *ctx,
  
  NOTMUCH_END_DECLS
  
 +#ifdef __cplusplus
 +/* Implicit typecast from 'void *' to 'T *' is okay in C, but not in
 + * C++. In talloc_steal, an explicit cast is provided for type safety
 + * in some GCC versions. Otherwise, a cast is required. Provide a
 + * template function for this to maintain type safety, and redefine
 + * talloc_steal to use it.
 + */
 +#if !(__GNUC__ = 3)
 +template class T
 +T *notmuch_talloc_steal(const void *new_ctx, const T *ptr)
 +{
 +return static_castT*(talloc_steal(new_ctx, ptr));
 +}
 +#undef talloc_steal
 +#define talloc_steal notmuch_talloc_steal
 +#endif
 +#endif
 +
  #endif

This looks good to me.  I was originally concerned that this depended on
talloc_steal being a macro, but I realized that's not actually the case.
Care to roll a real patch?
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: How to decrypt multipart/encrypted parts in notmuch-emacs

2012-04-11 Thread Jameson Graef Rollins
On Wed, Apr 11 2012, Olivier Berger olivier.ber...@it-sudparis.eu wrote:
 Thanks for this suggestion.

 As I've responded to Daniel Kahn Gillmor in another message, it seems
 that I may have messed with my config, and gpg-agent may not have worked
 properly.

 That's now fixed, I think. See below.

That's great!  I'm glad you got it working.

On Wed, Apr 11 2012, Olivier Berger olivier.ber...@it-sudparis.eu wrote:
 Oh, I've spotted why it fails.

 So : if I launch emacs (23) from bash running in gnome-terminal in my gnome
 (fallback) session, decryption works.

 If I use Alt+F2 to trigger gnome's launcher, and type emacs, then
 decryption won't work :-/

 Both emacses run in X, but they don't have same ancestry, which may
 explain why agent connection runs or not ?

 Bug, feature ?

I'm not sure what to say here, but it's almost certainly not a notmuch
issue.  It sounds like it may be related to your fairly complicated gpg
setup.  You might want to see what the GPG_AGENT_INFO environment
variable is in the two cases.

In any event, I'm glad you've got it sort of working.  Good luck!

jamie.


pgpPvugtxbVAs.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: idea - (dream?) - tagging based on gmail folders - offlineimap, notmuch or both together?

2012-04-11 Thread Alex Botero-Lowry
I've implemented a bi-directional notmuch/gmail sync. It does a full
sync fine, but doesn't do partial syncs at all, and it's too slow to
run a full sync over and over again. I've started working on it again
recently, trying to speed up the full sync process by adding
multiprocessing. The source is at
http://alexbl.net/~alexbl/imapsync.py (older version but the logic
itself hasn't changed), if you're interested in working on it.

On Wed, Apr 11, 2012 at 1:06 AM, Rainer M Krug r.m.k...@gmail.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hi

 I am dreaming again (necessary from time to time...)

 I am using offlineimap and notmuch. With offlineimap I sync the all mail 
 folder only and with
 notmuch I do the indexing for searching (my normanl mail client is still 
 thunderbird...).

 I thought: When I am syncing all mail with offlineimap, all my folder 
 (tags) from gmail are
 gone. To avoid this, I could sync all folders, but that would multiply the 
 amound I need to sync
 and likely cause problems.

 But what about notmuch could tag my mails based on the gmail folders / tags?

 That would be brilliant. Would this be possible? *Is* it possible? I mean - 
 tags in notmuch and in
 gmail - how to sync them? Or would this be a task for offlineimap?

 I just know this would be a brilliant solution for using gmail locally and, 
 if on the road, from
 the web interface or smartphone.

 Any ideas on how to achieve this? Would this be a task for offlineimap, 
 notmuch or a combination
 of both?

 Cheers and thanks for a your work on notmuch,

 Rainer
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAk+FO4wACgkQoYgNqgF2egoiBACdHtIBDpOllw0B/jvTEkzEr4wA
 OTcAnjSj3nd3gt4/k21rkKsY6iQEDs09
 =65Xc
 -END PGP SIGNATURE-

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] notmuch-mutt: Using /usr/bin/env to call perl

2012-04-11 Thread Taylor Carpenter
Supports other perl install locations
---
 contrib/notmuch-mutt/notmuch-mutt |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/notmuch-mutt/notmuch-mutt 
b/contrib/notmuch-mutt/notmuch-mutt
index 71206c3..424f9a3 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
 #
 # notmuch-mutt - notmuch (of a) helper for Mutt
 #
-- 
1.7.7.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] notmuch-mutt: replace gnu sed and xargs with perl

2012-04-11 Thread Taylor Carpenter
External software dependencies removed: sed and xargs.

Sed shell escaping is handled automatically with perl symlink function.

The xargs usage is specific to gnu xargs (fails on bsd xargs, etc).

NOTE: The current query pulls the list of files into an array all at
once.  The larger the list the more memory used.
---
 contrib/notmuch-mutt/notmuch-mutt |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/contrib/notmuch-mutt/notmuch-mutt 
b/contrib/notmuch-mutt/notmuch-mutt
index 424f9a3..c995022 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -12,6 +12,7 @@ use strict;
 use warnings;
 
 use File::Path;
+use File::Basename;
 use Getopt::Long qw(:config no_getopt_compat);
 use Mail::Internet;
 use Mail::Box::Maildir;
@@ -41,9 +42,11 @@ sub search($$) {
 $query = shell_quote($query);
 
 empty_maildir($maildir);
-system(notmuch search --output=files $query
-  .  | sed -e 's: : :g'
-  .  | xargs --no-run-if-empty ln -s -t $maildir/cur/);
+my @filelist = `notmuch search --output=files $query`;
+foreach(@filelist) {
+chomp;
+symlink($_, $maildir/cur/ . basename($_));
+}
 }
 
 sub prompt($$) {
-- 
1.7.7.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch