9 Commits

Author SHA1 Message Date
Patrick McCarty 9c1a4a3542 Only create deltas between two regular files
For three different Clear Linux OS builds in the last few months, deltas
were created between files with type change L->F (symlink to file).
This was allowed to occur because there is no check if
file->peer->is_link in __create_delta().

Instead, remove the file->is_link check and simply ensure that the
from/to file types are both F (i.e. "regular file").

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-04-04 11:45:43 -07:00
Patrick Ohly 2890a11c5a delta.c: fix xattr test after patching
At the moment, swupd_create_pack fails when some files have xattrs and
get patched because the xattrs of the test file do not match the
original, unpatched file.

That's because xattrs_copy() was applied to the wrong target file.

Fixes: swupd-server/#35

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-11-15 11:28:26 -08:00
Tudor Marcu 6eca4601b0 Update argument passed to system_argv
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-08-22 03:22:14 -07:00
Tudor Marcu 04d2af2f64 Change delta's name from FROM-TO-HASH2 to FROM-TO-HASH1-HASH2 format.
There is an issue when two different files in a newer release have same hash:
This is, when swupd updates a file by applying a delta, it takes the HASH2 to
know the file where delta must be applyed. If files are different in current
release (before updating), there must be 2 deltas, one for each file but as
the two files have same hash in new release delta's name are the same:
FROM-TO-HASH2 and it is when issue arises due to just the last delta file is
kept when swupd server creates files and packs. So when swupd client tries to
apply the delta to one of the file that does not corresponds it will fail and
generates an error. At the first look it will seem like delta file is corrupted
however the issue is that delta file was created for another file.
To solve this issue we include the hash for the original file in the delta's
name so that swupd client can take the correct delta and apply it:
FROM-TO-HASH1-HASH2.

Signed-off-by: Jose R Guzman <jose.r.guzman.mosqueda@intel.com>
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-08-19 17:17:20 -07:00
Patrick McCarty b0e0b7f77d Fix some clang-format nitpicks
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-05-17 13:57:48 -07:00
Jose R Guzman 746b9a56a8 Replace system calls by local system_argv functions.
There are new functions that replace system() calls: system_argv(), system_argv_fd and system_argv_pipe().
They are based on execvp() function and they can manage any argument including filenames with characters
that could be interpreted as meta-characters in a regular system() function.
So no escape for the arguments needed and is less prone to errors.

Signed-off-by: Jose R Guzman <jose.r.guzman.mosqueda@intel.com>
2016-05-17 13:56:10 -07:00
William Douglas 24ef47f40c Fixups for clang-format v3.8.0 2016-03-24 21:17:56 +00:00
Patrick McCarty 3044d8c51b Initial run of clang-format
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-03 08:39:11 -08:00
Patrick McCarty 6c438ca96f Initial commit
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-02-24 10:00:31 -08:00