Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 2/2] termquery: specify $HOST in OSC7 working directory report



On 9 Jan, Johannes Altmanninger wrote:
> If I do
>
> 	client$ cd ~
> 	client$ ssh -t server zsh
> 	server% cd /tmp
>
> and then open a new terminal (using ctrl-shift-n or ctrl-shift-t),
> I expect the terminal program to be started in ~, not in /tmp.

I'll agree that's not good.

It is quite a few years ago that I first added the OSC 7 notification to
my setup and I know that I had issues with it being ignored when using a
real hostname. Using "localhost" and disabling the feature for non-local
shell instances was the simplest path to get it working. When adding
the native support, I know that I considered the fact that the feature
is fairly useless over something like ssh but the scenario you outline
didn't occur to me.

Testing it in foot now, a complete fully qualified hostname works but
a shortname doesn't. There could be other reasons that it wouldn't
match: I've used other terminals in the past, often configured trim in
/etc/host.conf, or not configured a domain at all and when using my ISP
provided router for DNS, it returns a fake top-level domain for reverse
lookups on local systems.

So I'll apply your patches but will need to watch out for where it
doesn't work. In such cases, it may be better to feed back changes to the
terminals to make them more generous in what they accept. In my opinion,
an unqualified but matching shortname should be treated as a match. As a
last resort, we'll need to consider a way to configure the hostname or
to make it use "localhost".

In my own configuration, I have: 

  (( $+SSH_CONNECTION )) && .term.extensions+=( -integration-pwd )

> (FWIW, I don't understand how the existing call to "url_encode()"
> doesn't leak memory.)

From the call to zhalloc(), right? See the comment at the top of
Src/mem.c. At least as far as my understanding goes, this uses arena
style allocation. So a big pool is allocated upfront with small
parcels handed off to calls such as this. So this is only leaked until
the next call to popheap(). I don't claim to have a clear view on what
the scope of push/popheap() calls are. I assume each shell prompt
at worst but could be wrong.

Oliver




Messages sorted by: Reverse Date, Date, Thread, Author