From 2bb9e4889b8d222f2732dc4b1c304dae5665655f Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 12 May 2026 18:15:00 +0200 Subject: [PATCH] macOS: fix TypeError when _get_birthtime_ns gets called with an FD Crashed when trying to os.fsdecode(path) when path is an int. --- src/borg/platform/darwin.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/borg/platform/darwin.pyx b/src/borg/platform/darwin.pyx index 772ee0bee..c8d7e124d 100644 --- a/src/borg/platform/darwin.pyx +++ b/src/borg/platform/darwin.pyx @@ -190,13 +190,15 @@ def _get_birthtime_ns(path, follow_symlinks=False): cdef int result if isinstance(path, int): result = c_fstat(path, &stat_info) + if result != 0: + raise OSError(errno.errno, os.strerror(errno.errno), "" % path) else: if follow_symlinks: result = c_stat(path, &stat_info) else: result = c_lstat(path, &stat_info) - if result != 0: - raise OSError(errno.errno, os.strerror(errno.errno), os.fsdecode(path)) + if result != 0: + raise OSError(errno.errno, os.strerror(errno.errno), os.fsdecode(path)) return stat_info.st_birthtimespec.tv_sec * 1_000_000_000 + stat_info.st_birthtimespec.tv_nsec