Package: pbuilder
Version: 0.226.1
Severity: normal
Tags: patch

Dear Maintainer,

It seems /dev/ptmx has incorrect permissions in a pbuilder chroot:

# ls -l /dev/ptmx
lrwxrwxrwx 1 root root 8 Oct  4 06:43 /dev/ptmx -> pts/ptmx
# ls -l /dev/pts/ptmx
c--------- 1 root root 5, 2 Oct 24 14:46 /dev/pts/ptmx

Please compare to what's stated in
https://www.kernel.org/doc/Documentation/filesystems/devpts.txt

For comparison this is from my regular system:
$ ls -l /dev/ptmx /dev/pts/ptmx
crw-rw-rw- 1 root tty  5, 2 okt 24 17:03 /dev/ptmx
c--------- 1 root root 5, 2 okt 11 12:35 /dev/pts/ptmx

I've hacked up my pbuilder installation and confirmed that appending
",ptmxmode=0666" to the /dev/pts mount flags fixes the issue.

This issue was detected while building the util-linux package where
the testsuite now has started to fail (specifically the
tests/ts/script/buffering-race test, since 'script' uses openpty).

See attached patch.

Regards,
Andreas Henriksson


-- System Information:
Debian Release: stretch/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-rc8-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages pbuilder depends on:
ii  debconf [debconf-2.0]  1.5.59
ii  debootstrap            1.0.84
ii  dpkg-dev               1.18.10
ii  wget                   1.18-4

Versions of packages pbuilder recommends:
ii  devscripts  2.16.8
ii  eatmydata   105-5
ii  fakeroot    1.21-2
ii  iproute2    4.6.0-4
ii  sudo        1.8.17p1-2

Versions of packages pbuilder suggests:
ii  cowdancer   0.81
ii  gdebi-core  0.9.5.7

-- debconf information excluded
>From 709484ea7166cf232070bfeff8a3c42840036f44 Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andr...@fatal.se>
Date: Mon, 24 Oct 2016 17:13:22 +0200
Subject: [PATCH] pbuilder-modules: Fix permissions of /dev/ptmx

/dev/ptmx is a symlink to /dev/pts/ptmx and according to
https://www.kernel.org/doc/Documentation/filesystems/devpts.txt
we then need to use the mount flag (or chmod) to have proper
permissions.

Without this a call to openpty() will fail. For example as used
by the 'script' utility executed in util-linux testsuite.
---
 pbuilder-modules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index e6a9e08..ec96dcc 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -372,7 +372,7 @@ function mountproc () {
         TTYGRP=5
         TTYMODE=620
         [ -f /etc/default/devpts ] && . /etc/default/devpts
-        mount -t devpts none "$BUILDPLACE/dev/pts" -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
+        mount -t devpts none "$BUILDPLACE/dev/pts" -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE,ptmxmode=0666
         mounted[${#mounted[@]}]="$BUILDPLACE/dev/pts"
     fi
     if [ -n "$SELINUX" ]; then
-- 
2.9.3

Reply via email to