[Piuparts-devel] [Git][debian/piuparts][ptmx] Create /dev/ptmx like debootstrap does (Closes: #911334)

Mathieu Parent gitlab at salsa.debian.org
Wed Oct 24 07:34:05 BST 2018


Mathieu Parent pushed to branch ptmx at Debian / piuparts


Commits:
d3bc89f4 by Mathieu Parent at 2018-10-24T06:33:45Z
Create /dev/ptmx like debootstrap does (Closes: #911334)

When using piuparts on a chroot without /dev/ptmx [noptmx],
scripts/pre_remove_50_find_bad_permissions fails with:

    ERROR: BAD PERMISSIONS
    crw-rw-rw-. 1 root root 5, 2 Oct 16 03:49 /dev/ptmx

In this case, piuparts does something like this:

    touch /dev/ptmx # if not exists
    mount -o bind /dev/pts/ptmx /dev/ptmx # if dev/ptmx was not a symlink

The kernel doc [devpts.txt] recommends instead:

    mknod /dev/ptmx c 5 2

And this is what debootstrap does [debootstrap].

After this change, piuparts will do:

    mknod /dev/ptmx c 5 2 # if not exists
    mount -o bind /dev/pts/ptmx /dev/ptmx # if dev/ptmx was not a symlink

The behavior of piuparts called after debootstrap will not change.
The only behavior changing is when dev/ptmx doesn't exist at all.

[noptmx]: This is the case when chroot comes from the debian:unstable Docker image
[devpts.txt]: https://www.kernel.org/doc/Documentation/filesystems/devpts.txt
[debootstrap] https://salsa.debian.org/installer-team/debootstrap/blob/6f3f6f8b76e2d1a24ddbf05f065439412c3b81a1/functions#L1263-1268, introduced by https://salsa.debian.org/installer-team/debootstrap/commit/c997b80c064c6c1d36ec69da1850722f795f43e4

- - - - -


2 changed files:

- debian/changelog
- piuparts.py


Changes:

=====================================
debian/changelog
=====================================
@@ -1,6 +1,11 @@
 piuparts (0.94) UNRELEASED; urgency=medium
 
-  * ...
+  [ Mathieu Parent ]
+  * Create /dev/ptmx like debootstrap does (Closes: #911334): When the chroot is
+    created from the Docker image debian:unstable, /dev/ptmx is missing.
+    Piuparts was creating it with touch then a bindmount to pts/ptmx which
+    leads scripts/pre_remove_50_find_bad_permissions to complain about
+    "BAD PERMISSIONS" on /dev/ptmx. Now created with mknod then a bindmount
 
  -- Holger Levsen <holger at debian.org>  Sun, 21 Oct 2018 14:03:22 +0200
 


=====================================
piuparts.py
=====================================
@@ -1757,8 +1757,7 @@ class Chroot:
         dev_ptmx_rel_path = self.relative("dev/ptmx")
         if not os.path.islink(dev_ptmx_rel_path):
             if not os.path.exists(dev_ptmx_rel_path):
-                with open(dev_ptmx_rel_path, 'w'):
-                    pass
+                os.mknod(dev_ptmx_rel_path, 0666 | stat.S_IFCHR, os.makedev(5, 2))
             self.mount(self.relative("dev/pts/ptmx"), "/dev/ptmx", opts="bind", no_mkdir=True)
         p = subprocess.Popen(["tty"], stdout=subprocess.PIPE)
         stdout, _ = p.communicate()



View it on GitLab: https://salsa.debian.org/debian/piuparts/commit/d3bc89f41531e1ce8d37fc82f70e5b2fa7290844

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/commit/d3bc89f41531e1ce8d37fc82f70e5b2fa7290844
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20181024/8d6c5e4f/attachment-0001.html>


More information about the Piuparts-devel mailing list