-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows UNC Paths Broken #5127
Comments
I'd be grateful if some who has access to a Windows box with network shares and understands Haskell could help me debug this. |
Can confirm the issue occurs on 2.3.1 as well. Interestingly if you use "Map Network Drive" to assign a drive letter to the path, and then use the drive letter instead of \\example-nas.org, it seems to work ok. |
Having recently installed haskell and stack in order to compile pandoc, I could try to lend a hand, although I'm far from really "understanding" Haskell. |
I'm not sure how to debug this, but the first version with this error is 2.3.1. I tested both that one and 2.3 and the latter one works:
Note that I tested both with forward and backward slashes and the result was the same (2.3 works, 2.3.1 doesn't) Could it be a ghc 8.6 issue? It seems the biggest change between those versions are in the build process. See: 2.3...jgm:2.3.1 |
I suppose you could try to build pandoc 2.3 with the older ghc, to see whether that's the case. To rule out that it's something wrong in the travis build server: you can reproduce this when you build pandoc from source on Windows, correct? |
My build setup is a bit cumbersome. At work I can only build pandoc inside a 32bit windows VM (I will do that and report back). I'll test it with a proper 64bit version at home tonight. I normally compile with |
Change the |
Ok, late~ish pandoc compiled as-is does not work (the UNC path problem) |
Hard to believe that it's ghc 8.6 that causes this -- but I agree, I don't see anything else in the changelog that seems relevant. To build with stack lts-11, you can try creating
|
Ok, I had to tweak a bit the skylighting dependencies but got it to compile (used version 0.7.5). Initially it also failed but with a different message:
It looked fishy so I tried with double-slashes on the command line:
and it worked! Note that previously I had also tried the double-slash and it still didn't work. |
Since in Windows the path separators in Haskell are
and it also works UPDATE: Interestingly enough, I can't seem to reproduce locally #4283 which was one of the causes for the change in the ghc version (might be because now I'm on windows 10? I'll test again tomorrow, it's too late now) UPDATE2: Tested the lts-11.17 version on my windows7 and |
@KeenRivals could you check this out? I got a tip by reading some documentation while
did not work, this one does:
I tested it with pandoc 2.5, could you try it on your end? Note that this is the case for calling pandoc from
So it seems that in the later versions of pandoc we need to add the |
Weird, I just compiled locally, with Just in case I downloaded today's build, and... it doesn't work. @jgm could we test a normal "stack build" from appveyor? Currently we have
This could still be related to ghc, my local I could try using lts-13.4 to see if ghc 8.6.3 exhibits the same issues... EDIT: Nope, compiling with stack locally with lts-13.4 (ghc 8.6.3) is not working with |
It looks like this was a conscious decision to remove MAX_PATH limitation from ghc. See here and here. I'm not sure if this means that what we are experiencing here is a direct result of this change (and we need to adapt in our command-lines), or if there is some kind of file-path management in pandoc that can get in the way of the new automations. |
OK, this is great to know! I still don't understand this change fully, but at least we know where to look. What does pandoc do with the paths? First, the raw command line args are obtained with One thought I had: try adding |
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application> Because it's opt-in, it's hard to see why it should be affecting us at all... |
That particular case is not affecting us. It only says that in Win10 xx you may configure it so that the old APIs don't have the MAX_PATH limitation (thus you wouldn't need the \? for long paths using old APIs)
So the arguments look ok in both cases. |
Testing with pandoc 2.5 and using the \?\UNC\ trick works. Windows 10 64-bit, 1809. Using 64-bit version of pandoc. |
I don't fully understand yet what is causing this
issue. Does anyone have a good analysis?
However, your discovery does suggest a "quick fix."
We could include some compile-time tests, and if we're
compiling with GHC 8.6+ on Windows, we could simply
convert paths starting with `\\` to `\\?UNC\`.
Perhaps Windows users can tell me what else would be
needed here.
|
I don't know if we could create a very simple minimum failing case in Haskell, compiled with stack, that reads a file passed as argument and spits it back. If we experience the same issue, we could open an issue in ghc and ask if the regression is intended or not. If we don't experience the same issue, we could review what is different in pandoc. |
I fired up Process Monitor and did a quick comparison of Pandoc 2.2.3.2 vs 2.5. One thing that jumped out to me is pandoc 2.5 is adding an extra \ to the UNC path. Given |
Quoting from ghc docs linked above:
OK, that explains why it works when you do
Does this explain why it adds the extra
So my question is whether pandoc should attempt to normalize the paths before using |
I'll try to test this out and report back. Not sure if the "UNC" part is necessary or not. Note, that the check would need to take into account paths that already are in the new format ( |
Ok, at least on my win10 box So if we want to "normalize" the paths on windows we need to check for paths I see that previosly (with ghc 8.4), we could also use |
When pandoc is compiled with ghc 8.6, Windows paths are treated differently, and paths beginning `\\server` no longer work. This commit rewrites such patsh to `\\?\UNC\server` which works. The change operates at the level of argument parsing, so it only affects the command line program. See #5127 and the discussion there.
Okay, I've pushed a preliminary change. It seems kludgy, but probably worth doing to keep 8.6- and 8.4-compiled pandoc from behaving too differently. It would not be hard to convert all forward slashes to backwards slashes in the Windows path normalization; should I add that too? |
Since |
OK, I'm considering this issue closed by the fix above. |
It looks like this issue is still not resolved. I can see that pandoc is trying to pre-pend the
|
I'll reopen. Unlike the original issue, this concerns the argument to |
Re-opening this, because the fix doesn't cover all the places where filenames can occur (e.g. not |
When running Pandoc 2.5 against a UNC path in Windows, I get a file not found error. The problem does not occur in Pandoc 2.2.3.2.
Here's a sample Pandoc 2.2.3.2 session, which works:
Here's Pandoc 2.5:
I'm running Windows 10 64-bit, 1809. Using 64-bit versions of pandoc, but I've had the same behavior on 32-bit versions. The problem also occurs if the cwd is inside the network folder. I was also able to recreate the issue on Pandoc 2.4. The target network shares I've had it happen on are a samba share and a Windows file server.
The text was updated successfully, but these errors were encountered: