Computing functional derivative of exchange-correlation functional Sakurai and Napolitano's chapter on density functional theory has claims that it is "straightforward" to find $\delta U_{\text{xc}}/\delta n$ for $$U_{\text{xc}}[n]=\int d^3 x n(\mathbf{x})\epsilon(n)\tag{2.33}$$ and a given $\epsilon(n)$, but I can't seem to figure out where to start with this calculation. My knowledge of variational calculus as it appears in Lagrangian mechanics has me calculating
$$
\int_{-\infty}^\infty \frac{\partial[n(x)\epsilon(x)]}{\partial n} d^3 x
$$
but integrating using Mathematica led to a recursion error, so I am a bit confused, especially since this1 thesis claims that
$$\frac{\delta U_{\text{xc}}}{\delta n(x)}= \frac{\partial[n(x)\epsilon(n(x))]}{\partial n(x)}.\tag{2.34}$$
I.e., free of the integral with respect to $d^3 x$. Which approach is correct? If the latter is correct, how does one arrive at that formula for $\delta U_{xc} /\delta n(x)$?

1 P. R. Tulip, Dielectric and Lattice Dynamical Properties of Molecular Crystals via Density Functional Perturbation Theory: Implementation within a First Principles Code.
 A: In my opinion the notation is a bit weird. So let us first define $$\epsilon_n := \epsilon \circ n :x \mapsto \epsilon(n(x))$$ for some function $\epsilon$ and
$$E[n] := \int \mathrm dx\, n(x) \, \epsilon_n(x)\quad. $$
We want to compute
$$\delta E[n][\varphi] := \lim\limits_{h \to 0} \frac{E[n+h\varphi]-E[n]}{h}  \quad ,$$
where $\varphi$ denotes some suitable test function. We find
$$\delta E[n][\varphi]  = \lim\limits_{h\to 0}\int \mathrm d x\, n(x) \frac{\epsilon_{n+h\varphi}(x)-\epsilon_n(x)}{h}+ \epsilon_{n+h\varphi}(x)\, \varphi(x) \quad . \tag{1}$$
To proceed, we compute
$$  \lim\limits_{h\to 0}\frac{\epsilon_{n+h\varphi}(x)-\epsilon_n(x)}{h} = \lim\limits_{h\to 0}\frac{\epsilon(n(x)+h\varphi(x))-\epsilon(n(x))}{h}\quad  = \epsilon^\prime (n(x)) \, \varphi(x) \quad , \tag{2}$$
by using the chain rule. This eventually yields
$$\delta E[n][\varphi]  = \int \mathrm d x\, \left(\epsilon(n(x))  + n(x)\, \epsilon^\prime (n(x)) \right)\varphi (x) \quad . \tag{3}$$
Finally, we see that by defintion
$$\frac{\delta E}{\delta n}[n](x) = \epsilon(n(x)) + n(x) \epsilon^\prime (n(x)) \quad, $$
which coincides with the form of the usual LDA exchange-correlation potential.
