[Mono-dev] RE: porting tool

Ben Maurer bmaurer at ximian.com
Thu Sep 22 15:47:32 EDT 2005


On Thu, 2005-09-22 at 11:13 -0700, Andrew Skiba wrote:
> Sure.
> 
> In the most simple scenario you run
> 
> $ find -type f>INDEX
> 
> And then use this index as both source and target list. Typically one
> will filter executables out of this list, as well as svn directories,
> etc. Then you can run
> 
> $ mono CaseRePorter.exe INDEX INDEX >out.lst
> 
> and see what is in the out.lst. If you see too much noise in it, you
> can review your INDEX and remove the noising files. Hopefully you get
> output like
> 
> file1.ext
>   ./path/path/file2.cs:100:    s = new StreamWriter ("file1.EXT");
> 
> then you go to file2.cs and fix the name.
> 
> As I said, I ran it on a big project tree (after FEW iterations tuning
> INDEX) and I had no noise, and ~1000 lines of useful output. Lots of
> files were referenced with wrong case from everywhere - aspx pages,
> xmls, csharp sources, you name it.
> 
> Unfortunately, I am not familiar with AspNetForums, so I don't know if
> this tool will help there.
> 
> 
> > I'm not sure exactly how one would use this tool. Can you walk me
> through
> > how I would take a typical web application (say, AspNetForums) and
> fix up
> >the path references?

This is a clever idea. Just a few suggestions:

1) try testing for binary files when you open something to see if it has
any path references in it. For our purposes, "binary file" can be
defined as any file which contains a \0 in it's first 8 kb of data. The
chance of a randomly generated file failing this test is
(255/256)^(8*1024), or 1.2 × 10^-14. This should prevent any need for
"tuning".

2) would need a manpage, etc to show how to use it.

3) Why not have a mode where it does the find -type f for you, and then
looks at all the files. This will be practical once you do 1 to remove
binary files from consideration.

4) IMHO, we shouldn't only look at files, directories might be
referenced too.

5) Any ideas on how to catch not using path.combine?

-- Ben




More information about the Mono-devel-list mailing list