In which cases does pullback commute with the Hom-sheaf? Assume $f: (X,\mathcal{O}_X)\rightarrow (Y,\mathcal{O}_Y)$ is a morphism of locally ringed spaces and E and F are two locally free $\mathcal{O}_Y$-moduels of finite rank.
I was wondering if we have the following isomorphism in this case:
$f^{*}\mathcal{H}om_Y(E,F)\cong \mathcal{H}om_X(f^{*}E,f^{*}F)$?
My idea was the following: let $G$ be an $\mathcal{O}_X$-module, then we have
$Hom(\mathcal{H}om_X(f^{*}E,f^{*}F),G)\cong Hom( f^{*}F\otimes (f^{*}E)^\vee,G)\cong Hom(f^{*}F,\mathcal{H}om((f^{*}E)^{\vee},G))\cong Hom(f^{*}F,f^{*}E\otimes G)\cong Hom(F,f_{*}(f^{*}E\otimes G))\cong Hom(F,E\otimes f_{*}G)\cong Hom(\mathcal{H}om_Y(E,F),f_{*}G)\cong Hom(f^{*}(\mathcal{H}om_Y(E,F)),G)$ 
I used that E is locally free of finite rank => $f^{*}E$ is locally free of finite rank => $\mathcal{H}om(f^{*}E,f^{*}F)\cong (f^{*}E)^{\vee}\otimes f^{*}F$ 
$f^{*}E$ is locally free of finite rank => $(f^{*}E)^{\vee\vee}\cong f^{*}E$
$E$ is locally free of finite rank => $f_{*}(f^{*}E\otimes G)\cong E\otimes f_{*}G$ (projection formula)
So Yoneda should give us $\mathcal{H}om_X(f^{*}E,f^{*}F)\cong f^{*}\mathcal{H}om_Y(E,F)$?
Is my idea correct? If so, does this isomorphism also hold in other cases? For example is suspect that it could be true for $E$ a coherent sheaf and $f$ a flat morphism, where it would boil down to the known fact that from commutative algebra
$Hom_A(M,N)\otimes B \cong Hom_B(M\otimes B, N\otimes B)$
on the stalk level and $B$ a flat $A$-module, if we had a map $f^{*}\mathcal{H}om(E,F)\rightarrow \mathcal{H}om(f^{*}E,f^{*}F)$. But do we alsways have a sheaf morphism between these two sheaves on $X$? I cannot seem to construct such a map.
 A: $\def\H{{\mathcal Hom}}\def\HH{{\operatorname{Hom}}}$Everything you wrote seems correct for the locally free case. Though its easy to overlook subtle things with these type of arguments, it looks good to me. 
For the second I believe there is a natural map $f^*\H_Y(E,F) \to \H_X(f^*E,f^*F)$. I will actually define a map $\H_Y(E,F) \to f_*\H_X(f^*E, f^*F)$ and use the adjunction with $f^*$ to get the required map. 
Let $U \subseteq Y$ be open. Then $\H_Y(E,F)(U) = \HH(E|_U,F|_U)$ and $f_*\H_X(f^*E,F^*F)(U) = \HH(f^*E|_{f^{-1}(U)}, f^*F|_{f^{-1}(U)})$. Then we note that 
$$
f^*E|_{f^{-1}(U)} = f|_{f^{-1}(U)}^*\left(E|_{f^{-1}(U)}\right)
$$ 
and $f^*|_{f^{-1}(U)}$ is a functor from sheaves of $\mathcal{O}_U$ modules to $\mathcal{O}_{f^{-1}(U)}$ modules. Thus we get a natural map of sheaves of modules from $U$ from functoriality: 
$$
\HH(E|_U, F|_U) \to \HH\left(f|_{f^{-1}(U)}^*\left(E|_{f^{-1}(U)}\right), f|_{f^{-1}(U)}^*\left(F|_{f^{-1}(U)}\right)\right) = \HH(f^*E|_{f^{-1}(U)}, f^*F|_{f^{-1}(U)}).
$$
Everything is suitably natural enough that it should commute with the restriction maps for inclusions $V \subset U$ giving a map of sheaves $\H_Y(E,F) \to f_*\H_X(f^*E, f^*F)$.
Now that we have the required map $f^*\H_Y(E,F) \to \H_X(f^*E,f^*F)$, I think we need $X$ and $Y$ to be schemes not just locally ringed spaces. Then we can reduce to checking that this is an isomorphism on affine covers in which case it reduces to the isomorphism from commutative algebra. Without having $X$ and $Y$ be schemes I don't think we can make the argument work because $\H$ does not commute with taking stalks so we can't just check it on local rings.
EDIT: See comments below, apparently the argument does work on any ringed space as long as $E$ is of finite presentation. 
