<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/slave.c, branch 1.14.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.14.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.14.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2023-03-20T14:40:36Z</updated>
<entry>
<title>slave: set $TERM_PROGRAM and $TERM_PROGRAM_VERSION environment variables</title>
<updated>2023-03-20T14:40:36Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2023-03-20T14:40:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5b2f02d826d8043b6b89860c56802ea5fed0f3bd'/>
<id>urn:sha1:5b2f02d826d8043b6b89860c56802ea5fed0f3bd</id>
<content type='text'>
These are already being set by iTerm2, WezTerm, tmux and likely some
others. Even though using yet more environment variables seems rather
questionable, if we don't set these we run the risk of inheriting them
from other terminals.

See also:

* https://gitlab.com/gnachman/iterm2/-/blob/97a6078df8e822da165e91737a01c0b9e115dd16/sources/PTYSession.m#L2568-2570
* https://github.com/tmux/tmux/blob/1d0f68dee9f71c504e03616fa472a408a6caa49b/environ.c#L263-L264
* https://github.com/search?q=TERM_PROGRAM&amp;type=code
</content>
</entry>
<entry>
<title>slave: unsetenv() env vars that have been set to the empty string</title>
<updated>2022-12-06T18:36:15Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-12-01T18:43:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ccfb953bb020a1d229490b8a3e7790ed5c7e1752'/>
<id>urn:sha1:ccfb953bb020a1d229490b8a3e7790ed5c7e1752</id>
<content type='text'>
That is, users can now *clear* environment variables by doing:

  [environment]
  VAR=””

Note that the quotes are required.

Closes #1225
</content>
</entry>
<entry>
<title>slave: spawn: set PWD environment variable</title>
<updated>2022-10-02T18:11:07Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-09-26T17:00:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9e5866109374a3181da06ad411b15bab4a728d8e'/>
<id>urn:sha1:9e5866109374a3181da06ad411b15bab4a728d8e</id>
<content type='text'>
This improves handling of symlinks (in CWD) when launching a new
terminal instance, either through ctrl+shift+n, or using the
--working-directory command line option.

Closes #1179
</content>
</entry>
<entry>
<title>config: add a new ‘environment’ section</title>
<updated>2022-06-13T09:55:23Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-05-28T17:27:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=755f96321ab47f931d11680027d47d1d772f5584'/>
<id>urn:sha1:755f96321ab47f931d11680027d47d1d772f5584</id>
<content type='text'>
This section allows the user to define custom environment variables to
be set in the child process:

  [environment]
  name=value
</content>
</entry>
<entry>
<title>slave: roll our own ‘execvpe()’ on FreeBSD</title>
<updated>2022-04-12T13:07:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-11T12:02:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b3d0cdd4b20855c62a759b66da94907f6bf81cb7'/>
<id>urn:sha1:b3d0cdd4b20855c62a759b66da94907f6bf81cb7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>client/slave: explictly add ‘extern char **environ’</title>
<updated>2022-04-12T13:07:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-11T11:24:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=fd414f79be177b23a67ce87b81657c2bfd80a35e'/>
<id>urn:sha1:fd414f79be177b23a67ce87b81657c2bfd80a35e</id>
<content type='text'>
It’s not in any header files on FreeBSD.
</content>
</entry>
<entry>
<title>client: add -E,--client-environment</title>
<updated>2022-04-12T13:07:40Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-11T10:19:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d02124902b4e27c3ed3ef48442ce17c5e0af9d56'/>
<id>urn:sha1:d02124902b4e27c3ed3ef48442ce17c5e0af9d56</id>
<content type='text'>
When this option is used, the child process in the new terminal
instance will inherit its environment from the footclient process,
instead of the foot server’s.

Implemented by sending (yet another) dynamic string list as part of
the client -&gt; server setup packet. When the new option is *not* used,
the setup packet is now 2 bytes larger than before.

On the server side, the slave process now uses execvpe() instead of
execvp(). There’s plumbing to propagate a new ‘envp’ argument from
term_init() all the way down to slave_exec(). If ‘envp’ is NULL, we
use ‘environ’ instead (thus matching the old behavior of execvp()).

Closes #1004
</content>
</entry>
<entry>
<title>Explicitly initialize sigaction::sa_mask members with sigemptyset(3)</title>
<updated>2022-02-12T12:26:42Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2022-02-12T12:04:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=23cf80667a36aaff1865fc50afab3f98a796cf14'/>
<id>urn:sha1:23cf80667a36aaff1865fc50afab3f98a796cf14</id>
<content type='text'>
Not doing so before calling sigaction(3) is "undefined" according to
POSIX[1]:

&gt; Applications shall call either sigemptyset() or sigfillset() at least
&gt; once for each object of type sigset_t prior to any other use of that
&gt; object. If such an object is not initialized in this way, but is
&gt; nonetheless supplied as an argument to any of pthread_sigmask(),
&gt; sigaction(), sigaddset(), sigdelset(), sigismember(), sigpending(),
&gt; sigprocmask(), sigsuspend(), sigtimedwait(), sigwait(), or
&gt; sigwaitinfo(), the results are undefined.

The use of designated initializers means that sa_mask members were
still being initialized, but sigset_t is an opaque type and implicit
initialization doesn't necessarily produce the same results as using
sigemptyset(3) (although it typically does on most implementations).

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html
</content>
</entry>
<entry>
<title>slave: re-use ‘struct sigaction’ variable when resetting SIGHUP+SIGPIPE</title>
<updated>2021-12-18T22:22:52Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-12-18T22:22:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=027603cbb80b2c9aadd71faaaf75e4912a55a9be'/>
<id>urn:sha1:027603cbb80b2c9aadd71faaaf75e4912a55a9be</id>
<content type='text'>
</content>
</entry>
<entry>
<title>slave: restore SIGPIPE</title>
<updated>2021-12-18T22:20:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-12-18T22:20:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=fb488b61621682d19524c7dba348f7814b7d738f'/>
<id>urn:sha1:fb488b61621682d19524c7dba348f7814b7d738f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>slave: log _which_ CWD we failed to change to</title>
<updated>2021-08-30T15:55:16Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-30T15:55:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=064121ee95268b9968d9b9bc54e6008f96ac91ae'/>
<id>urn:sha1:064121ee95268b9968d9b9bc54e6008f96ac91ae</id>
<content type='text'>
</content>
</entry>
<entry>
<title>slave: set TERMINFO instead of TERMINFO_DIRS</title>
<updated>2021-08-18T18:18:35Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-18T18:18:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8a7264e90577205e81cccb76117e93282d65697c'/>
<id>urn:sha1:8a7264e90577205e81cccb76117e93282d65697c</id>
<content type='text'>
This seems to be slightly better supported than TERMINFO_DIRS. It also
simplifies our code, since it’s no longer an issue of whether to
append or not - we just set TERMINFO, and ignore whatever it was set
to before.

Also closes #687
</content>
</entry>
<entry>
<title>terminfo: install to $datadir/foot/terminfo by default, append to TERMINFO_DIRS</title>
<updated>2021-08-17T19:04:30Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-07T14:42:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=76391868650240b2314a66d182e4d07cf8491f54'/>
<id>urn:sha1:76391868650240b2314a66d182e4d07cf8491f54</id>
<content type='text'>
As of 2021-07-31, ncurses ships its own version of foot’s terminfo.

Since:

* It doesn’t have the non-standard Sync,Tc,setrgbf,setrgbb
  capabilities.
* It doesn’t set hs,fsl,dsl (statusbar).
* We want to be able to update our termminfo without waiting for an
  ncurses release.
* Foot should be installable and usable on Linux systems that doesn’t
  have the latest ncurses.

we still want to ship our own version. We can however not install it
to the default terminfo location (e.g. /usr/share/terminfo), since it
will collide with the ncurses provided files.

Our options are to either rename our terminfo to something else, or to
keep the name, but install our terminfo files somewhere else.

The first option would be the easy one. However, I think it makes
sense to use the same name. For example, a user that SSH’s into a
remote system that does *not* have our own version installed,
but *does* have the ncurses one, will gracefully fall back to that
one, which is better than manually having to set
e.g. TERM=xterm-256color.

Now, if we want to use the same name, we need to install it somewhere
else. But where? And how do we ensure our version is preferred over
the ncurses one?

I opted to $datadir/foot/terminfo (e.g. /usr/share/foot/terminfo) by
default. It makes it namespaced to foot (i.e. we’re not introducing a
new “standard” terminfo location), thus guaranteeing it wont collide
with ncurses.

To enable applications to find it, we export TERMINFO_DIRS. This is a
list of *additional* directories to search for terminfo files. If it’s
already defined, we *append* to it.

The nice thing with this is, if there’s no terminfo in that
location (e.g. when you SSH into a remote), the default terminfo
location is *also* searched. But only *after* having searched through
TERMINFO_DIRS.

In short: our version is preferred, but the ncurses one (or an older
version of our terminfo package!) will be used if ours cannot be
found.

To enable packagers full control over the new behavior, the existing
meson command line options have been modified, and a new option added:

-Dterminfo=disabled|enabled|auto: *build* and *install* the terminfo
files.

-Dcustom-terminfo-install-location=&lt;path&gt;: *where* the terminfo files
are expected to be found.

This *needs* to be set *even* if -Dterminfo=disabled. For example, if
the packaging script builds and packages the terminfo files separate
from the regular foot build. The path is *relative to $prefix*, and
defaults to $datadir/foot/terminfo.

This is the value that will be appended to TERMINFO_DIRS. Note that
you can set it to ‘no’, in which case foot will *not* set/modify
TERMINFO_DIRS. Only do this if you don’t intend to package foot’s
terminfo files at all (i.e. you plan on using the ncurses ones only).

-Ddefault-terminfo=foot. Allows overriding the default TERM
value. This should only be changed if the target platform doesn’t
support terminfo files.

Closes #671
</content>
</entry>
<entry>
<title>tokenize: strdup() each individual argv</title>
<updated>2021-06-20T12:19:22Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-20T12:17:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=42ec2640753650c69385d86c2fbb386d23965c89'/>
<id>urn:sha1:42ec2640753650c69385d86c2fbb386d23965c89</id>
<content type='text'>
Instead of referencing the un-tokenized “raw” command string, strdup()
each argv. This way, the input string can be ‘const’.
</content>
</entry>
<entry>
<title>slave/spawn: restore SIGHUP handler after fork(), before exec()</title>
<updated>2021-06-02T18:13:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-02T15:48:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a72b2688bda87a20d029e80eaf8d6686ca95003e'/>
<id>urn:sha1:a72b2688bda87a20d029e80eaf8d6686ca95003e</id>
<content type='text'>
Foot installs a SIG_IGN handler for SIGHUP. Ignored signals are
inherited in sub-processes. Thus, we need to restore it to SIG_DFL
before exec:ing.
</content>
</entry>
<entry>
<title>notifications: use \e[22m to disable bold</title>
<updated>2021-05-20T15:51:04Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-05-20T15:51:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b75bd6507a970520784791a6ff6beb1cf771077b'/>
<id>urn:sha1:b75bd6507a970520784791a6ff6beb1cf771077b</id>
<content type='text'>
\e[21m was previously used to disable bold. That changed a while ago,
to align foot with the majority of other terminal emulators.

\e[22m now disables both bold and dim.

When this change was done, the user notifications were not updated,
meaning the ‘message’ part was always in bold. This was never the
intended behavior.
</content>
</entry>
<entry>
<title>errno: don’t use ‘_errno’ as a variable name; _ are reserved for use as identifiers</title>
<updated>2021-02-21T19:33:07Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-21T19:33:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=555f751f94a7efa90f03713a876f41f2424ea9f0'/>
<id>urn:sha1:555f751f94a7efa90f03713a876f41f2424ea9f0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>spawn/slave: restore signal mask after fork</title>
<updated>2021-02-21T18:59:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-21T10:57:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=dd5c31657ee934c52f24fd77778c56468d668b45'/>
<id>urn:sha1:dd5c31657ee934c52f24fd77778c56468d668b45</id>
<content type='text'>
slave: no need to restore signal handlers; they are automatically
restored as long as they are not SIG_IGN (which they never are in
foot).

spawn(): restore signal mask after fork. This fixes an issue where a
terminal spawned with ctrl+shift+n did not terminate when its shell
exited.

Closes #366
</content>
</entry>
<entry>
<title>Mark slave_exec() as "noreturn" and convert xassert(false) to BUG(...)</title>
<updated>2021-02-10T09:18:50Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-02-10T09:18:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=19a5f25b80f44e5440a444df8af443d0081e46bf'/>
<id>urn:sha1:19a5f25b80f44e5440a444df8af443d0081e46bf</id>
<content type='text'>
</content>
</entry>
<entry>
<title>slave: skip e310487dae99 if not supported</title>
<updated>2021-01-21T11:00:02Z</updated>
<author>
<name>Jan Beich</name>
<email>jbeich@FreeBSD.org</email>
</author>
<published>2021-01-19T15:09:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=67e713ff3adc1f94087d1016e775d20f89a8675d'/>
<id>urn:sha1:67e713ff3adc1f94087d1016e775d20f89a8675d</id>
<content type='text'>
slave.c:188:26: error: use of undeclared identifier 'IUTF8'
        flags.c_iflag |= IUTF8;
                         ^
</content>
</entry>
</feed>
