Is there any solution in Samba for the following text file differences among Unix and Dos/Win. My user creates a text (flat file) on his windows box via Notepad. Naturally there is "\r\n" at then end of each line. User then moves this file to a Unix box (via Drive Mapping, drag-and-drop). User then logins to the unix box via telnet and run the text file which is a script. Now... While Samba has considered all sorts of issues with File Names and Attributes (or modes) and provides mappings or conversion between the two systems, I don't seem to find any feature that converts a Text file from one system to another. Recall FTP does this in ASCII mode. Using FTP as a references, Samba seems to move things around in Binary mode. Questions: - Is there any configuration switch to enable this. - If not, is it possible to hack a solution, say a magic filter. - What if I use a Printer like resource and then send the file thru a home grown filter Thanks ------------------------------------------------------------------------- Medi Montaseri medi@CyberShell.com Unix Distributed Systems Engineer HTTP://www.CyberShell.com CyberShell Engineering -------------------------------------------------------------------------
Medi Montaseri:> My user creates a text (flat file) on his windows box via Notepad. > Naturally there is "\r\n" at then end of each line. User then > moves this file to a Unix box (via Drive Mapping, drag-and-drop). > User then logins to the unix box via telnet and run the text file > which is a script.I would say that the best way to do this, was to use textpad or another editor for windows which actually saves files with \n, instead of \r\n (you can choose UNIX-style or Windows-style). It's never a good solution to apply a "fix" to a file just because another program doesn't behave like it should. The best solution is always to fix the problem where it's at, ie. what's causing the problem. -- -Thomas
This could be a partial solution ... it's workable, but not very complete. In the original author's situation, he's writing scripts, which may not have any extension. And declaring a share as "text files only" could be potentially catastrophic if used by someone who didn't know that every binary file sent there would be corrupted. Basically, when you're creating something as fundamental as file-sharing software or anything that works as a part of your OS's filesystem, you've got to be paranoid. I don't think it will be soon when the authors of Samba choose to include a feature that could potentially corrupt data. The idea of having a feature that would change the contents of a file at all is something they'd probably be wary of. Maybe a solution like yours could work though, as a special-case "you-better-know-what-you're-doing" feature. --eeyore> -----Original Message----- > From: Matt Neimeyer [mailto:neimeyer@youth-guard.org] > Sent: Tuesday, January 23, 2001 2:27 PM > To: eeyore@earthdome.com > Subject: RE: "\r\n" vs "\n" between Unix and Win > > > > >Regardless of the actual origin of the problem (a difference in viewpoint > >about what a "carriage return" is, back when Unix, CP/M, and DOS > were being > >developed), I think the real issue here is one of format identification. > >Let me try to clarify. > > I know that this is a huge moral, ethical, philosophical debate.... > > Here's my question... How hard would it be to have a table, file, > something > that Samba looked at for file extensions to determine if the translation > occurred... > > For example, if the file is a HTM, HTML, TXT, or Etc then convert it. But > otherwise leave it be. > > This way the administrator could decide which files or none to > have converted. > > Perhaps even on a share by share basis... > > Matt > >