"\r\n" vs "\n" between Unix and Win

Medi Montaseri medi at CyberShell.com
Tue Jan 23 20:35:51 GMT 2001


-------------------------------------------------------------------------
Medi Montaseri                               medi at CyberShell.com
Unix Distributed Systems Engineer            HTTP://www.CyberShell.com
CyberShell Engineering
-------------------------------------------------------------------------

On Tue, 23 Jan 2001, Christopher Robison wrote:

> Medi,
>=20
> What FTP does, it does because you tell it to.  You select the transfer m=
ode

That's correct, we can have a key-value directive for a given directory
that instruct Samba to transfer in ASCII or Bin mode.

>=20
> What you want Samba to do is perform this conversion silently behind the
> scenes. In order to do this, Samba would have to look at the file and dec=
ide

That's correct, the burdon is on the distributed file system layer not=20
applications.

> if it's a text file or not.  On the surface this seems like it might be
> fairly simple, though time-consuming -- look at every byte of the file an=
d

Yes, its simple, here is one line perl to do that
perl -ipe 's/\r\n/\n/' inputfile

Now, back to today....obviously Samba can not do this translation now.
Is there any workaround? I claims (to my community) that Unix is powerful
enough to come your way (Windows way) and Windows doesn't't have to go=20
Unix way (with NFS clients).=20

Can I overload the concept of printer resource definition. After all
Printer is a resource that receives input and redirects it to another
program. What if I create a similar resource that acts like a filter.
My parallasim with Printer is not 100% as a Printer is a one way
filter. My Filter (in fact here is a cool name, a Filter Directive)
should be bi-directional.

Thanks for your input guys...

>   --eeyore
>=20
>=20
>=20
> > -----Original Message-----
> > From: samba-admin at us5.samba.org [mailto:samba-admin at us5.samba.org]On
> > Behalf Of Medi Montaseri
> > Sent: Tuesday, January 23, 2001 1:32 PM
> > To: Thomas Lang=E5s
> > Cc: samba at us5.samba.org
> > Subject: Re: "\r\n" vs "\n" between Unix and Win
> >
> >
> >
> >
> >
> > -----------------------------------------------------------------------=
--
> > Medi Montaseri                               medi at CyberShell.com
> > Unix Distributed Systems Engineer            HTTP://www.CyberShell.com
> > CyberShell Engineering
> > -----------------------------------------------------------------------=
--
> >
> > On Tue, 23 Jan 2001, [iso-8859-1] Thomas Lang=E5s wrote:
> >
> > > 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 anoth=
er
> > > editor for windows which actually saves files with \n, instead
> > of \r\n (you
> >
> > But DOS/Window file system demands for such "\r\n" and the application
> > (ie Notepad) is simply following that. Of course an application can alw=
ays
> > alter things, but that becomes a local fix and not an underlying soluti=
on.
> >
> > > 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.
> > >
> > The problem is not the application, but the File System. And SMB is at =
a
> > File System level, hence it should make it transparent. FTP does.
> >
> > But, I appreciate your input and will look into changing the process
> > at creation time.
> >
> > > --
> > > -Thomas
> > >
> >
> >
>=20
>=20





More information about the samba mailing list