Package: xfstt
Version: 1.10-1
Severity: grave
Tags: upstream

During its start-up, xfstt creates the `/tmp/.font-unix/` directory in order to 
place its socket there.

If, however, the above directory already exists, xfstt:

 - doesn't create the unix socket there if the socket file doesn't exist,
 - doesn't re-use the existing socket file, and
 - fails to listen at a TCP socket even if configured so.

STR:

 1. Make sure xfstt isn't running or stop it first.
 2. As root, create the /tmp/.font-unix/ directory.
 3. Delete /tmp/.font-unix/fs7101 (the socket file).
 4. Start xfstt.
 5. The daemon will start w/o any error:

> # service xfstt status
> [ ok ] xfstt is running.
> 
> # ps -ef | grep xfstt | grep -v grep
> root     31878     1  0 02:00 ?        00:00:00 /usr/bin/xfstt --daemon 
> --port 7101 --unstrap --encoding iso8859-1

 6. In spite of the above, the socket file won't be re-created:

> # ls -l /tmp/.font-unix/
> total 0

 7. Additionally, xfstt will no longer be listening at TCP port 7101:

> # lsof -p 31878
> COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
> xfstt   31878 root  cwd    DIR  254,2    12288 1314666 
> /usr/share/fonts/truetype
> xfstt   31878 root  rtd    DIR  254,1     4096       2 /
> xfstt   31878 root  txt    REG  254,2   129224  805495 /usr/bin/xfstt
> xfstt   31878 root  mem    REG  254,4   311653  134640 
> /var/cache/xfstt/ttname.dir
> xfstt   31878 root  mem    REG  254,1  1824496    2028 
> /lib/x86_64-linux-gnu/libc-2.28.so
> xfstt   31878 root  mem    REG  254,1   100712     661 
> /lib/x86_64-linux-gnu/libgcc_s.so.1
> xfstt   31878 root  mem    REG  254,1  1579448    3929 
> /lib/x86_64-linux-gnu/libm-2.28.so
> xfstt   31878 root  mem    REG  254,2  1570256 2104093 
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
> xfstt   31878 root  mem    REG  254,4    72536  134639 
> /var/cache/xfstt/ttinfo.dir
> xfstt   31878 root  mem    REG  254,1   165632    1889 
> /lib/x86_64-linux-gnu/ld-2.28.s

Normally, I'm also expecting 3 sockets in lsof output:

> xfstt   1663 root    0u  unix 0xffff8838fffb7800      0t0 4774342 
> /tmp/.font-unix/fs7101 type=STREAM
> xfstt   1663 root    1u  IPv4            4774346      0t0     TCP *:7101 
> (LISTEN)
> xfstt   1663 root    2u  IPv6            4774347      0t0     TCP *:7101 
> (LISTEN)

If I re-start xfstt, it'll remove and re-create the /tmp/.font-unix/ directory, 
but this directory
shouldn't be managed by xfstt alone as it may be shared between multiple X font 
servers (e. g.: xfs).

The problem stems from the following fragment in xfstt.cc:

>                 if (mkdir(sockdir, 01777) < 0) {
>                         error(_("cannot make socket directory %s!\n"), 
> sockdir);
>                         close(sd);
>                         return -1;
>                 }

If the directory already exists and has the right permissions, xfstt should 
just proceed.

If the directory already exists but lacks some permissions, xfstt should 
attempt to change those (when running as root).

BTW, /etc/init.d/x11-common script from x11-common already does the job of 
creating X11 socket directories,
so it could be enhanced to take care of /tmp/.font-unix, too.

-- System Information:
Distributor ID: Debian
Description:    Devuan GNU/Linux 3 (beowulf)
Release:        3
Codename:       beowulf
Architecture: x86_64

Kernel: Linux 4.9.0-11-amd64 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8), 
LANGUAGE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages xfstt depends on:
ii  debconf [debconf-2.0]  1.5.71
ii  libc6                  2.28-10
ii  libgcc1                1:8.3.0-6
ii  libstdc++6             8.3.0-6
ii  lsb-base               10.2019051400

xfstt recommends no packages.

xfstt suggests no packages.

-- debconf information:
* xfstt/listen_tcp: true

Reply via email to