From: Greg Troxel Date: Wed, 5 Jun 2019 20:55:32 +0000 (-0400) Subject: restore: create fifos with mkfifo, not mknod X-Git-Tag: 0.30~23 X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=6c6b3832cdf6f9b2196c4b264e18c5c410448b5e restore: create fifos with mkfifo, not mknod I recently did a restore of a large bup backup, about 34G worth. All worked well, including metadata, except that bup threw an exception on restoring fifos (that I didn't need; they were in /var and were sockets in use by daemons when the backup happened). The problem was that mknod was being called for the fifo, and given only two argumetns. mknod(2) on NetBSD says it takes three arguments. mkfifo takes two. I am guessing that mknod in python calls mknod the OS call, and on Linux somehow the third null argument works out somehow. But it seems irregular to make a fifo with mknod. I realize python is not POSIX, but mknod(2) requires three arguments: http://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html It would be nice to have a test of backing up and restoring a fifo; that would have caught this. The following patch makes my restore go smoothly. Signed-off-by: Greg Troxel [rlb@defaultvalue.org: adjust commit summary] Reviewed-by: Rob Browning Tested-by: Rob Browning --- diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py index e092380..2f3ee06 100644 --- a/lib/bup/metadata.py +++ b/lib/bup/metadata.py @@ -357,7 +357,7 @@ class Metadata: os.mknod(path, 0o600 | stat.S_IFBLK, self.rdev) elif stat.S_ISFIFO(self.mode): assert(self._recognized_file_type()) - os.mknod(path, 0o600 | stat.S_IFIFO) + os.mkfifo(path, 0o600 | stat.S_IFIFO) elif stat.S_ISSOCK(self.mode): try: os.mknod(path, 0o600 | stat.S_IFSOCK)