Unix/NT file conversion problems

Benjamin Scott bscott at hamptonsys.com
Wed Nov 25 21:49:11 GMT 1998

On Wed, 25 Nov 1998, Gray, Sue wrote:
> We are having some problems - the majority of our files require ascii
> transfers between our unix servers and PCs. They are however being
> transferred as binary for some reason even though they are just plain
> text files.

  The reason is simple: There is no way for a computer to tell a text file
from a binary file.  It can make a guess, based on content or filename, but it
cannot tell for sure.  If it guesses wrong and does end-of-line translation on
a binary file (an executable, for example), the results would be catastrophic.

  Also, the SMB protocol has no way (that I know of) to tell the server what
end-of-line sequence it wants.  A UNIX SMB client, a Windows SMB client, and a
Mac SMB client all want different things.  Which one should the server do?

  This is why FTP has a "binary" mode and an "ascii" mode.

> Anyone have any ideas?

  There are utilities for almost any platform to convert text files between
the three popular end-of-line styles (CR, LF, and CR+LF).

  Some text editors auto-detect the end-of-line sequence in use and adjust
accordingly.  They can do this because a text editor is always editing text.

  It is theoretically possible to write code that would have Samba scan file
names, look for a ".TXT" extension, and do end-of-line translation for you.
However, this would cause a large performance hit, and unreliable for the
reasons I described above.

  This is really the job of the client, anyway.  Ask Microsoft to add it to
the Windows SMB client.  :-)

Benjamin Scott <bscott at hamptonsys.com>          Phone: (603)431-7315
Hampton Systems Group, Inc.                     Fax  : (603)431-0822
http://www.hamptonsys.com                       DSN  : 852-3581

More information about the samba mailing list