Cvs Cr-lf


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Cvs Cr-lf
# 1  
Old 08-02-2006
Cvs Cr-lf

I've experienced a problem with CVS when I've checked out sh script.
When new build was created sources were checked out from CVS under Windows. Later this build was deployed under Linux und I recieved error from shell becouse of CR-LF EOL in file. I've tryed command dos2unix and become script without errors.
But when this script is checked out under Linux there are only LF EOL (without CR) and no errors in script.

How can I check out file from CVS with LF as EOL (or how can I modify script to become no errors due to CR-LF)?

Any help appriciated.
# 2  
Old 08-02-2006
CVS under Windows will always produce files with Windows carriage-control characteristics. My version of Windows cvs doceumentation (Don Harper 1999)
does not mention anything about changing file formats with regard to EOL.

Stick with dos2unix. I do not think you can check it into CVS as a DOS format file and then check it back out and have it be a UNIX carriage-control file.
# 3  
Old 08-02-2006
1) what if I switch script file from ASCII to Binary in CVS?

2) what problems can be in script due to CR?? (It was a surprise for me)
# 4  
Old 08-02-2006
If files are checked in in ASCII mode, it will always be checked out with DOS EOL on Windows and Unix EOL on any Unix. This is similar to the ASCII/Binary mode in FTP. This behaviour is intentional and in general will not cause any problems. In fact, I find it good sometimes to do it this way because some Windows editors such as Notepad does not interpret Unix EOL at all. Some editors may convert EOLs without notice, causing more problems. Also, if you check out the files from Windows and just ship to Linux and commit from there, you are bound to experience this sort of issues.

Therefore, maintain two checkout copies. One from Linux and another from Windows, and do not ship these files in between. There should be no problems with ASCII mode at all.

From your description, it appears to be that your script has already been corrupted with residue control characters. This is pretty normal as I have seen files from some open source projects are also messed up this way, although C sources are less sensitive than sh scripts when it comes to this problem. Of course this should be fixed. VIM for instance lets you see these control characters, so you may fix the file manually.

Do not switch ASCII/Binary without good reasons, or corruptions may easily arise. It is never a good idea to set a text file binary mode with CVS, as I think some CVS operations may fail with files that are marked as binary.
# 5  
Old 08-03-2006
We build java program under windows and use different scripts to run this program. So our build contains .bat and .sh-files. Then this build is deployed under windows and unix. I cannot make 2 separate builds (for Unix/Windows).
So I need somehow modify this script to make it insensitive to CR charachters (the sript is below).

Code:
#!/bin/sh
export CLASSPATH=${JAVA_HOME}/jre/lib/rt.jar:${CLASSPATH}:.:../lib/mt2-delegate.jar:../lib/mt2-if.jar:../lib/mt2-ui.jar:../lib/foundation.jar:../lib/wlclient.jar:../lib/wljmsclient.jar:../lib/log4j.jar
if [ "$3" = "" ]; then
   ${JAVA_HOME}/bin/java com.datos.ui.client.MappingExporterClient $1 $2
else
   ${JAVA_HOME}/bin/java com.datos.ui.client.MappingExporterClient $1 $2 "$3"
fi

The error I've recieved:
Code:
$ ./MappingExporterClient.sh 
: bad interpreter: No such file or directory

# 6  
Old 08-03-2006
The problem was in CR charachter in first string:
Code:
$ od -cx MappingExporterClient.sh | head -1
0000000   #   !   /   b   i   n   /   s   h  \r  \n   e   x   p   o   r

(there is no sh\r interpreter)

Now:
Code:
$ od -cx MappingExporterClient.sh | head -1
0000000   #   !   /   b   i   n   /   s   h  \n   e   x   p   o   r   t

# 7  
Old 08-03-2006
Quote:
Originally Posted by Hitori
We build java program under windows and use different scripts to run this program. So our build contains .bat and .sh-files. Then this build is deployed under windows and unix. I cannot make 2 separate builds (for Unix/Windows).
But your shell script is only run on Linux and the .bat only on Windows. Am I right? If so, just check out the whole project on Linux then the EOL will be \n, and the shell script will work. Check out the project again on Windows, the EOL will be \r\n, and the .bat will work. This is the same set of sources and you just check out two times on two different platforms. I still don't understand why this cannot be done as I know many projects have mixed .sh and .bat using CVS in similar situations as you are in.

If the shell script checked out on Linux still has the \r, that means either
(1) the file has been set to binary mode (previously or currently) and later checked in from Windows with the EOL changed, probably silently by the editor;
(2) has otherwise been corrupted with spurious control characters.

Then you should fix by removing all the \r, set the file to ASCII, and commit it back to CVS to fix the problem. In most cases I still do not encourage switching to all Binary mode without careful checking, as the change may easily lead to more severe corruptions, rather than fixing anything.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cvs manipule.

Hello all, What i need to do is manipulate a squid log file. I have many milions of file in this format: 1442814667.478 76 4.3.2.1 TCP_MISS/200 31845 GET http://pippo.com/inde.html - DIRECT/1.2.3.4 text/css What i need to do is transform field 7 from Pippo.com - 404 File Not Found in... (4 Replies)
Discussion started by: aka0017
4 Replies

2. Shell Programming and Scripting

CVS Automation

Hi All, I am just looking for CVS automation for SQL scripts. Normally Devs will check in new sql scripts or they will update the existing sql scripts with new query. We will take the scripts from CVS and run in DB. I am thinking to automate that process like whenever a new script is checked in... (1 Reply)
Discussion started by: pvmanikandan
1 Replies

3. AIX

Using cvs on AIX

Hello. I am using CVS on my AIX 6.1 box. I have gotten the repository setup and everything is working from command line. Now I want to use CVS on my Windows 7 machine using the remote repository on my AIX box. Has anyone else tried this? Why can't I get this to work? I have tried using... (3 Replies)
Discussion started by: hpodhrad
3 Replies

4. UNIX for Dummies Questions & Answers

Can you automate CVS?

Currently we have a load of files which we manually edit and then commit back into CVS ready for whoever else to edit. I have now made a script which auto-populates these files, however the powers that be still want them accessible via CVS. Is there a way I can automatically commit these files... (7 Replies)
Discussion started by: JayC89
7 Replies

5. Red Hat

CVS Configuration Help

Hello, I have read a great deal of documentation on CVS and I hope I have not overlooked what I need but I have certain issues with CVS that I cannnot resolve. The setup for the /etx/xinetd.d file I have is as follows: # default: off # description: The CVS service can record the history... (2 Replies)
Discussion started by: mojoman
2 Replies

6. Red Hat

CVS on redhat

Hi all, i am trying to set up a CVS server on linux and to remote access the repository using WinCVS. I am facing some problem and i am unsure whether is it the client or the server not set up properly. In my winCVS client, i clicked Admin ->login and i specify my CVSROOT to be ":... (5 Replies)
Discussion started by: new2ss
5 Replies

7. Debian

What is CVS...?

Hi everyone... Could one of you kind Linux experts please let me know what CVS is In return I will kindly give you a thumbs up :b: a good trade I feel!! (1 Reply)
Discussion started by: TonyChapman
1 Replies

8. Solaris

cvs error

dear all I'm one of the CVS administrators here at my company and i have this cvs error in the messages Sep 18 07:20:37 dev cvs: Dying gasps received from client. can any one help me about this error ............. thanks murad jaber (1 Reply)
Discussion started by: murad.jaber
1 Replies

9. UNIX for Dummies Questions & Answers

CVS on UNIX

Hey guys, I am trying to setup CVS to run with an SSH connection, but am hitting a brick wall. I seem to be getting CVS to login correctly, but when I attempt to check out a module I am getting the following error: ksh: cvs: not found This is kinda implying to me that its not loading... (2 Replies)
Discussion started by: LiquidChild
2 Replies

10. Shell Programming and Scripting

CVS, Perl and VI

I am trying to write a Perl script to cover a few CVS commands (setup specifically), however the VI screen that pops up and requests a comment, what is the best way of entering the text automatically (will be a variable name) and then saving that cvs notification from my Perl program? Help is... (2 Replies)
Discussion started by: Shakey21
2 Replies
Login or Register to Ask a Question