PR #24561 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24561
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24561.patch

On MSYS, this would otherwise try to make a relative path that cannot be 
traversed for lacking the leading /c/ part.


>From e290acfca96cf5dfc2ebf1d834ad510b8a3c8330 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Fri, 18 Sep 2026 22:35:51 +0200
Subject: [PATCH] compat/windows/mscl: don't make paths relative that only
 share a drive

On MSYS, this would otherwise try to make a relative path that cannot be
traversed for lacking the leading /c/ part.
---
 compat/windows/mscl.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/compat/windows/mscl.c b/compat/windows/mscl.c
index cc1ee7a15e..67c08d7f21 100644
--- a/compat/windows/mscl.c
+++ b/compat/windows/mscl.c
@@ -26,9 +26,10 @@
  *
  * Dependency paths are rewritten relative to the current directory, which
  * keeps the .d files independent of how the environment maps Windows drives
- * (MSYS, Cygwin and WSL all differ). Paths on a different drive or share are
- * kept absolute, in forward slash form. Spaces, '#' and '$' are escaped the
- * same way gcc escapes them in -MD output.
+ * (MSYS, Cygwin and WSL all differ). Paths on a different drive or share, or
+ * with nothing but the drive in common with the current directory, are kept
+ * absolute, in forward slash form. Spaces, '#' and '$' are escaped the same
+ * way gcc escapes them in -MD output.
  *
  * On a POSIX host driving a Windows compiler (cl.exe through WSL interop, for
  * example) the records carry Windows paths. Each distinct drive or share root
@@ -231,8 +232,8 @@ static char *make_relative(const char *path)
         if (!path[i] || !cwd[i] || !chr_eq(path[i], cwd[i]))
             break;
     }
-    /* nothing to name, or a different drive or share */
-    if (!found || !path[tail] || tail < root || root_len(cwd) != root)
+    /* nothing to name, different drive or share, or nothing in common except 
drive */
+    if (!found || !path[tail] || tail <= root || root_len(cwd) != root)
         return NULL;
 
     if (cwd[tail])
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to