unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / Atom feed
* notmuch over ssh
@ 2021-02-10  9:52 Keegan Carruthers-Smith
  2021-02-10 10:51 ` Tomi Ollila
  0 siblings, 1 reply; 3+ messages in thread
From: Keegan Carruthers-Smith @ 2021-02-10  9:52 UTC (permalink / raw)
  To: notmuch

Hello.

Thought I'd share a hack I've been using recently. I have my 
notmuch database on another machine. I wanted to access it via my 
local emacs session. I didn't want to ssh in to the machine or 
sync the data to another machine. I realised all communication is 
done via the notmuch binary, so I wrote a wrapper script which 
runs notmuch via ssh:

  #!/usr/bin/env bash  args=()  for var in "$@" do 
      args+=($(printf '%q' "$var")) 
  done  exec ssh real.local -- notmuch "${args[@]}" 

Note I have hardcoded the remote (real.local). I also needed to 
escape arguments since the remote shell had a tendancy to 
interpret them. This escaping isn't fullproof, but has been 
working so far.

I put the above script on my PATH as "notmuch", and emacs 
magically uses it. Alternatively you could set the notmuch-command 
to point to the above shell script.

Cheers,
Keegan

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

* Re: notmuch over ssh
  2021-02-10  9:52 notmuch over ssh Keegan Carruthers-Smith
@ 2021-02-10 10:51 ` Tomi Ollila
  2021-02-10 11:35   ` Chris Coutinho
  0 siblings, 1 reply; 3+ messages in thread
From: Tomi Ollila @ 2021-02-10 10:51 UTC (permalink / raw)
  To: Keegan Carruthers-Smith, notmuch

On Wed, Feb 10 2021, Keegan Carruthers-Smith wrote:

> Hello.
>
> Thought I'd share a hack I've been using recently. I have my 
> notmuch database on another machine. I wanted to access it via my 
> local emacs session. I didn't want to ssh in to the machine or 
> sync the data to another machine. I realised all communication is 
> done via the notmuch binary, so I wrote a wrapper script which 
> runs notmuch via ssh:

Good stuff !

>
>   #!/usr/bin/env bash  args=()  for var in "$@" do 
>       args+=($(printf '%q' "$var")) 
>   done  exec ssh real.local -- notmuch "${args[@]}" 

In https://notmuchmail.org/remoteusage/

there is an alternative

!/bin/bash
printf -v ARGS "%q " "$@"
exec ssh notmuch notmuch ${ARGS}

(which fork(2)s zero times...)


And then there is my alternative at:

https://github.com/domo141/nottoomuch/blob/master/nottoomuch-remote.rst

(now that I posted that I have to check if it has rotted in last 4 years ;)


Tomi


>
> Note I have hardcoded the remote (real.local). I also needed to 
> escape arguments since the remote shell had a tendancy to 
> interpret them. This escaping isn't fullproof, but has been 
> working so far.
>
> I put the above script on my PATH as "notmuch", and emacs 
> magically uses it. Alternatively you could set the notmuch-command 
> to point to the above shell script.
>
> Cheers,
> Keegan

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

* Re: notmuch over ssh
  2021-02-10 10:51 ` Tomi Ollila
@ 2021-02-10 11:35   ` Chris Coutinho
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Coutinho @ 2021-02-10 11:35 UTC (permalink / raw)
  To: notmuch



On Wed, 2021-02-10 at 12:51 +0200, Tomi Ollila wrote:
> On Wed, Feb 10 2021, Keegan Carruthers-Smith wrote:
> 
> > Hello.
> > 
> > Thought I'd share a hack I've been using recently. I have my 
> > notmuch database on another machine. I wanted to access it via my 
> > local emacs session. I didn't want to ssh in to the machine or 
> > sync the data to another machine. I realised all communication is 
> > done via the notmuch binary, so I wrote a wrapper script which 
> > runs notmuch via ssh:
> 
> Good stuff !
> 
> > 
> >   #!/usr/bin/env bash  args=()  for var in "$@" do 
> >       args+=($(printf '%q' "$var")) 
> >   done  exec ssh real.local -- notmuch "${args[@]}" 
> 
> In https://notmuchmail.org/remoteusage/
> 
> there is an alternative
> 
> !/bin/bash
> printf -v ARGS "%q " "$@"
> exec ssh notmuch notmuch ${ARGS}
> 
> (which fork(2)s zero times...)
> 
> 
> And then there is my alternative at:
> 
> https://github.com/domo141/nottoomuch/blob/master/nottoomuch-remote.rst
> 
> (now that I posted that I have to check if it has rotted in last 4 years ;)
> 
> 
> Tomi
> 
> 
> > 
> > Note I have hardcoded the remote (real.local). I also needed to 
> > escape arguments since the remote shell had a tendancy to 
> > interpret them. This escaping isn't fullproof, but has been 
> > working so far.
> > 
> > I put the above script on my PATH as "notmuch", and emacs 
> > magically uses it. Alternatively you could set the notmuch-command 
> > to point to the above shell script.
> > 
> > Cheers,
> > Keegan
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

Have you tried mounting the notmuch database locally using something like sshfs?
I wonder if that's a safer option than all the string escaping you're doing
here.

On the other hand, your network connection would need to be fast enough to allow
this kind of access, and the notmuch versions installed on either machine need
to be compatible.

Chris\r

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

end of thread, other threads:[~2021-02-10 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10  9:52 notmuch over ssh Keegan Carruthers-Smith
2021-02-10 10:51 ` Tomi Ollila
2021-02-10 11:35   ` Chris Coutinho

unofficial mirror of notmuch@notmuchmail.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/notmuch/0 notmuch/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 notmuch notmuch/ https://yhetil.org/notmuch \
		notmuch@notmuchmail.org
	public-inbox-index notmuch

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.mail.notmuch.general
	nntp://news.gmane.io/gmane.mail.notmuch.general


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git