[Piuparts-devel] [Git][debian/piuparts][develop] 2 commits: Handle situations where /dev/tty exists but is not connected

Nicolas Dandrimont (@olasd) gitlab at salsa.debian.org
Fri Nov 15 10:36:15 GMT 2024



Nicolas Dandrimont pushed to branch develop at Debian / piuparts


Commits:
ec5e7f09 by Nicolas Dandrimont at 2024-11-15T11:34:12+01:00
Handle situations where /dev/tty exists but is not connected

Situations can arise where /dev/tty is a valid device, but opening it
raises:

OSError: [Errno 6] No such device or address: '/var/lib/docker/overlay2/.../merged/dev/tty'

In that situation, the device is valid and it's safe to ignore the error.

- - - - -
9d05d02e by Nicolas Dandrimont at 2024-11-15T11:35:46+01:00
Don't crash when requesting chroot removal before it's initialized

- - - - -


1 changed file:

- piuparts.py


Changes:

=====================================
piuparts.py
=====================================
@@ -845,6 +845,9 @@ class Chroot:
 
     def remove(self):
         """Remove a chroot and all its contents."""
+        if not self.name:
+            return
+
         if not settings.keep_env and os.path.exists(self.name):
             self.terminate_running_processes()
             self.unmount_all()
@@ -1251,6 +1254,12 @@ class Chroot:
                 except PermissionError:
                     # Could not open the device, the filesystem is probably nodev.
                     isdevice = False
+                except OSError as e:
+                    if e.errno == 6:
+                        # Sometimes /dev/tty exists but is not connected. This is still a valid device.
+                        pass
+                    else:
+                        raise
             if not isdevice:
                 self.mount(devname, devname, opts=["bind"])
 



View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/36671787aaec637a1abc25ed61626cfa8ce52d07...9d05d02ee209fa190bcdee5b270da1d7140b5b3e

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/36671787aaec637a1abc25ed61626cfa8ce52d07...9d05d02ee209fa190bcdee5b270da1d7140b5b3e
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/20241115/bd4b2c93/attachment-0001.htm>


More information about the Piuparts-devel mailing list