inconsistent behavior of tikz [fit] and [transform shape]

I want to frame a set of nodes with the option [fit] ​​and change the overall size of the drawing with [scale = xx, transform shape] but I have unexpected behavior. the frame is no longer valid

the code:

\documentclass[a4paper]{article}

\usepackage{pgf,tikz}
\usetikzlibrary{fit,calc,positioning}

\begin{document}

\begin{tikzpicture}
\node[draw](A){A};
\node[right=3em of A,draw](B){B};
\node[left=3em of A,draw](C){C};
\node[above=3em of A,draw](D){D};
\node[below=3em of A,draw](E){E};
\node[fit=(A) (B) (C) (D) (E), draw]{};
\end{tikzpicture}
\hfill
\begin{tikzpicture}[scale=0.8,transform shape]
\node[draw](A){A};
\node[right=3em of A,draw](B){B};
\node[left=3em of A,draw](C){C};
\node[above=3em of A,draw](D){D};
\node[below=3em of A,draw](E){E};
\node[fit=(A) (B) (C) (D) (E), draw]{};
\end{tikzpicture}

\end{document}


what can I do?, is this a bug?

-
This doesn't happen for me: the entire picture is scaled correctly. What version of PGF/TikZ are you using? –  Jake Jun 6 '14 at 8:28
@Jake I get that via v3 –  percusse Jun 6 '14 at 8:33
@percusse: Ha, interesting! I wonder if that's a feature or a regression... –  Jake Jun 6 '14 at 8:41
@Jake That's probably something due to using global switches. I would say this is consistent behavior with undesired result. Scoping as Claudio mentioned in the comment would be the proper way to do it I guess. –  percusse Jun 6 '14 at 8:45

You have to exclude the fitting node to be scaled since it first fits the contents and then applies the scaling to it again. Easiest is to turn off the transfrom shape effect.

\documentclass[a4paper]{article}

\usepackage{tikz}
\usetikzlibrary{fit,calc,positioning}

\begin{document}

\begin{tikzpicture}
\node[draw](A){A};
\node[right=3em of A,draw](B){B};
\node[left=3em of A,draw](C){C};
\node[above=3em of A,draw](D){D};
\node[below=3em of A,draw](E){E};
\node[fit=(A) (B) (C) (D) (E), draw]{};
\end{tikzpicture}
\begin{tikzpicture}[scale=0.5,transform shape]
\node[draw](A){A};
\node[right=3em of A,draw](B){B};
\node[left=3em of A,draw](C){C};
\node[above=3em of A,draw](D){D};
\node[below=3em of A,draw](E){E};
\node[fit=(A) (B) (C) (D) (E), transform shape=false,draw]{};
\end{tikzpicture}

\end{document}


-
Another way is passing to a scope environment the scaling options, include relevant code and leave outside the node used for fitting. –  Claudio Fiandrino Jun 6 '14 at 8:39
@ClaudioFiandrino Agreed. –  percusse Jun 6 '14 at 8:46
ok, I'll do that, but it seems to be a regression, I do not remember having this problem with the previous version –  rpapa Jun 10 '14 at 16:57