max filename length

Andy Bakun abakun at reac.com
Fri Jan 29 21:22:59 GMT 1999


I'm having some weird problems with filename lengths.  Here are the
symptoms:

- I can not rename a file from explorer to have more than 127 characters.
After typing in a filename, it prompts me with the "are you sure you want
to change the extension" dialog.  It gets truncated to 127 characters, and
doesn't have an extension.  The filename shows up from a UNIX shell having
only 127 characters. A simple tcpdump test shows that the entire filename,
more than 127 characters, is being sent (although I may be wrong on this,
since I'm not an experienced tcpdump user). Client is WinNT4 Workstation
SP4.

- In NOTEPAD.EXE, I can save a file with a name over 160 characters.  It
does not get truncated, and the explorer window shows it's full length,
including the extension.  It shows up in a UNIX shell with it's entire
length. Client is WinNT4 Workstation SP4.

- In MS WORD 97 (SR-2), I can enter a name greater than 127 characters, but
it gets truncated while saving it, and then, since word seems to stat the
file after saving it to see if it was saved successfully, it can't find it
because the name was truncated.  It shows up in a UNIX shell as 127
characters. Client is WinNT4 Workstation SP4.

- I can create a file from a UNIX shell that is larger than 127 characters
(of course). Note that I'm on RH5.1, Linux 2.0.35.  Filesystem type is
ext2.

- In MS WORD 97 (SR-2), I can save a file with a name greater than 127
characters on a FAT filesystem locally (C:).  Again, NT4W SP4.

I think we can assume that this isn't a problem on the UNIX side (I believe
ext2 supports filenames up to 255 characters).  It could be a problem with
samba, but that doesn't explain the creation of a longer name from
NOTEPAD.EXE. All of the above operations were done on the same share and in
the same directory.

I did find this in the samba 2.0.0 code:

smbd/trans2.c, line 1127:
      SIVAL(pdata,4,128); /* Max filename component length */

So on the surface, this seems to be a problem with Microsoft's more recent
offerings (WinNT4, Office97) (surprise!) interacting with samba.  Could it
be that Word and Explorer are querying the filesystem info, and then
setting some options that make samba end up truncating it.  This is my
guess, and can it be worked around?  I didn't see anything obvious in
smbd/reply.c:reply_open, but this may not have been the right place to
look.

Any ideas?  Is this a problem with Office/WinNT?  Anyone else heard of it
or seen a problem like this?

Andy.




More information about the samba mailing list