Quick sort, Hoare's partition algorithm. Is there a mistake in CLRS?
The problem statement is correct.
I think you getting confused about: repeat $j \gets j-1$ until $A[j] \leq x$. It means that if $A[j]&gt;x$ then do $j \gets j-1$.
Similarly, loop $8-10$ means that if $A[i]&lt;x$ then do $i \gets i+1$.
Therefore, the algorithm executes in the following way on $A = [1,2]$:

After the loop $5-7$, $j$ becomes $1$ since $A[2] &gt; x$.

After loop $8−10$, $i$ becomes $1$ since $A[1] = x$.

Since $i = j = 1$, the algorithm terminates and returns $1$.