Package: fakeroot
Version: 1.24-1
Severity: normal
Tags: patch upstream

Hi,

Hacking x32 Ubuntu at the moment, I ran into a situation where i had to use the 
TCP
fakeroot backend (fakeroot-tcp) instead of the default sysv one because there 
were
issues with it when mixing x32 and amd64 processes.

This solves my issue but turns out fakeroot-tcp is sometimes incredibly slow.
(maybe why it's not used by default ?)

For example:
  $ time fakeroot-tcp cp -pdr /dev .
    real     0m26.571s                  # insane !

I checked the source, looks like adding TCP_NODELAY on the client side fixes it:
  $ time fakeroot-tcp cp -pdr /dev .
    real     0m0.040s

-- System Information:
Ubuntu Release: focal
  APT prefers focal-updates
  APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 'focal'), 
(100, 'focal-backports')
Architecture: x32 (x86_64)
Foreign Architectures: x32, i386

Kernel: Linux 5.4.0-91-generic (SMP w/4 CPU cores)
Kernel taint flags: TAINT_WARN
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages fakeroot depends on:
ii  libc6        2.31-0ubuntu9.2
ii  libfakeroot  1.24-1

fakeroot recommends no packages.

fakeroot suggests no packages.

-- no debconf information
--- communicate.c.orig  2022-01-12 09:33:01.762682467 +0000
+++ communicate.c       2022-01-12 09:33:05.462629926 +0000
@@ -476,6 +476,10 @@
   if (fcntl(comm_sd, F_SETFD, FD_CLOEXEC) < 0)
     fail("fcntl(F_SETFD, FD_CLOEXEC)");
 
+  int val = 1;
+  if (setsockopt(comm_sd, SOL_TCP, TCP_NODELAY, &val, sizeof (val)) < 0)
+      fail("setsockopt(TCP_NODELAY)");
+
   while (1) {
     if (connect(comm_sd, get_addr(), sizeof (struct sockaddr_in)) < 0) {
       if (errno != EINTR)

Reply via email to