unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch-mutt: use --format=text0 and xargs -0
@ 2018-02-27 19:57 Jani Nikula
  2018-02-27 20:02 ` Jani Nikula
  0 siblings, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2018-02-27 19:57 UTC (permalink / raw)
  To: notmuch

notmuch-mutt fails for message files with special characters such as
single quote in their filename. Use notmuch search --format=text0 and
xargs -0 combo to handle them.

Reported and tested by "dob1" on IRC.
---
 contrib/notmuch-mutt/notmuch-mutt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt
index 0e46a8c1b95e..57f13075aa22 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -48,9 +48,9 @@ sub search($$$) {
     }
 
     empty_maildir($maildir);
-    system("notmuch search --output=files $dup_option $query"
+    system("notmuch search --format=text0 --output=files $dup_option $query"
 	   . " | sed -e 's: :\\\\ :g'"
-	   . " | xargs -r -I searchoutput ln -s searchoutput $maildir/cur/");
+	   . " | xargs -0 -r -I searchoutput ln -s searchoutput $maildir/cur/");
 }
 
 sub prompt($$) {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] notmuch-mutt: use --format=text0 and xargs -0
  2018-02-27 19:57 [PATCH] notmuch-mutt: use --format=text0 and xargs -0 Jani Nikula
@ 2018-02-27 20:02 ` Jani Nikula
  2018-02-28 15:17   ` Tomi Ollila
  0 siblings, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2018-02-27 20:02 UTC (permalink / raw)
  To: notmuch

On Tue, 27 Feb 2018, Jani Nikula <jani@nikula.org> wrote:
> notmuch-mutt fails for message files with special characters such as
> single quote in their filename. Use notmuch search --format=text0 and
> xargs -0 combo to handle them.
>
> Reported and tested by "dob1" on IRC.
> ---
>  contrib/notmuch-mutt/notmuch-mutt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt
> index 0e46a8c1b95e..57f13075aa22 100755
> --- a/contrib/notmuch-mutt/notmuch-mutt
> +++ b/contrib/notmuch-mutt/notmuch-mutt
> @@ -48,9 +48,9 @@ sub search($$$) {
>      }
>  
>      empty_maildir($maildir);
> -    system("notmuch search --output=files $dup_option $query"
> +    system("notmuch search --format=text0 --output=files $dup_option $query"
>  	   . " | sed -e 's: :\\\\ :g'"

Come to think of it, does this need sed -z too?

> -	   . " | xargs -r -I searchoutput ln -s searchoutput $maildir/cur/");
> +	   . " | xargs -0 -r -I searchoutput ln -s searchoutput $maildir/cur/");
>  }
>  
>  sub prompt($$) {
> -- 
> 2.11.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] notmuch-mutt: use --format=text0 and xargs -0
  2018-02-27 20:02 ` Jani Nikula
@ 2018-02-28 15:17   ` Tomi Ollila
  2018-03-01 19:01     ` Tomi Ollila
  0 siblings, 1 reply; 4+ messages in thread
From: Tomi Ollila @ 2018-02-28 15:17 UTC (permalink / raw)
  To: Jani Nikula, notmuch

On Tue, Feb 27 2018, Jani Nikula wrote:

> On Tue, 27 Feb 2018, Jani Nikula <jani@nikula.org> wrote:
>> notmuch-mutt fails for message files with special characters such as
>> single quote in their filename. Use notmuch search --format=text0 and
>> xargs -0 combo to handle them.
>>
>> Reported and tested by "dob1" on IRC.
>> ---
>>  contrib/notmuch-mutt/notmuch-mutt | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt
>> index 0e46a8c1b95e..57f13075aa22 100755
>> --- a/contrib/notmuch-mutt/notmuch-mutt
>> +++ b/contrib/notmuch-mutt/notmuch-mutt
>> @@ -48,9 +48,9 @@ sub search($$$) {
>>      }
>>  
>>      empty_maildir($maildir);
>> -    system("notmuch search --output=files $dup_option $query"
>> +    system("notmuch search --format=text0 --output=files $dup_option $query"
>>  	   . " | sed -e 's: :\\\\ :g'"
>
> Come to think of it, does this need sed -z too?

it looks  to me that sed can  be dropped.

btw how many non-coreutils xargs support -0 option ?




>
>> -	   . " | xargs -r -I searchoutput ln -s searchoutput $maildir/cur/");
>> +	   . " | xargs -0 -r -I searchoutput ln -s searchoutput $maildir/cur/");
>>  }
>>  
>>  sub prompt($$) {
>> -- 
>> 2.11.0
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] notmuch-mutt: use --format=text0 and xargs -0
  2018-02-28 15:17   ` Tomi Ollila
@ 2018-03-01 19:01     ` Tomi Ollila
  0 siblings, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2018-03-01 19:01 UTC (permalink / raw)
  To: notmuch

On Wed, Feb 28 2018, Tomi Ollila wrote:

> On Tue, Feb 27 2018, Jani Nikula wrote:
>
>> On Tue, 27 Feb 2018, Jani Nikula <jani@nikula.org> wrote:
>>> notmuch-mutt fails for message files with special characters such as
>>> single quote in their filename. Use notmuch search --format=text0 and
>>> xargs -0 combo to handle them.
>>>
>>> Reported and tested by "dob1" on IRC.
>>> ---
>>>  contrib/notmuch-mutt/notmuch-mutt | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt
>>> index 0e46a8c1b95e..57f13075aa22 100755
>>> --- a/contrib/notmuch-mutt/notmuch-mutt
>>> +++ b/contrib/notmuch-mutt/notmuch-mutt
>>> @@ -48,9 +48,9 @@ sub search($$$) {
>>>      }
>>>  
>>>      empty_maildir($maildir);
>>> -    system("notmuch search --output=files $dup_option $query"
>>> +    system("notmuch search --format=text0 --output=files $dup_option $query"
>>>  	   . " | sed -e 's: :\\\\ :g'"
>>
>> Come to think of it, does this need sed -z too?
>
> it looks  to me that sed can  be dropped.
>
> btw how many non-coreutils xargs support -0 option ?

Checked (briefly):

openbsd, netbsd, macos and solaris xargs(1) (latest versions...) know -0 option.

so

    system("notmuch search --format=text0 --output=files $dup_option $query"
	   . " | xargs -0 -r -I searchoutput ln -s searchoutput $maildir/cur/");

should be supported enough.


Tomi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-01 19:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-27 19:57 [PATCH] notmuch-mutt: use --format=text0 and xargs -0 Jani Nikula
2018-02-27 20:02 ` Jani Nikula
2018-02-28 15:17   ` Tomi Ollila
2018-03-01 19:01     ` Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).