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

Tomasz Chmielewski mangoo at wpkg.org
Wed Jan 27 07:42:21 UTC 2016


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

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


More information about the lxc-users mailing list