[Ur] Bug in SQL name-mangling (patch)

Adam Chlipala adamc at csail.mit.edu
Fri Apr 24 07:54:55 EDT 2015


Thanks for the patch; it's applied now.

FWIW, I don't have see an obvious way to use SML types to catch such 
bugs in the future.

On 04/23/2015 04:40 PM, Istvan Chung wrote:
> During a compile with the latest Ur/Web release (7b508cd0dbf9), the
> compiler mangled the definition [table tname] project [projectname] into
> the MySQL name [uw_Projectname_tname] at one point in the binary rather
> than [uw_projectname_tname], thus causing the compiled binary to fail.
>
> Upon further investigation, it appeared that the problem was in
> monoize.sml:4685, which simply prefixed "uw_" rather than calling
> [Settings.mangleSql].  I've attached a patch (suitable for use with [hg
> import]) which fixes this individual problem, but I'm not sure if
> similar issues might exist elsewhere.  It might be nice if the compiler
> used SML's type system to protect against table names being used
> directly in SQL without being blessed through [mangleSql], but I suspect
> that would be too large of a change to be practical.



More information about the Ur mailing list