Would you explain Installed-Size?

"Installed-Size" is part of control file generated for each .ipk package. Looking at its name I was sure it tells us the size of the all package files as if they are installed, but it turned out that it is actually the size of data.tar.gz archive which is compressed version of what would be installed.

The value comes from scripts/ipkg-build:

installed_size=`stat -c "%s" $tmp_dir/data.tar.gz`
sed -i -e "s/^Installed-Size: .*/Installed-Size: $installed_size/" \

And it doesn't look like a simple bug, but instead I feel there is a reason behind this.

So could someone explain to me why do we care about compressed size and why variable named "installed" which I found a bit confusing?

The decision has been made back when the overlay filesystem on the majority of targets was gzip compressed JFFS2. Taking the size of the compressed data.tar.gz payload was a close enough approximation of the size taken by the package upon install.

The actual numbers are impossible to predict due to transparent compression, flash block padding, rearranged files, overlay whiteouts etc.