Corrupt text files, ^M
I installed red hat 9.0 on six different systems multiple times. With different
software combinations. I tried a minimal instalation and a full instalation and
a few custom installations.
All the installations give a following problem:
Every line in a new created text file is ending with ^M. Binairie files don't
have the problem. ^M is visible when file is created by a program and then
openend by mc.
Steps to Reproduce :
1.Create a text file with windows or PHP. The file must contain carrage returns
for a new line. A file with one line or no carage return doesn't have the
2.when created with windows upload it with ftp, samba or webupload.
3.when uploading with ftp don't use ascii mode some how in this mode the file
is made correct.
4.now open the file with mc every line is now ending on ^M.
5. when creating a file with php use /r/n to make a carrage return.
6. when you don't use the /r no ^M is made.
7. you can also made this bug by download a text file with windows. suchs a a
php, perl, html or just text file and then upload it to the linux box.
time after time the bug is rising i made the same installations with red hat
7.3 8.0 suse 7.3 mandrake 8.0 8.1 8.2 and they don't have the problem. mandrake
9.0 and red hat 9.0 have the bug.
Expected Results :
No ^M at the end of a line some programs just don't like the ^M.
Additional Information :
fwrite($file_open_new,"text\r\n") in a php script will write this in the file:
Bug that should be fixed.
The bug is caused by mc. i used the mc from red hat 8.0 and the bug is solved.
Why is this issue closed? I solved the problem by installing mc from 8.0 on my
9.0. This means that i must use an older version of mc to solve the problem.
will there be a bug fix coming soon?
I don't believe this to be a bug. I guess you are working with files
that contain dos carriage return/line feed pairs. Unix uses line feeds
only. In mc the crs are represented by a ^M.
Try a dos2unix <file> and see if the ^M's dissappear. If you use ftp
to upload you can substitute the crlfs by lfs by setting transfer mode
to ascii on text files.