CRLF / LF conversion, all over again

Andrew Bartlett abartlet at
Thu Feb 21 03:17:05 GMT 2002

Timothee Besset wrote:
> I am not familiar with the internals of a networked file system to tell.
> This is mostly an analysis from end user standpoint and sysadmin
> standpoint. A few remarks though:
> - file size? not a problem, if the client is win32 it is served with CRLF
> converted files from the unix server, and sees the correct size

So a client does a 'tell me the size of each file in this directory'. 
Do we then convert every file so that we can tell the client the correct
file length?

> - 5k at the end of 600Mb file .. text files are typically small. Odds are,
> if it's 600Mb, it's binary. (at least in my case I don't have text files
> that go above 100kb).

Odds are?  We don't play guessing games - thats the path to *nasty* file

> What do you mean by 'write a VFS module'? My understanding is that if the
> server does CRLF conversion, obviously it will have to cache the CRLF and
> LF versions, and synchronise when one of the clients changes something (as
> I said, I know nothing the precise problems in smbd).

so, you have a file open by both a unix and an windows process.  Both
are appending to a logfile.  How the heck are you going to keep them
both happy with smbd 'converting' the file underneath both their feet?   

But we are back to 'how should it tell' and the like.

If you are really keen, then you need to create a module for Samba's VFS
interface to implement this functionality - its not somthing the Samba
Team will consider.  (Its on the *will not do* list - we just DON'T mess
with the contents of files).

> The other solution I am looking at right now, is having two shared
> directories, one mounted by win32 clients, and one mounted by unix
> clients. They would be exactly the same for the binary files, and have
> appropriate CRLF or LF versions of the text files. Then plug some kind of
> daemon server side to always maintain the directories in sync (detect when
> a file is modified on one side and update his binary or LF / CRLF
> counterpart).
> It is not a very satisfactory solution, and while designing it I came to
> the conclusion that it would be better implemented at smbd level.

Use programs that understand Unix/DOS text formats.  Or run dos2unix and
unix2dos occasionally.  

Andrew Bartlett

Andrew Bartlett                                 abartlet at
Manager, Authentication Subsystems, Samba Team  abartlet at
Student Network Administrator, Hawker College   abartlet at

More information about the samba-technical mailing list