On the definition of a principal ideal sheaf In his book Algebraic Geometry and Arithmetic Curves Qing Liu claims in Exercise 3.4, page 56, the following for a scheme $X$ and a global function $f\in \mathcal O_X(X)$:
"The map  $U\mapsto f\vert _U\mathcal O_X(U)$ for every affine open subset $U$ defines a sheaf of ideals on $X$."
The presheaf thus defined (on the base of open sets given by affines) is certainly separated but I don't see why it should be a sheaf if $X$ is not integral.
The problem is that already if you have two open affines $U,V$ and functions $s\in \mathcal O(U),t\in \mathcal O(V)$ such that $fs=ft$ in $U\cap V$ there is no reason that $s$ and $t$ coincide on $U\cap V$, so that $s$ and $t$ can't a priori be glued and I don't see why the function on $U\cup V$ obtained by gluing $fs$  and $ft$ (they can be glued since $\mathcal O_X$ is a sheaf!) could be written as a product $(f\vert_{U\cup V})w$ for some $w\in \mathcal O(U\cup V)$.
Hence my question: Am I missing something or is the statement in the exercise false without some hypothesis on the scheme $X$?
 A: Note that we only need consider the case (of your setup) where $U \cup V$ is affine. If the function obtained by gluing $fs$ and $ft$ is not a multiple of $f$, then it is a nonzero element in $ \mathcal O (U \cup V) /f$, hence a nonzero function on $\operatorname{Spec} ( \mathcal O (U \cup V)/f)$. But $\operatorname{Spec} ( \mathcal O (U \cup V)/f)$ is covered by $\operatorname{Spec} ( \mathcal O (U)/f)$ and $\operatorname{Spec} ( \mathcal O (V)/f)$ so the function must be nonzero on one of those, contradiction.
The general principle here is that kernels of maps of sheaves can be computed one open set at a time.
But probably the simplest proof is to reduce to distinguished affine opens and do it algebraically. Suppose we have an affine open $\operatorname{Spec} R$ covered by open sets $\operatorname{Spec} R [1/a_i]$ where $a_i$ generate the unit ideal. If a global section $x$ of the structure sheaf restricts to a multiple of $f$ on each open, then for all $i$ we have $$ a_i^{e_i} (x - f s_i) =0$$ for some $e_i$ and $s_i$.
Because the $a_i$ generate the unit ideal, we have $\sum_{i=1}^n a_ib_i=1$, so $$x = \left(\sum_{i=1}^n a_ib_i\right)^{1-n + \sum_{i=1}^n e_i } x$$ and when we expand out the multionmial we can write each term as a multiple of $f$ using the appropriate identity, so $x$ is a multiple of $f$.
