# pkg clean size mismatch



## anund (Jun 28, 2014)

Hi,
After 
	
	



```
pkg update
```
 I see a lot of size mismatches when I run
	
	



```
pkg clean
```

Just a snip:

```
All/firefox-30.0,1.txz         www/firefox          Size mismatch
All/geany-1.23.1_2.txz         devel/geany          Size mismatch
All/lcms-1.19_5,1.txz          graphics/lcms        Size mismatch
All/exiv2-0.24_1,1.txz         graphics/exiv2       Size mismatch
```

Why is that? I would like to burn my cache directory to a DVD to enable installations on other machines without the downloads. These would be removed if I ran 
	
	



```
pkg clean
```
 Thanks.

```
# uname -a
FreeBSD machine3.example.com 10.0-RELEASE-p6 FreeBSD 10.0-RELEASE-p6 #0: Tue Jun 24 07:47:37 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------



## SirDice (Jun 28, 2014)

They're 'old' versions of the packages. If some of those packages have been rebuild the size and checksum may not match even if the version is correct. A pkg-install(8) or pkg-upgrade(8) would need to download the new version from the repository anyway, so the 'old' ones can be removed.


----------



## kpa (Jun 28, 2014)

That's by design, PKG keeps a cache of downloaded packages that is not cleaned up automatically when newer versions of packages are downloaded. Note that a package that is in the remote repository with the same version number but is compiled somewhat differently  also considered new, those will trigger the "size mismatch" condition.


----------



## anund (Jun 28, 2014)

Okay I see. In fact 


```
pkg info firefox
```

shows that I installed it on Jun 21, and the rebuilt version at 
http://pkg.freebsd.org/freebsd:10:x86:64/latest/All/
has a date of Jun 26

But when I run 
	
	



```
pkg upgrade
```
it gives

```
Updating repository catalogue
Nothing to do
```

Shouldn't the rebuilt version get installed?


----------



## kpa (Jun 28, 2014)

anund said:
			
		

> Okay I see. In fact
> 
> 
> ```
> ...



No, unless there's a change in the version number of the package or options used to build the package or dependencies to other packages. This means that for example if a build tool for a package gets changed without bumping the version number the resulting package will still be considered not updated even though there might be some subtle differences compared to the previous package.


----------



## anund (Jun 28, 2014)

Great now I understand. Thanks for clarifying.


----------



## kpa (Jun 28, 2014)

Oh and sorry I forgot to mention this, the pkg-clean(8) functionality is implemented very naively to make it run very fast. It will only test version numbers of packages and sizes of the packages, that's why you will only see messages "superceded by version X" and "size mismatch". It will not check options or dependencies or do anything else that would require it to look inside the packages in finer detail.


----------

