Age | Commit message (Collapse) | Author |
|
The string is actually always null-terminated, since the calloc above
adds one more byte than what we tell readlink about.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The format is documented as "<c|b> major minor" but the parser was
accidentally changed to require a colon in between.
Fixes: 9864ea5b2045f4bd72633152d71dd1c7f8b0b7f9
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The directory listing stores a signed difference of the inode number.
Actually treating it as signed saves emitting extra headers if hard
links or file deduplication are finally implemented.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Instead of insisting that mode bits and inode type match up, determine
ignore the mode bits and determine them from the inode type.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Some experiments seem to indicate that the various GNU extensions are
more widely supported than their POSIX equivalents[1]. Possibly because
they are easier to implement and possibly because of the wide spread
use of GNU tar.
This commit replaces the PAX writer in the write_tar_header implementation
with a GNU extension based writer.
The writer is also cleaned up by removing all global state. The record
counter is moved outside into the tar2sqfs program and passed in as
function argument.
[1] https://dev.gentoo.org/~mgorny/articles/portability-of-tar-features.html
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
If the tar header name is exactely 100 bytes long, it does not have a
trailing null byte. Using strlen/strcpy on it effectively concatenates
the following fields contents to it.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Assuming this code will ever see a big endian platform.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This commit attempts to split some of the monolitic tar parsing code up
into multiple functions in seperate files. Also, some code duplication
(like reading a record into memory which was implemented twice) is
removed.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
In case the tables are not completely filled by reading from the
squashfs image.
Bug found using scan-build.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Mainly to make scan-build happy.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Bug found using scan-build.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The intention was to free the temporary object in addition to the list.
Since the temp pointer is also used for iterating the list, this resulted
in a double free instead of the intended.
This commit fixes the double free by replacing the recycled variable based
list free with the helper function intended to do this.
Bug found using scan-build.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Should the inode table theoretically be empty, the function returns an
undefined value. This commit fixes that case by initializing the return
status to 0, so it returns success status in that case.
Bug found using scan-build.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The refactor of the xattr table grow code merged all allocation code
paths into realloc(), including the initial allocation. This means that
the xattr structure is used uninitialized. This commit makes sure the
reallocated structure is alwayes cleared.
Bug found using scan-build.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Most code path that use 'extra' allocate it using calloc/malloc/strdup
and then converge into a common path that uses free() on extra.
This commit removes a stray one that uses alloca for symlink targets,
so we don't free() a stack buffer further down in the common path.
Bug found using scan-build.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Don't allocate the compressor structure twice.
Bug found using scan-build.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This commit broadly does the following things:
- Rename and move the sparse mapping structure to libutil
- Add a function to the data writer for writing condensed versions
of sparse files, given the mapping.
- This shares code with the already existing function for regular
files. The shared code is moved to a common helper function.
- Add support to tar2sqfs for repacking sparse files.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This commit adds support for packing sparse files into squashfs images
as follows:
- In the data writer: simply detect zero blocks and write a zero to the
block size field and don't emit any data. Record the number of bytes
saved this way. For fragments, set the fragment offset to invalid.
- In the inode writer: write out the number of bytes saved for sparse
files. If there should be a fragment but there is none, append a block
count of 0.
- In the data reader: if the block size is 0, read nothing from disk and
emit an empty block. Do the same if the fragment is missing.
- In the inode reader: restore the number of bytes saved for sparse files.
The sparse files can be packed and unpacked, but the unpacking will not
create sparse files for now.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
The sparse attribute should be initialized with 0. It is subtracted
from the file size in the kernel to determine the file size on disk
to report to stat(2). So it actually didn't matter anyway (just for
correctness sake).
Second, the fragment index and offset should be set to 0xFFFFFFFF in
the rare case that no fragments exist.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This IMO makes it somewhat easier to read and understand what's going on.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Instead of decomposing a default string in gensquashfs option processing,
move that to fstree_init instead and pass the option string directly to
fstree_init.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This commit removes handling of compressor names from gensquashfs. Instead,
functions are added to libcompress to obtain name from ID, ID from name
and to print out defaults.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
This commit removes the packdir/packfile based directory setup magic
from fstree_from_file and moves it to gensquashfs. Over there, the
common parts are deduplicated.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|
|
Make tree node list sort and recursive variant available and independend
of the fstree_t.
This is considered cleaner, since the fstree_t actually isn't needed for
any of this and we can just call the recusvie sort on the root instead,
and we can use the sort implementation directly for things like the
upcoming unit test.
Also this commit splits up the merge/sort implementation into a seperate
split and merge functions to make the code somewhat more readable.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
|