[lxc-users] "lxc file push" corrupts files

Tycho Andersen tycho.andersen at canonical.com
Wed Jan 27 14:44:22 UTC 2016


On Wed, Jan 27, 2016 at 04:42:21PM +0900, Tomasz Chmielewski wrote:
> In some cases, "lxc file push" corrupts files.
> 
> To reproduce:
> 
> - file must exist in the container
> - existing file in the container must be bigger than the file being pushed

Thanks for the report, I believe this was fixed by
500e0162022f5697c5df5cf01160639814af3f5f which is in the 2.0.0 beta1
release that was tagged yesterday.

Tycho

> Reproducer:
> 
> * make sure /tmp/testfile does not exist in the container:
> 
> host# lxc exec container rm /tmp/testfile
> 
> 
> * create two files locally:
> 
> host# echo a > smaller
> 
> host# echo ab > bigger
> 
> host# md5sum smaller bigger
> 60b725f10c9c85c70d97880dfe8191b3  smaller
> daa8075d6ac5ff8d0c6d4650adb4ef29  bigger
> 
> host# ls -l smaller bigger
> -rw-r--r-- 1 root root 3 Jan 27 07:35 bigger
> -rw-r--r-- 1 root root 2 Jan 27 07:35 smaller
> 
> 
> * send the bigger file:
> 
> host# lxc file push bigger container/tmp/testfile
> 
> 
> * check if it's OK - it is:
> 
> container# md5sum testfile
> daa8075d6ac5ff8d0c6d4650adb4ef29  testfile
> 
> container# ls -l testfile
> -rw-r--r-- 1 root root 3 Jan 27 07:37 testfile
> 
> 
> * now, send the smaller file to overwrite "testfile"
> 
> host# lxc file push smaller container/tmp/testfile
> 
> 
> * it is neither of the files we've sent:
> 
> container# md5sum testfile
> 94364860a0452ac23f3dac45f0091d81  testfile
> 
> container# ls -l testfile
> -rw-r--r-- 1 root root 3 Jan 27 07:38 testfile
> 
> container# cat testfile
> a
>  <-- extra end of line
>  <-- extra end of line
> container#
> 
> 
> Tomasz Chmielewski
> http://wpkg.org
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list