Skip to content
Commit a99ecade authored by Mathieu Parent's avatar Mathieu Parent Committed by Mathieu Parent
Browse files

p: use mknod instead of touch to create missing /dev/ptmx mountpoint (Closes: #911334)

Working around findutils bug #912180:

    mkdir foo
    mknod foo/null c 1 3
    touch foo/bindmntoverfile
    mount --bind foo/null foo/bindmntoverfile
    find foo -type f -ls
    3857271640      0 crw-r--r--   1 root     root       1,   3 Oct 24 07:50 foo/bindmntoverfile

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 installer-team/debootstrap@c997b80c
parent 22a001c9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment