2

My Firefox automatically shortens the names of the files I download. For example, 231546798_20110608.pdf becomes 2315.pdf.

I later realized that it may relate to the long name of the path into which I try to download the file. The path is ridiculously long:

/windows-d/academic discipline/study objects/areas/human aspects/social sciences/communication/ways of communication/way of spread, ie electronic media and communication/application/telephone communication/examples/cell phone/me/verizon/bill/

I then build a directory named hahaunder the above long path. Note that haha is exactly as long as the name of the shortened file name (extension pdf is excluded) . It turns out that Firefox doesn't download the file into directory haha, although I specify it to. But I can download the file to other directory with much shorter path name, and have no problem with copying the file into haha.

I wonder how to explain the strange behaviour of Firefox?

PS:

  • My OS is Ubuntu 10.10, and Firefox is 11.0.
  • The problem here is similar to my previous question, but there I asked about the OS, and here I talked about Firefox.
Tim
  • 101,790

1 Answers1

3

By /windows-d I assume this file system is either FAT32 or NTFS. If so, seems that you are hitting the maximum file name length of 255 characters.

But this sounds like a Firefox limit, testing with an external HDD formatted in NTFS I was able to successfully create very deep directories which exceeded the 255-char limit. (Probably Windows will give an error when try to access it, though).

Renan
  • 17,136
  • +1. Thanks! (1) It is NTFS, shared between Ubuntu and Windows on my same machine. (2) But I can still create arbitrary long directories under that long path, and copy the name-shorten file into it. Why is it now not subject to the limit of NTFS? (3) It seems to me it is the restriction of Firefox, not of Ubuntu, because of the same reason in (2), i.e. I can still create arbitrarily long directories under that long path. – Tim Apr 01 '12 at 00:27
  • 1
    I would be inclined to think it's a Firefox restriction, then.

    I tested here with an NTFS-formatted hard disk, and was able to create very long paths (probably Windows will give an error when trying to read them, but NTFS-3G doesn't care)

    – Renan Apr 01 '12 at 00:37
  • Does Ubuntu use NTFS-3G as driver to use NTFS file system created under Windows? – Tim Apr 01 '12 at 01:49
  • @Renan "(Probably Windows will give an error when try to access it, though)." It will, for sure. Because to my knowledge, though allowed in the specifications (4096 characters max.!), it's artificially limited in the Windows kernel so that you cannot exceed 250 (or 255) characters in path names. Microsoft once said this is to be compatible with old applications, but IMHO it's pointless: who'd still be using 10-year-old software on their Windows? – syntaxerror Sep 18 '13 at 03:10
  • found a great explanation also here http://www.xxcopy.com/xxtb_047.htm – syntaxerror Sep 18 '13 at 03:18
  • @syntaxerror Plenty of people do -- I wouldn't apply your use case to everyone's. Buffer overflows due to assumptions about filename size especially are not something to be sniffed at. Microsoft has (as usual) screwed this one up pretty badly though. – Chris Down Sep 18 '13 at 03:57
  • @Chris You can say that again. The MS version of Murphy's law: all that was possible to go wrong did go wrong. And it seems we will have to live with MAX_PATH = 260 (it's 260, now that I learned the actual value) until the year 2020. So 20th century; even their pesky Lets-Use-The-PC-Like-An-ATM approaches won't change much in that respect. – syntaxerror Sep 18 '13 at 04:04