Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×

Linux/Mac/Windows File Name Friction 638

lessthan0 writes "In 1995, Microsoft added long file name support to Windows, allowing more descriptive names than the limited 8.3 DOS format. Mac users scoffed, having had long file names for a decade and because Windows still stored a DOS file name in the background. Linux was born with long file name support four years before it showed up in Windows. Today, long file names are well supported by all three operating systems though key differences remain. "
This discussion has been archived. No new comments can be posted.

Linux/Mac/Windows File Name Friction

Comments Filter:
  • File servers! (Score:5, Informative)

    by WPIDalamar ( 122110 ) on Monday July 10, 2006 @09:57AM (#15690728) Homepage
    Too bad the article didn't mention what happens when you copy long filenames over the network. All kinds of crazy things happen in all kinds of client/server combinations.

    Try copying a 40 character file from a windows server to a OSX client. What happens? Well... it depends if you used appletalk or SMB to connect with.

    What about OSX server -> a windows client... depends on the version of windows AND OSX of course.

    I've had nightmares.

    Wanna be safe most of the time:
    1) No spaces
    2) Under 32 character filenames
    3) Alphanumeric, underscore, period, or hyphen ONLY
    4) Only a single period allowed.
  • Re:Ouch (Score:4, Informative)

    by chrismcdirty ( 677039 ) on Monday July 10, 2006 @09:59AM (#15690747) Homepage
    Did you somehow miss the link? It basically said to remove files with a preceding '-' (-filename) you do 'rm -- -filename' or 'rm ./-filename'. And to remove a file with unprintable characters try 'rm file?with?unprintable?characters'.
  • by Anonymous Coward on Monday July 10, 2006 @10:02AM (#15690772)
    Those filenames are longer than the 31 character limit on Mac OS systems. You're lying.
  • by NutscrapeSucks ( 446616 ) on Monday July 10, 2006 @10:03AM (#15690783)
    MacOS was limited to 31 character names, so you're misremembering things.
  • Re:I RTFA (Score:2, Informative)

    by Anonymous Coward on Monday July 10, 2006 @10:04AM (#15690790)
    err... no.

    linux et,al. == case sensitive
    windows == case insensitive
    OSX == case preserving

    Try to keep up.
  • by 1u3hr ( 530656 ) on Monday July 10, 2006 @10:05AM (#15690804)
    the requirement the ".3" portion be satisfied, i.e., if you didn't give a ".3" extension, it wasn't valid.
    the semantic mapping of the extension to filetype, WTF? the implied (don't remember if it was canonical) semantic that no ".3" extension meant the file was a directory
    Not true. I used names with no extension for my Wordstar files back in DOS days. Since that's what most of my files were, I made that the simplest. Directories usually had no extension, but you could have if you wanted (some programs did that for their private data).

    Winows 9x and above though do enforce rules on extensions; but worst of all, hide some, or all, of them by default. Thus Anna-Kournikova.jpg.exe. The old Mac OS had it right, the filetype flags were not user-created or normally visible, though you could get tools to hack them if you wanted.

  • by JanneM ( 7445 ) on Monday July 10, 2006 @10:10AM (#15690844) Homepage
    As a quick tip, "rm -- filename" would have worked; it makes rm not parse the filename in any way whatsoever.
  • by Bogtha ( 906264 ) on Monday July 10, 2006 @10:11AM (#15690845)

    I think the biggest problem I had one day was when I was trying to remove a file in Linux who's first character was -

    That is what the -- option is for. It signifies that there will be no further options, so anything following it that starts with '-' will be interpreted as a filename. rm -- -funny-named-file will do the trick.

  • Re:I RTFA (Score:3, Informative)

    by mrchaotica ( 681592 ) * on Monday July 10, 2006 @10:12AM (#15690851)

    OS X is not case sensitive by default. It is case preserving, meaning that "Foo.txt" will still be "Foo.txt" when you move it or whatever (unlike in Windows, where it could turn into "FOO.TXT", but both names are still exactly the same file. Beware of this when copying files from a Linux (or otherwise case sensitive) filesystem to a Mac!

    Now, OS X does have the option to use case sensitive HFS+ (or UFS, for that matter), but last I heard either is likely to cause problems if you try to use it as the root volume (i.e. the one the OS is installed on).

  • by vadim_t ( 324782 ) on Monday July 10, 2006 @10:12AM (#15690852) Homepage
    I refer you to the file(1) command:
    vadim@gadget ~/src/ac/src/viewer $ file *
    Makefile.am: ASCII make commands text
    image_list.c: ASCII C program text
    image_list.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
    images.c: ASCII English text
    images.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
    mapview.c: ASCII English text
    mapview.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
    serverconn.c: ASCII C program text
    serverconn.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
    viewer.c: ASCII English text
    viewer.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
    As for case sensitivity, it's a seriously thorny issue due to some languages that have lossy upper/lower case conversion.
  • Re:Tagging (Score:3, Informative)

    by pla ( 258480 ) on Monday July 10, 2006 @10:17AM (#15690887) Journal
    File names aside, is there a good way to "tag" files (generic metadata) on Windows or Linux?

    On NTFS, you can use ADS (Alternate Data Streams) to store metadata about a file, though I don't know of any software that can read such data in a consistant manner - Not to mention, just about every malware scanner out there will flag such files as suspicious.

    On Linux, it very much depends on the FS you choose, though again, support for file metadata remains about as standardized as snowflakes.
  • by Anonymous Coward on Monday July 10, 2006 @10:23AM (#15690928)

    IIRC the "--" is not an command specific feature, but is a feature of the bash shell (and probably others).

    No, it is a feature of getopt(3).

  • Where's the !? (Score:3, Informative)

    by Rurik ( 113882 ) on Monday July 10, 2006 @10:23AM (#15690929)
    They have a whole block on "Avoid using these characaters for maximum portability".

    But, where's the exclamation mark? TONS of Windows people (including me) use exclamation points as the first character to put files/directories to the top of the list. Linux constantly chokes on these characters. But, no mention of it at all in this article.
  • Re:I RTFA (Score:5, Informative)

    by kimvette ( 919543 ) on Monday July 10, 2006 @10:23AM (#15690940) Homepage Journal
    Actually all three can be case sensitive.

    Linux always is, by default (I don't know if you can make it otherwise without a LOT of hacking).

    Windows: it is case "retentive" by default (it remembers cases as typed) but not case sensitive. It (full case sensitivity) can be enabled through a registry hack or two, or by selecting the "enable case sensitivity" option when installing SFU, at the cost of possibly breaking backwards compatibility with many applications.

    Mac: OS 9 (and earlier) were case retentive only. OS X is case retentive (no sensitive) by default, however, if you install on a UFS filesystem it will become case sensitive, and just as with Windows, possibly breaking backwards compatibility with many applications.
  • by Anonymous Coward on Monday July 10, 2006 @10:24AM (#15690941)
    Not so. It goes to the first created file. So if you create microsauer, then microsoft, but delete microsauer later, microsoft will stay as Micros~2
  • by mrchaotica ( 681592 ) * on Monday July 10, 2006 @10:28AM (#15690972)
    On windows, well behaved programs go in the aptly named "Program Files"

    No, they go in "C:\Program Files" and the Registry and one or more users' "C:\Documents and Settings\%USERNAME%\Application Data" folder.

    on OSX they go in "Applications"

    No, they go in "/Applications" and "/Library" and one or more users' "~/Library". Also, by the way, OS X does have /bin and /usr/bin and all the other UNIX standard folders; they're just hidden from the finder.

    on linux they go in /usr/bin or is it /bin or is it /local/bin or /wtf

    No, on Linux they go in "/usr/local/bin" and "/usr/local/etc" and one or more users' "~" only, because "/bin" and "/usr/bin" are reserved for bits of the OS itself (equivalent to "C:\Windows" and "/System").

  • Re:Where's the !? (Score:3, Informative)

    by vadim_t ( 324782 ) on Monday July 10, 2006 @10:28AM (#15690980) Homepage
    You just escape it with a \, like this:
    vadim@gadget ~/tmp $ touch \!hi
    vadim@gadget ~/tmp $ ls
    !hi
    vadim@gadget ~/tmp $ rm \!hi
  • Press TAB again (Score:5, Informative)

    by ggeens ( 53767 ) <ggeens AT iggyland DOT com> on Monday July 10, 2006 @10:31AM (#15691000) Homepage Journal

    cmd.exe's completion is a bit strange if you're used to bash, but once you get to know it, you can get around quite well.

    Example:

    • cd c:\pr TAB -> cd "c:\Program Files"
    • Another TAB -> cd c:\projects
    • "\foo" + TAB -> cd "c:\projects\foo bar"
    • "\s" + TAB -> cd "c:\projects\foo bar\src"

    Before Windows XP, you had to activate the tab character by changing a registry key. XP has this set by default.

  • Re:Where's the !? (Score:3, Informative)

    by mrsbrisby ( 60242 ) on Monday July 10, 2006 @10:34AM (#15691020) Homepage
    But, where's the exclamation mark? TONS of Windows people (including me) use exclamation points as the first character to put files/directories to the top of the list. Linux constantly chokes on these characters. But, no mention of it at all in this article.

    No it doesn't. Linux (like most UNIXes) have no problem with exclamation marks. In fact, the only characters specifically disallowed are NUL (for C compatability) and /

    Your shell however, assigns a special meaning to the "!" character, and that special meaning can be removed by prefacing it with a backslash, i.e. "!" -> "\!" -- Linux and the filesystem and all the relevant system calls still use the "!" character itself in the name of the file.
  • by Xtifr ( 1323 ) on Monday July 10, 2006 @10:39AM (#15691044) Homepage
    > the requirement the ".3" portion be satisfied, i.e., if you didn't give a ".3" extension, it wasn't valid.

    Your memory is faulty here--that is not true; not even slightly.

    > the semantic mapping of the extension to filetype, WTF?

    Long predated MS. Found even in UNIX before MS existed. And still widely used even on UNIX/Linux/BSD. The big flaw that DOS had here (IMO) was making the extension determine whether a file was executable. Having an executable flag is a much better solution. But the approach that DOS took was widely used in other OSes at the time.

    > the case insensitive nature of file names

    There are plenty of arguments on both sides of this one. I'm more used to/more comfortable with/prefer case-sensitive filenames, but I can't bring myself to claim that one option is better than the other.

    I thought VFAT was actually a fairly clever solution to the problem of providing backwards compatibility with the horrors of 8.3, and MS really had no choice but to provide backwards compatibility. I have a lot of complaints with the things MS has done over the years, but I actually kind of admire VFAT.

    > defaults to hide extensions

    This, on the other hand, is one of the biggest mistakes that MS ever made! Someone should have lost their job over this idiocy!

    As a side note, I have to agree with everyone who says that the original article is terrible. The list of characters to avoid for portability is missing several, and the article completely overlooks one of the biggest and most headache-inducing issues--i18n and character encodings. This is one area where UNIX/Linux's ultra-flexibility actually gets it in trouble, since you can have file names with different encodings in the same directory. I actually had a mix of latin1 and utf8 filenames in my home directory for a while, and NOTHING would display them all correctly. And I bet it's even worse if you mix-and-match various CJK encodings. Windows, I'm told, forces everything to utf16, which would not have been my first choice, but at least it's consistent.
  • by Compholio ( 770966 ) on Monday July 10, 2006 @10:44AM (#15691085)
    I mostly use a GUI, so it doesn't stress me out too much, but makes it much easier to find them two years later.

    Many shells now support the use of the "Tab" key to expand a filename (and list filenames that match what you have typed in so far). Also, if your music player is an iPod then you can format it with HPFS and lose that FAT restrictions - though, I believe the iPod actually just mangles the filename and uses the ID tags.
  • by m50d ( 797211 ) on Monday July 10, 2006 @11:20AM (#15691363) Homepage Journal
    Dos 1.0 had no directories, and arbitrarily used / for options (remember DIR /P ?). When 2.0 came out, to preserve backwards compatibility they kept / for options, so decided on \ as the directory separator. Modern dos/windows can handle / for directories fine, but they need to still support \ for - you guessed it - backwards compatibility.
  • by 99BottlesOfBeerInMyF ( 813746 ) on Monday July 10, 2006 @11:20AM (#15691370)

    Is this anything other than an attempt to dis Windows for no other reason than 'Because'?

    I think it is a valid issue. There are some files in a CVS module I simply cannot use on Windows because the filesystem chokes when CVS tries to write them in Windows and the rest of the CVS commit is aborted. It is a huge pain in the ass, even though these files do not contain any capital letters. This happens with ever CVS client on Windows, even Cygwin. MS needs to get off their butts and fix this crap once and for all.

  • by creepynut ( 933825 ) <teddy(slashdot)&teddybrown,ca> on Monday July 10, 2006 @11:47AM (#15691551) Homepage
    Or more simply put: Once a folder is created as PROGRA~1, it stays PROGRA~1. It doesn't cycle.

    The number is incremented in the order the folders are created, not alphabetically.

    Though, I recall on at least one occasion some sort of massive registry failure, requiring that I reinstall Windows 95. From then on, my Program Files folder was known as PROGRA~2.
  • by Tackhead ( 54550 ) on Monday July 10, 2006 @12:26PM (#15691836)
    > Of course you meant "You = totalpu.ssy" or "You = total~1".

    Nope. File metadata in extension. File description in name. Keep 'em separate!

    TOTPUSSY.YOU or TOTALPUS.YOU

    And now you can burn it to an ISO 9660 CD-R and be sure of getting the right filename, every time, even on ancient versions of SunOS/Solaris that refused to read Joliet! (Time heals all wounds. Slashdot threads on cross-platform file naming conventions reopen them.)

  • by TheGreek ( 2403 ) on Monday July 10, 2006 @12:28PM (#15691855)
    Technically incorrect: Mac filenames could be 255 chars, but at some revision of Finder (forget which), they limited things to 31 characters as a practical limit. The underlying system remained capable.
    HFS was limited to 31 characters.

    HFS+, introduced in Mac OS 8.1, allows filenames of up to 255 characters, but Classic Mac OS never, for all intents and purposes, supported it.

    If you're going to try to correct people, you should probably make sure you're correct yourself so you don't end up looking like an ass.
  • by 1u3hr ( 530656 ) on Monday July 10, 2006 @12:58PM (#15692087)
    Not quite. I still remember the pain of trying to use standard formats like JPEG across multiple applications back in the system 6/7 days.

    Mac OS had a separate file type, and file creator, code. So apps could share filetypes, but have distinct creators. But egomaniacal programmers often made their apps change the codes. That's when you needed things like FileTyper.

  • by Anonymous Coward on Monday July 10, 2006 @01:04PM (#15692134)
    If extensions aren't part of filenames, then you have the same problem as hidden extensions: You can have a file with the name "Hello" which is an executable but tricks users by using a jpg icon for the application.
  • by bmajik ( 96670 ) <matt@mattevans.org> on Monday July 10, 2006 @01:11PM (#15692187) Homepage Journal
    The actual maximum length depends on your definition of "maximum", unfortuneately.

    PATH_MAX is supposed to be defined as the length of any single path segment. NT "the OS", and NTFS "the filesystem", support completely qualified path concatenations that are like 32k or so long.

    You can, using CMD.EXE, create a directory 250ish chars long. Then you can go into that directory, and create child dirs with a similar length, and so on, for quite a while.

    Now, what happens when you try and access that file you made?

    It depends entirely on the appplication.

    In XP and earlier, explorer.exe got pretty confused around 4096 chars. When you were viewing a DFS redirected share, explorer got confused even earlier.

    in CLR 1.0, if you have relative directory traversal, you can access paths which are longer than 255 chars, but any of the "open by path" routines cap it at 255 chars (including filename!). I filed a bug on this that the CLR guys said "won't fix - we just do what Win32 does". (gosh guys, i thought .NET was going to free us all from Win32. Guess not.)

    So, the NT native APIs support enormous paths, NTFS supports them, but depending on which libraries your application uses, you probably can't do much better than 250 chars total - path _and_ filename.

    Alot of what makes Microsoft "good" is its commitment to backwards compatibility. And a lot of what makes Microsoft so lousy is it's commitment to backwards compatability :/

  • by Anonymous Coward on Monday July 10, 2006 @01:14PM (#15692204)
    The Joliet filename length limit is somewhat below 120 characters because the record it is stored in cannot exceed 255 bytes. The record includes the starting extent and the file size in big and little endian format, and the name is stored in Unicode.
  • Re:Press TAB again (Score:3, Informative)

    by glesga_kiss ( 596639 ) on Monday July 10, 2006 @01:19PM (#15692236)
    Before Windows XP, you had to activate the tab character by changing a registry key.

    Forget hacking the Registry, TweakUI can do this. It's an essential tool for Windows that would cause too much damage by lusers so they don't ship it out-the-box. Lot's of useful hacks.

  • I'm sorry but... (Score:5, Informative)

    by Ayanami Rei ( 621112 ) * <rayanami AT gmail DOT com> on Monday July 10, 2006 @06:13PM (#15694247) Journal
    ...you suck at scripting.

    Typical shell scripting idioms like:

    for $each in *glob.pattern* ; do
        command "$each"
        mv "$each" "$(echo \"$each\" | sed -e s/stuff/replace)" ...
    done

    The only extra quoting necessary is in commands with variable substitution. And (while it may seem confusing), that syntax works even when the filenames have quotes internally. The double quotes identifies the contents to be treated as a single token with interpolation to be performed before passing on to ``command'', which is what you wanted.

    Also the $() syntax is your friend. But remember to give it ""s too, you don't want it to expand it AND THEN tokenize it.

  • Re:File servers! (Score:3, Informative)

    by Gnavpot ( 708731 ) on Monday July 10, 2006 @07:05PM (#15694519)
    Windows do not like having a space at the begining or double spaces (I think ...).
    Spaces in the middle of a file name can also be frustrating in Windows, even with pure MS programs.

    Example:
    If I want to point someone on the corporate network to a huge file which resides on a network drive we can both access, I can just send a mail with this text:
    file://K:\somedirectory\somefile.iso
    Both Outlook and Thunderbird will create a link to the file when showing this mail.

    However, this will not work in Thunderbird nor Outlook:
    file://K:\some directory\somefile.iso
    This will not work in Thunderbird nor Outlook:
    "file://K:\some directory\somefile.iso"
    file://"K:\some directory\somefile.iso"
    file://K:\"some directory"\somefile.iso
    This will work in Thunderbird, but not Outlook:
    file://K:\some%20directory\somefile.iso
    Disclaimer: My Outlook testing was done in Outlook 2000 and 2002/XP. Outlook 2003 may be different.
  • Re:I'm sorry but... (Score:4, Informative)

    by strider44 ( 650833 ) on Monday July 10, 2006 @11:25PM (#15695691)
    rename "s/stuff/replace/" *
    is much easier I think.

What is research but a blind date with knowledge? -- Will Harvey

Working...