[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: ^M Appends to every line?

From: Christopher D Haakinson <cdhaakin_at_us.ibm.com>
Date: Thu, 24 Feb 2011 13:44:29 -0500

It's possible that the eol-style has nothing to do with this, because
before I added the style, my script was still failing and complaining about
the EOF as well as EOL errors...

Running your od command yields the following on the last 3 lines:
0000620 s t t i m e . . . . " \r \n \r \n
0000640 \r \n e x i t 0
0000650

so it is missing \n ...

I opened the file in notepad and added a couple blank lines under my exit 0
and it worked!! How weird is that?

Thanks for your help! It's been much appreciated.

|------------>
| From: |
|------------>
>-------------------------------------------------------------------------------------------------------------------------------------------------|
  |David Chapman <dcchapman_at_acm.org> |
>-------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To: |
|------------>
>-------------------------------------------------------------------------------------------------------------------------------------------------|
  |Christopher D Haakinson/Raleigh/IBM_at_IBMUS |
>-------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Cc: |
|------------>
>-------------------------------------------------------------------------------------------------------------------------------------------------|
  |users_at_subversion.apache.org |
>-------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date: |
|------------>
>-------------------------------------------------------------------------------------------------------------------------------------------------|
  |02/24/2011 01:28 PM |
>-------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject: |
|------------>
>-------------------------------------------------------------------------------------------------------------------------------------------------|
  |Re: ^M Appends to every line? |
>-------------------------------------------------------------------------------------------------------------------------------------------------|

On 2/24/2011 9:55 AM, Christopher D Haakinson wrote:
>
> I'd like someone to explain how this small shell script, which works
> fine, gets corrupted simply by creating a new file and copy/pasting
> the text in it. Here's what I'm doing:
>
> 1) I have a test shell script that runs fine. Here's the content:
> <------------------------- start
> lock="/tmp/deleteme"
> if [ -f $lock ]
> then
> echo "Lock file exists. Wait until it's gone to proceed. ."
> while [ -f $lock ]
> do
> echo "Waiting for lockfile to be removed. ."
> sleep 1s
> done
> echo "Now creating lock file"
> echo "locked" > $lock
> else
> echo "No lock file found. Creating it. ."
> echo "locked" > $lock
> fi
> echo "Lets try this again, hopefully for the last time...."
> exit 0
> <-------------------------- end
>
> 2) I copy this entire script from notepad in windows into a new file
> named test2.sh, also in notepad.
> 3) Using TortoiseSVN, I add test2.sh into my project
> 4) I commit the changes to the server
> 5) On my linux server, I run: svn update ... to get the test2.sh file
> 6) Now when I try to run it I get this:
> syntax error: unexpected end of file
>
>
> Now, this is the most simple task I could think of doing, and this
> doesn't work. I've also tried creating the new shell script with
> Komodo EDIT with the same results.
>
> This occurs even though I've tried adding svn:eol-style from both my
> linux server and my windows wrx... I'm lost!!
>

In Notepad, can you move your cursor below the last line of text in the
file? If not, there won't be a newline after the final line. Under
Linux, try "od -c test2.sh | more" and verify that there is a "\n" at
the very end of the listing. If not, you'll need to add one in Notepad,
Komodo, or your favorite Linux editor.

I have no idea why you would see this problem only with "svn:eol-style"
defined (if in fact this is the problem).

--
     David Chapman         dcchapman_at_acm.org
     Chapman Consulting -- San Jose, CA


graycol.gif ecblank.gif
Received on 2011-02-24 19:45:17 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.