aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-09-03coverity: fix: potential null-pointer dereferenceDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-03coverity: fix: use-after-free in error pathDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-03Bump coverity scan versionDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-03gensquashfs: fix file path for glob directory scanningDavid Oberhollenzer
If we glob a directory, the generated entries can be added to a virtual sub directory, that does not corespond to the original layout. If we try to use those virtual paths for packing files, it will fail, so we need to remove that prefix to reconstruct the original path. Second, the glob operation allows us to select a sub-directory of the pack-dir. This prefix-path is stripped away when scanning the entries. We need to add it back to get the original, pack-dir relative file paths. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-01gensquashfs: add a test for fstree_from_dir file source pathDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-31gensquashfs: use generic integer parsing helpersDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-31Document decimal integer parsing helpers, add an octal variantDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-18Add an inode fieled to sqfs_dir_entry_tDavid Oberhollenzer
This might be needed externally for things like hard link detection. For the unix implementation, store the actual inode number here. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Add a data reader based sqfs_istream_t implementationDavid Oberhollenzer
To the sqfs_data_reader_t is added, an sqfs_istream_t implementation that internally reads through the data reader. The uses of the data_reader_dump function are removed and the function is subsequently removed from libcommon. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Split recursive directory iteratorDavid Oberhollenzer
The recursive part and the filter part are split up, the recursive iterator wrapper is moved into libsquashfs and the libio iterator is modified to use that internally instead of implementig the recursion step. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Move dir_iterator_t from libio into libsquashfsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Refactor: rename dir_iterator_t to sqfs_dir_iterator_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Implement pen_file_ro method in native dir iteratorsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10libio: dir iterator: merge common code paths for initializationDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10Add documentation to sqfs_dir_entry_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-08-10tar2sqfs: Add option to exclude filesRichard Weinberger
Using --exclude or -E it is now possible to exclude files from the input tar stream. The options can be used multiple times. Signed-off-by: Richard Weinberger <richard@nod.at>
2023-07-10Move sqfs_dir_entry_t code from libio into libsquashfsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-07-03Refactor: rename dir_entry_t to sqfs_dir_entry_tDavid Oberhollenzer
Exact operation performed: git ls-files -z | \ xargs -0 sed -i -e 's/dir_entry_t/sqfs_dir_entry_t/g Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-07-03Refactor: rename sqfs_dir_entry_t to sqfs_dir_node_tDavid Oberhollenzer
Exact operation performed: git ls-files -z | \ xargs -0 sed -i -e 's/sqfs_dir_entry_t/sqfs_dir_node_t/g' Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-07-03Consolidate some of the stray integer parsersDavid Oberhollenzer
There are several ad-hoc int/uint parsers scattered around the code, add a single helper function for that task and replace the multiple instances. A simple white-box test case is added for the utility function. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-23gensquashfs: general cleanup after restructuring the parsing codeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-23gensquashfs: pull usage of line splitting up into fstree_from_fileDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-23gensquashfs: use line split helper in parsing glob argumentsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-23gensquashfs: use line split helpers in parsing sort filesDavid Oberhollenzer
Make use of the helpers in libutil Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-23gensquashfs: split glob filter flags into separate tableDavid Oberhollenzer
Allow spaces between `-type` and the character, look it up from a table instead of having `-type <char>` pairs in the main table. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-21Make trim() helpers from get_line available outsideDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-21Add a helper to libutil for splitting token separated linesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-20Move istream_get_line function to libutilDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-18Fix type flag decoding in win32 seek functionDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-18libsqfs: consistently rename the native file handle functionsDavid Oberhollenzer
Start with a common prefix "sqfs_native_file_*" Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-17Move data writer ostream into libsquashfsDavid Oberhollenzer
It is mainly a very thin wrapper on top of the block processor so far. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-16Cleanup: libsqfs: move the generic stream API to the rest of the I/O codeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-16libsquashfs: merge windows & unix file I/O primitivesDavid Oberhollenzer
By adding additional close/duplicate primitives, the remaining, mostly identical istream/ostream/file code is mostly identical between Windows and Unix and be merged, mostly without stitches. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15libcompat: Add a helper to get/set OS error stateDavid Oberhollenzer
On Unix like OSes, this saves/restores errno, on Windows both errno and GetLastError state are saved/restored. This should make it simpler to preserve that across function calls. Additionally, while tracking down uses of GetLastError, some places where the error code was printed out directly where replaced with instances of w32_perror. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15Cleanup: bring some semblance of structure into compat.hDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15libsquashfs: cleanup the flag situation on istream/ostream functionsDavid Oberhollenzer
- The ostream creation functions already have flag arguments, but make them an sqfs_u32 instead of int. - Add flag arguments to the istream functions, sanitzie and forward them when opening the handle. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15Fix null pointer dereference in tar sqfs_istream_t implementationDavid Oberhollenzer
When dropping the parent iterator, update the state _first_. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15Migrate file istream/ostream from libio to libsquashfsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15libio: split stdin/stdout code from the rest of the file streamsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15Overhaul sqfs_istream_t/sqfs_ostream_t error handlingDavid Oberhollenzer
Report an error number from the implementations, change the users to forward that error number (which also means libtar write header/link now returns an error code) and all subsequent binaries to use sqfs_perror() instead of relying on the function to print an error internally. Also, make sure to preserve errno/GetLastError() in the implementations and print out a stringified error in sqfs_perror() if the error code indicates an I/O error. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15libsquashfs: Add sqfs_open_native_file functionDavid Oberhollenzer
Having a function to interpret the flags and open a native file handle simplifies the istream/ostream/file code which shares that decoding part, particularly on windows where the character set needs to be transformed. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15libsquashfs: Add a get_filename function to sqfs_file_tDavid Oberhollenzer
Similar to the sqfs_istream_t & sqfs_ostream_t interfaces. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15Move sqfs_istream_t & sqfs_ostream_t into libsquashfsDavid Oberhollenzer
For now, only the interfaces and helper functions are moved, the concrete implementations remain in libio. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15Mass rename istream_t/ostream_t with sqfs_ prefixDavid Oberhollenzer
istream_t becomes sqfs_istream_t and ostream_t becomes sqfs_ostream_t Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15libio: replace OSTREAM_OPEN_* flags with SQFS_FILE_OPEN_* flagsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15libio: flip the meaning of the ostream_t sparse flagDavid Oberhollenzer
Instead of "open sparse", make that the default and turn it into a "no sparse" flag. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15libio: remove ostream_append_sparse and fallback implementationDavid Oberhollenzer
Instead of a separate append-sparse function, simply accept NULL as an input for append. For both Unix and Win32, a fallback needs to be implemented. For XFRM, we can just memset the input buffer to zero, same for the libsquashfs data writer. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-15libio: remove single line wrapper functionsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-06-14README.md: fixed trailing ] for url and one typoMarcel Petrick
2023-06-12libio: add open handle functions to istream/ostreamDavid Oberhollenzer
For the backends, this simplifies the code as both paths (open file and open stdio) use the same basic code. Even when merging them only in the backend, it would be done in a similar way. Making the functions public allows other uses as well. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>