[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index] [Home]

Re: [jcvs] CVSProject EOL bug and fix


hi,

 
> If you use cvsc to check-out files, NewLineReader has a flaw that
> assumes eol markers to be always present at the end of a file which it
> thinks should be ascii.  So if you have either 1) binary files checked
> in without -kb (bad i know), or 2) ascii files without a final eol at
> eof (it happens), then cvsc would always add a final eol byte to the end
> of the checked-out file when writing to the local project directory.
> This means the file is now immediately different compared to the
> repository
> version.

Does your fix works on both unix and windows platforms? Especially the 
last part of the patch seems to be problematic, because you only add an 
0x0A (LF). If i remember it correctly on Windows there must be an 
0x0C0x0A (CRLF).

> @@ -4573,7 +4595,11 @@
>  					if ( line == null ) break;
>  
>  					out.write( line );
> -					out.newLine();
> +					// Removed by nick - readLine now
> +					// returns the EOL too.  Stops cvsc
> +					// adding EOL to binaries checked in
> +					// as ascii and files without eol at eof
> +					// out.newLine();
>  					}
>  				catch ( IOException ex )
>  					{
> @@ -4751,6 +4777,10 @@
>  					ch = (char) inByte;
>  					if ( ch == 0x0A )
>  						{
> +						// Added by nick - we need to
> +						// not wrongly assumed later
> +						// the line always ends in eol
> +						line.append( ch	);
>  						break;
>  						}
>  
> 



-- 
            mbm
UP THE IRONS!