Windows -> Unix file conversion problem

Discussion in 'Linux & BSD' started by Glaanieboy, Jun 8, 2004.

  1. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    I run Samba on my FreeBSD to enable Windows to browse the network shares on my FreeBSD box. But suddenly Samba or Windows freaked out, when mapping more than one network share to driveletters, Windows XP says:
    While just 30 mins ago I had 5 network shares all under the same username running with no problem at all.
    Also, when I open up a textfile from a share in Windows, all line-breaks are converted into little white squares. When I open them up in tsWebeditor, it's going nuts and showing only garbage. The other way around, when opening a file made and saved in a Windows app in FreeBSD, I see an extra W before each line break. I have never had this problem, in fact, I even transferred my entire website from Windows to Linux just two weeks ago with no problems at all.

    I must say, after some thinking while I am typing, I haven't tested it much since I installed Samba3 (samba-devel in ports) on the BSD box. I know for sure it worked perfectly under at least Samba2.

    Of course I did a testparm smb.conf to test it, here's the output:
    Please help me. I'll do some testing myself too.
     
  2. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    (btw I used the smb.conf file from Samba2 with Samba3. Have I missed an option?)
     
  3. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    It is the line breaks Glaanie, UNIX only takes \n, most FTP clients remove the \r automatically, but windows over SAMBA that does not happen.

    What you need to do is open the UNIX file in Wordpad and all will be just fine, or open it in a program that supports UNIX line terminations.

    If you transfer a text file over SAMBA to your FreeBSD box and need to work on it, open it in pico, then close the file again saving it, the extra \r's will be gone, and you can now use it without a problem.
     
  4. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    About your first problem, that is a problem with Windows, it will not let you "mount" shares unless they all use the same username, which IMHO is a stupid limitation, but only a reboot will fix that. Just set them to be persistent and have them reconnect upon bootup, you won't have a problem.
     
  5. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    But that's annoying! I have to transfer my entire website with lots and lots of text files, I don't wanna open them seperately in Pico... Why did it work last time? Does Samba2 work differently than Samba3 when it comes to converting line breaks? And shouldn't Samba take care of this? From what I understand Samba is meant as an invisible (to the user) networkshare-shell around Linux, so users shouldn't be bothered with difficult file conversions.
    Maybe I should install Samba2 again then <_<
     
  6. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    OK, I f*cked up. I uninstalled Samba-devel, so I could install samba2. But now it isn't working at all. When I browse to my server, it's asking for a password. Damn. Back to square one...
     
  7. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Samba two does not do this either.

    Apache does not care about what line break you use. That is why it will work flawlessly, however, unix programs will.

    Your thinking of SAMBA is a wrong one, it is supposed to let people using Windows utilize resources (HD space) on a Linux server without a problem, it is not there to remove or edit files as they are passed on to the server.
     
  8. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    But if I want to be able to do both, editing files on Windows and Linux, without doing stupid conversions. Maybe a setting in Samba?
     
  9. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    There is no setting in samba. To do that you need to choose either a text editor on both that can handle both, or choose a text editor on Windows that only does \n.
     
  10. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    If they made a setting to strip out all the \r's in all documents, that could screw up everything majorly, word documents and whatnot would go screwy.

    It just can not be done.
     
  11. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    X is right, you need to use Wordpad to edit the file, I've editted files directly on my BSD server in windows via samba without problems this way. BTW, samba-devel has been moved to samba3 port since its deemed stable.