Operating System - HP-UX
1823753 Members
4009 Online
109664 Solutions
New Discussion юеВ

Samba/CIFS Line Feed (^M) Issue

 
Amir Haboosheh
Frequent Advisor

Samba/CIFS Line Feed (^M) Issue

ok, i know this is a known thing and i looked all over ITRC for help but the latest solution is still dos2unix. is there a way with the current version of samba to convert the line feed windows creates within samba?

i have a hard time believing that SCO's VisionFS can handle it but HPUX with Samba cannot. so please any help on this will be greatlly appreciated.

thanks,
amir
6 REPLIES 6
Heironimus
Honored Contributor

Re: Samba/CIFS Line Feed (^M) Issue

The job of a network filesystem is to store what the client writes and return what's stored when the client reads. If you're going to manipulate file contents then you suddenly need to care very, very deeply about what kind of file you have. Windows doesn't have any real mechanism to record that information. There isn't any metadata saying "this is a text file" or "this isn't a text file" or "this is a text file but don't change it".

SCO's way is inherently wrong, just like ASCII mode in FTP is wrong. You don't usually see it in newer protocols because people realized that it was a mistake after many years of repeatedly explaining that files are corrupted because somebody used the wrong mode.
Steven E. Protter
Exalted Contributor

Re: Samba/CIFS Line Feed (^M) Issue

Shalom,

This is a problem with the smb.conf file nothing more.

Post the file, and myself or others will try and provide you with a fix.

I will leave the SCO remarks to others.

:-)

SEP

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Amir Haboosheh
Frequent Advisor

Re: Samba/CIFS Line Feed (^M) Issue

thanks steven,

here is the content of the file.

# Samba config file created using SWAT
# from 10.0.20.5 (10.0.20.5)
# Date: 2008/08/06 19:04:11

[global]
workgroup = SAMBA
server string = Samba Server
security = SHARE
null passwords = Yes
password server =
log file = /var/opt/samba/log.%m
max log size = 1000
local master = No
wins server = 10.0.20.7
read only = No
short preserve case = No
dos filetime resolution = Yes

[homes]
comment = Home Directories
browseable = No

[tmp]
comment = Temporary file space
path = /tmp

[test]
path = /test
force user = root
force group = sys
create mask = 0777
force create mode = 0777
directory mask = 0777
guest ok = Yes

amir
Bill Hassell
Honored Contributor

Re: Samba/CIFS Line Feed (^M) Issue

This is not a SAMBA/CIFS problem. You are trying to jam fit two completely different filesystems together. PCs require that every line in an ASCII file be terminated with two characters: CR and LF, while Unix uses just the LF character. SAMBA is accessing the filesystem at the record level and presents the contents exactly as stored on the disk. You DO NOT want anything else. The reason is that if you change the SAMBA code to convert records, where do you do the conversion? There are many ways to access data in a file. And what if the file is a binary data file full of measurements? The file will be completely corrupted if you convert LF to CR/LF or vice versa, exactly what would happen if you used ux2dos.

If you look at a mainframe filesystem, it is 100 times worse. Some files have no separator but are fixed record lengths defined in a file control record. Other formats put a binary character with the length in front and behind every record. And on and on the list goes.

What you are asking a a very special case of looking at certain files (mainly ASCII) and trying to make two operating systems make sense out of each other's code. As far as VisionFS, from the manual, the conversion seems to be limited to print options and not an actual conversion of records as read or written. I may have missed something though...


Bill Hassell, sysadmin
Amir Haboosheh
Frequent Advisor

Re: Samba/CIFS Line Feed (^M) Issue

hey bill,

i understand what i am asking is not normal to the usual use of samba. but we use unix just for an accounting software (MAS90) and import and export text files to and from windows for EDI use only. no other type of file is being shared. just text or csv. so i don't care about any file corruption.

under visionfs if you go to the properties of the share and select the "files" tab and then click on the "Line Endings" button you can choose what "type" of files you want it to convert back and forth. it can even be * or *.* but it does give you that option.

i attached a screenshot from vision.

any help would be appreciated.

thanks,
amir

eric roseme
Respected Contributor

Re: Samba/CIFS Line Feed (^M) Issue

Hi Amir,

No - Samba does not provide an automated utility to do this. I cannot imagine a scenario where the Samba developers would implement such a feature (which could never look like the SCO screen shot that you supplied).

Just for fun, I used our CIFS client to mount a W2003 directory and then looked around for ways to configure for a converted file - it would make more since for the UNIX client to convert it than the server. But our (UNIX) client does not do it either.

You can Google "samba line feed" and find many ways to manually edit the file/characters (sorry to state the obvious).

Regarding VisionFS - which I confess to know nothing about - from your screen shot (if it is from a Windows client) it would appear that SCO supplies some sort of hook on the client to export a bunch of non-Windows file attributes. Our HP CIFS Server allows a Windows client to manage POSIX ACLs on the Samba share, but only by using the standard Windows management utilities and attributes.

I remember being asked about this in 1993 for LMX on HP-UX. Surprisingly, I do not think I have heard about it since then. Sorry to not provide you with what you are looking for.

Eric Roseme
Hewlett-Packard