Loading ...
Sorry, an error occurred while loading the content.
 

content.txt often has wrong line endings

Expand Messages
  • Max Ischenko
    Hi, I tried to import my FitNesse installation to Subversion and got a lot of complains from it regarding inconsistent line endings in content.txt files in
    Message 1 of 5 , Nov 2, 2004
      Hi,

      I tried to import my FitNesse installation to Subversion and got a lot
      of complains from it regarding "inconsistent line endings" in
      content.txt files in misc places.

      I checked out by hand and there were a problem indeed - 0d0d0a instead
      of expected 0d0a.
    • Bob cotton
      We ve encountered similar problems, not with subversion, but with cvs. The problem comes in when content is checked in on a UNIX machine, then checked out on a
      Message 2 of 5 , Nov 2, 2004
        We've encountered similar problems, not with
        subversion, but with cvs.

        The problem comes in when content is checked in on a
        UNIX machine, then checked out on a windows machine.

        It appears that the default line separator of the
        INPUT text box in browsers is \r\n. Check this into
        cvs, then out on a windows machine and you get \r\r\n,
        Fitnesse then translates the extra \r into <BR> when
        rendering the page.

        Here is a patch that we used to resolve this issue.
        BTW, Where is the official place to send patches?

        diff -ur
        fitnesse20040910-orig/src/fitnesse/wiki/FileSystemPage.java
        fitnesse/src/fitnesse/wiki/FileSystemPage.java
        ---
        fitnesse20040910-orig/src/fitnesse/wiki/FileSystemPage.java
        2004-09-10 14:09:32.000000000 -0600
        +++ fitnesse/src/fitnesse/wiki/FileSystemPage.java
        2004-10-29 14:18:11.000000000 -0600
        @@ -48,13 +48,17 @@
        return false;
        }

        - protected synchronized void saveContent(String
        content) throws Exception
        + protected synchronized void saveContent(String
        content) throws Exception
        {
        if(content == null)
        return;

        + String separator =
        System.getProperty("line.separator");
        +
        if(content.endsWith("|"))
        - content += "\n";
        + content += separator;
        +
        + content = replaceAll(content, "\r\n",
        separator);

        File output = new
        File(getFileSystemPath() + contentFilename);
        OutputStreamWriter writer = new
        OutputStreamWriter(new FileOutputStream(output),
        "UTF-8");
        @@ -62,6 +66,22 @@
        writer.close();
        }

        + protected String replaceAll(String s, String one,
        String another)
        + {
        + // In a string replace one substring with
        another
        + if (s.equals("")) return "";
        + String res = "";
        + int i = s.indexOf(one,0);
        + int lastpos = 0;
        + while (i != -1) {
        + res += s.substring(lastpos,i) + another;
        + lastpos = i + one.length();
        + i = s.indexOf(one,lastpos);
        + }
        + res += s.substring(lastpos); // the rest
        + return res;
        + }
        +
        protected synchronized void
        saveAttributes(WikiPageProperties attributes) throws
        Exception
        {
        String propertiesFileName =
        getFileSystemPath() + propertiesFilename;


        --- Max Ischenko <max@...> wrote:

        >
        > Hi,
        >
        > I tried to import my FitNesse installation to
        > Subversion and got a lot
        > of complains from it regarding "inconsistent line
        > endings" in
        > content.txt files in misc places.
        >
        > I checked out by hand and there were a problem
        > indeed - 0d0d0a instead
        > of expected 0d0a.
        >



        __________________________________
        Do you Yahoo!?
        Check out the new Yahoo! Front Page.
        www.yahoo.com
      • Micah Martin
        Goodness! I m not sure how to take that. To translate, all the line ends in you content.txt files are r r n where subversion want r n. Let me check various
        Message 3 of 5 , Nov 2, 2004
          Goodness! I'm not sure how to take that. To translate, all the line
          ends in you content.txt files are \r\r\n where subversion want \r\n.
          Let me check various installations.

          Mac OS X: \r\n
          RedHat 9 : \r\n
          Windows XP: \n

          I find it interesting that both the unix based systems use \r\n while
          windows uses \n. That seems reversed to me. Either way I'm not seeing
          any \r\r\n line endings. What operating system are you using?

          For the most part, FitNesse allows the operating system to take care of
          line endings. I'm not sure how this problem could come about.

          Micah Martin
          Object Mentor, Inc.
          www.objectmentor.com

          On Nov 2, 2004, at 3:31 AM, Max Ischenko wrote:

          >
          >
          > Hi,
          >
          > I tried to import my FitNesse installation to Subversion and got a lot
          > of complains from it regarding "inconsistent line endings" in
          > content.txt files in misc places.
          >
          > I checked out by hand and there were a problem indeed - 0d0d0a instead
          > of expected 0d0a.
          >
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
        • Micah Martin
          That would explain it. I ve had the same cvs problem with different projects in the past. I ll have a look at your patch. Micah Martin Object Mentor, Inc.
          Message 4 of 5 , Nov 2, 2004
            That would explain it. I've had the same cvs problem with different
            projects in the past. I'll have a look at your patch.

            Micah Martin
            Object Mentor, Inc.
            www.objectmentor.com

            On Nov 2, 2004, at 7:34 AM, Bob cotton wrote:

            >
            > We've encountered similar problems, not with
            > subversion, but with cvs.
            >
            > The problem comes in when content is checked in on a
            > UNIX machine, then checked out on a windows machine.
            >
            > It appears that the default line separator of the
            > INPUT text box in browsers is \r\n. Check this into
            > cvs, then out on a windows machine and you get \r\r\n,
            > Fitnesse then translates the extra \r into <BR> when
            > rendering the page.
            >
            > Here is a patch that we used to resolve this issue.
            > BTW, Where is the official place to send patches?
            >
            > diff -ur
            > fitnesse20040910-orig/src/fitnesse/wiki/FileSystemPage.java
            > fitnesse/src/fitnesse/wiki/FileSystemPage.java
            > ---
            > fitnesse20040910-orig/src/fitnesse/wiki/FileSystemPage.java
            > 2004-09-10 14:09:32.000000000 -0600
            > +++ fitnesse/src/fitnesse/wiki/FileSystemPage.java
            > 2004-10-29 14:18:11.000000000 -0600
            > @@ -48,13 +48,17 @@
            > return false;
            > }
            >
            > - protected synchronized void saveContent(String
            > content) throws Exception
            > + protected synchronized void saveContent(String
            > content) throws Exception
            > {
            > if(content == null)
            > return;
            >
            > + String separator =
            > System.getProperty("line.separator");
            > +
            > if(content.endsWith("|"))
            > - content += "\n";
            > + content += separator;
            > +
            > + content = replaceAll(content, "\r\n",
            > separator);
            >
            > File output = new
            > File(getFileSystemPath() + contentFilename);
            > OutputStreamWriter writer = new
            > OutputStreamWriter(new FileOutputStream(output),
            > "UTF-8");
            > @@ -62,6 +66,22 @@
            > writer.close();
            > }
            >
            > + protected String replaceAll(String s, String one,
            > String another)
            > + {
            > + // In a string replace one substring with
            > another
            > + if (s.equals("")) return "";
            > + String res = "";
            > + int i = s.indexOf(one,0);
            > + int lastpos = 0;
            > + while (i != -1) {
            > + res += s.substring(lastpos,i) + another;
            > + lastpos = i + one.length();
            > + i = s.indexOf(one,lastpos);
            > + }
            > + res += s.substring(lastpos); // the rest
            > + return res;
            > + }
            > +
            > protected synchronized void
            > saveAttributes(WikiPageProperties attributes) throws
            > Exception
            > {
            > String propertiesFileName =
            > getFileSystemPath() + propertiesFilename;
            >
            >
            > --- Max Ischenko <max@...> wrote:
            >
            >>
            >> Hi,
            >>
            >> I tried to import my FitNesse installation to
            >> Subversion and got a lot
            >> of complains from it regarding "inconsistent line
            >> endings" in
            >> content.txt files in misc places.
            >>
            >> I checked out by hand and there were a problem
            >> indeed - 0d0d0a instead
            >> of expected 0d0a.
            >>
            >
            >
            >
            > __________________________________
            > Do you Yahoo!?
            > Check out the new Yahoo! Front Page.
            > www.yahoo.com
            >
            >
            >
            >
            >
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
            >
          • Max Ischenko
            ... Looks like Fitnesse makes it s own contribution as well. At least one of those problematic files was created by our local Fitnesse server, not shipped as
            Message 5 of 5 , Nov 3, 2004
              Bob cotton wrote:

              > We've encountered similar problems, not with
              > subversion, but with cvs.
              >
              > The problem comes in when content is checked in on a
              > UNIX machine, then checked out on a windows machine.

              Looks like Fitnesse makes it's own contribution as well.
              At least one of those problematic files was created by our local
              Fitnesse server, not shipped as part of the installation tarball.

              > It appears that the default line separator of the
              > INPUT text box in browsers is \r\n. Check this into
              > cvs, then out on a windows machine and you get \r\r\n,
              > Fitnesse then translates the extra \r into <BR> when
              > rendering the page.
              >
              > Here is a patch that we used to resolve this issue.

              Thanks a lot.


              PS: for Micah Martin - I'm using latest fitnesse.jar on Windows2000, but
              most of the FitnesseRoot's content comes from July snapshot.
            Your message has been successfully submitted and would be delivered to recipients shortly.