```
../slave.c: In function 'slave_spawn':
../slave.c:441:21: error: 'custom_envp' undeclared (first use in this function); did you mean 'custom_env'?
441 | add_to_env(&custom_envp, "TERMINFO", FOOT_TERMINFO_PATH);
| ^~~~~~~~~~~
| custom_env
../slave.c:441:21: note: each undeclared identifier is reported only once for each function it appears in
```
When launching footclient with -E,--client-environment the environment
variables that should be set by foot, wasn't.
Those variables are:
* TERM
* COLORTERM
* PWD
* SHELL
and all variables defined by the user in the [environment] section in
foot.ini.
In the same way, we did not *unset* TERM_PROGRAM and
TERM_PROGRAM_VERSION.
This patch fixes it by "cloning" the custom environment, making it
mutable, and then adding/removing the variables above from it.
Instead of calling setenv()/unsetenv() directly, we add the wrapper
functions add_to_env() and del_from_env().
When *not* using a custom environment, they simply call
setenv()/unsetenv().
When we *are* using a custom environment, add_to_env() first loops all
existing variables, looking for a match. If a match is found, it's
updated with the new value. If it's not found, a new entry is added.
del_from_env() loops all entries, and removes it when a match is
found. If no match is found, nothing is done.
The mutable environment is allocated on the heap, but never free:d. We
don't need to free it, since it's only allocated after forking, in the
child process.
Closes#1568
When cloning a config struct, the env_vars tllist wasn't correctly
copied. We did correctly iterate and duplicate all old entries, but we
did *not* reset the list in the cloned struct before doing so.
This meant the list contained entries shared with the original list,
causing double free:s in --server mode.
764248bb0d modified
wayl_surface_scale_explicit_width_height() to not assert the surface
size is valid for the given scaling factor. This, since that function
is only used when scaling a mouse pointer surface.
However, that commit only updated the code path run when fractional
scaling is available (i.e. when the compositor implements the
fractional-scale-v1 protocol).
The legacy code path, that does integer scaling, was still asserting
the surface width/height were divisible with the scaling factor.
For the same reasons this isn't true with fractional scaling
available, it's not true with integer scaling. Fix by skipping the
assertions.
This patch also converts the assertions to more verbose BUG() calls,
that prints more information on the numbers involved.
Closes#1573
It's not critical.
Fixes
../slave.c: In function ‘slave_spawn’:
../slave.c:410:9: error: ignoring return value of ‘chdir’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
410 | chdir("/");
| ^~~~~~~~~~
With this patch, the terminal process now changes PWD to / after
spawning the client application.
This ensures the terminal process itself does not "lock" a
directory. For example, we may keep a mount point from being
unmounted.
Closes#1528
conf file descriptor is closed once again during cleanup at the end of
config_load() if descriptor >= 0. avoid double closing by assigning
negative value to fd after first close.
by the time second close happens some other descriptor might be opened
reusing previous number ie it might happen during foot server startup
when syslog message is logged between one close and the other. in this
particular situation, as of this writing, it considers fd=3 for which
following events apply:
1. conf file is opened and fclosed()
2. warning is logged with syslog which leads to opening socket to
/dev/log which is kept open by glibc (gets fd=3)
3. second close during config_load() closes /dev/log socket descriptor
4. epoll_create() in fdm.c reuses fd=3 again
5. another message is being logged with syslog. glibc notices sendto()
failure on saved /dev/log descriptor hence it closes it and opens
new one
Due to epoll descriptor closure foot starts a chain of errors that
lead to startup failure.
Fixes#1531
Reject color values that aren't in either RGB, or ARGB format. That
is, color values that aren't hexadecimal numbers with either 6 or 8
digits.
Also, if a color value is allowed to have an alpha component, and the
user left it out, default to 0xff (opaque) rather than 0x00 (fully
transparent).
Closes#1526
An opaque sixel that isn't a multiple of the cell size will have some
cells partially visible (either the entire last row, the entire last
column, or both).
These must be rendered before blitting the sixel.
f5f2f5a954 introduced a regression,
where all such cells were rendered as if the cursor was there, giving
them the wrong appearance.
Closes#1520
Pass a damage region to render_row()/render_cell() when rendering
partially visible cells underneath a sixel.
This ensures the affected regions are later reported as 'damaged' to
the Wayland compositor.
Closes#1515
When erasing a sixel, the cells underneath it must be marked as
'dirty', in order to be re-rendered.
This was not being done correctly; the for loop loops *from* the start
col, meaning the *end* col is *not* sixel->pos.col, as that's
the *number* of columns, not the *end* column.
MFD_NOEXEC_SEAL was introduced in linux 6.3. Kernels before that
will *reject* memfd_create() calls that set it.
This caused foot to exit (i.e. not start at all), when compiled on
linux >= 6.3, but run on linux < 6.3.
We _do_ want to use MFD_NOEXEC_SEAL, since a) our memory mapped really
shouldn't be executable, and b) to silence a warning on linux >= 6.3.
To handle all cases, first try *with* MFD_NOEXEC_SEAL. If that fails
with EINVAL, retry *without* it.
Closes#1514
When using the font's own line-height, simply set the baseline
'descent' pixels above the bottom of the cell.
This fixes an issue where some fonts appeared "glued" to the top of
the cell, and sometimes getting partially clipped.
This reverts commit fd813d0e6c.
The intent of the reverted commit was to align font height calculation
with cell height calculation. However, it turns out this breaks some
fonts. Typically those with large:ish differences in their 'height'
attribute, and their ascent+descent value.
Closes#1511