Programs saved with CRLF (DOS style)

Programs saved with CRLF (DOS style)

by Charlie Daly -
Number of replies: 2

Hello and regards,

Thank you for this amazing plugin.

I am curious that on my Linux server, some student programs are being saved with DOS style line endings, that is, instead of a line feed (hex 0A) at the end of the line, there is a carriage return (hex 0D) and a line feed (hex 0A). They are being saved in /var/www/moodledata/vpl_data etc.

I was hoping that you could explain why, or in what circumstances, the student code would be saved in DOS format on a Linux computer.

Thanks very much in advance,

All the best,

Charlie

Average of ratings: -
In reply to Charlie Daly

Re: Programs saved with CRLF (DOS style)

by Juan Carlos Rodríguez-del-Pino -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Charlie,
I have reviewed this issue and this is the current state: By default, when the student writes code by hand, it is introduced with the Unix end of line format, but if you upload, import or drag and drop files it keeps the source end of line format.
This behavior may be a problem, taking into account that the code is run in a Linux machine and some compiler or interpreter may reject the code. On the other hand, this behavior of keeping the original line end format may be a feature for users that save and download the code from VPL.

Please, describe the inconvenience that generates this behavior to try to give an appropriate answer to more users.

Anyway, this issue has been marked as a bug.

Best regards,
Juan Carlos.

In reply to Juan Carlos Rodríguez-del-Pino

Re: Programs saved with CRLF (DOS style)

by Charlie Daly -
Hello Juan Carlos,

Thank you for your reply.

In fact there was no real inconvenience. As part of an investigation into academic integrity I was searching for patterns in a student's files. I knew that one file contained an exclamation mark character at the end of the file and yet when I used grep it couldn't find a match. I discovered then that the file had the CRLF line format and that was why grep couldn't find the match.

I asked the question as I wondered if this information could help with the investigation.

I did some experiments, and I discovered that if a file is uploaded, then, as you point out, it keeps the source end of line format. And, interestingly, if that file is subsequently edited in VPL, it maintains the same end of file format. This makes it seem like the feature you point out so that students can use VPL to store their own programs. In my experience, the end of line issue has only caused problems for editors and language translators seem to be immune to the problem.

All the best,

Charlie