This is question 19 in Chapter 3 of Spivak's Calculus on Manifolds.
Suppose $I_n=(a_n,b_n)$ is a sequence of open subintervals of $(0,1)$ such that every rational number in $(0,1)$ is contained in one of them, and such that $\sum (b_n-a_n)<1$. Let $A=\bigcup I_n$; it's not hard to show the boundary of $A$ is $[0,1]\setminus A$ and that it's not of measure zero.
Let $\chi_A$ be the characteristic function of $A$ and let $f$ be a function which equals to $\chi_A$ except on a set of measure zero.
Show $f$ is not Riemann integrable.
I found solutions here and here, but they both seem wrong to me. The latter seems to use the equation $\partial U\setminus V=\partial(U\setminus V)$ which is obviously wrong in general (and I don't see why it should apply here...), and the former seems to use the assertion that if $f_1$ differs from the function $f_2$ on a set $B$ and is discontinuous at $x_0$, then either $f_2$ is discontinuous at $x_0$ or $x_0\in B$ (which is again not true in general, and I don't see why it should apply here).
So how do you solve this question?