sumatrapdfreader / sumatrapdf

SumatraPDF reader
http://www.sumatrapdfreader.org
GNU General Public License v3.0
13.63k stars 1.73k forks source link

Fails to load a PDF file with long name when the PDF is in a long name directory as well! #1164

Open givemeatip opened 5 years ago

givemeatip commented 5 years ago

As the title says, Sumatra PDF is failing to load my PDF file with a long name when it is located in a folder with a long name path. Already tested with the latest prerelease version, which doesn't even show an error message like the latest stable version shows.

The long name path to the file here is: D:\Documentos Usuario\Documents\Cursos\Naturopatia Holística - Instituto Terceira Visão\Tópico 4 (Módulo Legislação e Direito nas Terapias Naturais e Holísticas) - virou tópico 4 após atualização

The file name is: Manual de implantação de serviços de práticas integrativas e complementares no SUS - 2018.pdf

Note: when I tried to upload the PDF file here Windows also gave me an error saying the path doesn't exist or something like that (my Windows is in Portuguese, the actual message is "O caminho não existe" among other things). So I did the same trick I'm doing to actually load the file in SumatraPDF, I copied it to a path with a shorter name ( D:\Documentos Usuario\Desktop ), and it uploaded successfully:

Manual de implantação de serviços de práticas integrativas e complementares no SUS - 2018.pdf

If this is a Windows bug, is there a way to fix it or report to Microsoft? I'm using latest stable Windows 10 with all updates applied.

kjk commented 5 years ago

How are you opening the PDF? File./ Open? Drag & drop? Double-clicking in explorer? From cmd-line?

GitHubRulesOK commented 5 years ago

Common behaviour in Acrobat and many other apps also sometimes fails to inform when the filename exceeds the standard 256 characters (including any server pathname prior to the drive designation) I think there are a couple of threads on this though MS may have recently added some support to exceed in certain cases (possibly using their own apps)

givemeatip commented 5 years ago

I'm opening the PDF by double-clicking in explorer, Sumatra PDF is the default program to open PDF files here.

GitHubRulesOK commented 5 years ago

what core format is drive D: if it does not have an MFT table then the drive cannot handle more than 260 characters including any spaces and punctuation. if the drive is portable then other windows machines may not be able to read or write files on that drive (beware corrupting drives between incompatible systems) Some key Microsoft products may still not allow file path names over 256 characters although robocopy was possibly an early user a couple of years ago 128/64bit apps built with 2020 compilers should probably be ok but beware compatibility with apps that traditionally work in current 32bit/64bit modes

givemeatip commented 5 years ago

What is core format? Drive D: here is a NTFS partition of the HDD of this notebook (Dell Inspiron 14R 5421) where my user profile (documents, images, videos, etc) seems to be located.

GitHubRulesOK commented 5 years ago

OK NTFS has newest Master File Table structure such that when using post anniversary Windows 10 can be extended to file names with over 65500 characters long (who needs files when just the name is more than enough storage for a novella or can hold personal usage data, beware and protect against golf code exploits) however it will take some time for all software to be changed to catch up with such drive tables.

givemeatip commented 5 years ago

OK NTFS has newest Master File Table structure such that when using post anniversary Windows 10 can be extended to file names with over 65500 characters long (who needs files when just the name is more than enough storage for a novella or can hold personal usage data, beware and protect against golf code exploits) however it will take some time for all software to be changed to catch up with such drive tables.

Alright. Will SumatraPDF get changed? I want to keep my folders and files with their long names and keep using SumatraPDF, but I'm getting tired of having to copy the files to another location in order to open them.

SumatraPeter commented 5 years ago

The silent failure bug involving paths longer than MAX_PATH seems to persist despite being pointed out last year. @kjk: Can you please look into this and see if an error can be thrown while opening/saving files in such situations, instead of Sumatra simply failing silently?

OK NTFS has newest Master File Table structure such that when using post anniversary Windows 10 can be extended to file names with over 65500 characters long

Actually the underlying default file system used by Windows since Win2K i.e. NTFS has always had the ability to handle a maximum total path length of approx. 32,767 characters so there's no newer MFT format required. It is the Windows API (and shell i.e. Explorer that uses the API) that imposes the MAX_PATH restriction which used to be defined as 260 characters. As Microsoft notes:

Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior.