diff options
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | bin/gensquashfs/mkfs.c | 31 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | doc/format.adoc | 2 | ||||
-rw-r--r-- | include/util/rbtree.h | 4 |
5 files changed, 30 insertions, 15 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c2cd8c4..a499d92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.1] - 2024-05-02 +### Fixed + - gensquashfs: apply xattr file also when using a pack file (#122) + - Fix broken C++ guard in rbtree.h + - fixed fragment table size typo (#126) + ## [1.3.0] - 2024-03-11 ### Added - rdsquashfs: improve unpacking error message on Windows diff --git a/bin/gensquashfs/mkfs.c b/bin/gensquashfs/mkfs.c index 171a887..1dc3fd6 100644 --- a/bin/gensquashfs/mkfs.c +++ b/bin/gensquashfs/mkfs.c @@ -70,7 +70,8 @@ static int pack_files(sqfs_block_processor_t *data, fstree_t *fs, } static int relabel_tree_dfs(const char *filename, sqfs_xattr_writer_t *xwr, - tree_node_t *n, void *selinux_handle) + tree_node_t *n, void *selinux_handle, + void *xattrmap) { char *path = fstree_get_path(n); int ret; @@ -86,24 +87,28 @@ static int relabel_tree_dfs(const char *filename, sqfs_xattr_writer_t *xwr, return -1; } - if (selinux_relable_node(selinux_handle, xwr, n, path)) { - free(path); - return -1; - } + if (xattrmap != NULL) + ret = xattr_apply_map_file(path, xattrmap, xwr); + + if (ret == 0 && selinux_handle != NULL) + ret = selinux_relable_node(selinux_handle, xwr, n, path); + + free(path); + if (ret == 0) + ret = sqfs_xattr_writer_end(xwr, &n->xattr_idx); - ret = sqfs_xattr_writer_end(xwr, &n->xattr_idx); if (ret) { sqfs_perror(filename, "flushing completed key-value pairs", ret); return -1; } - free(path); - if (S_ISDIR(n->mode)) { for (n = n->data.dir.children; n != NULL; n = n->next) { - if (relabel_tree_dfs(filename, xwr, n, selinux_handle)) + if (relabel_tree_dfs(filename, xwr, n, + selinux_handle, xattrmap)) { return -1; + } } } @@ -111,15 +116,15 @@ static int relabel_tree_dfs(const char *filename, sqfs_xattr_writer_t *xwr, } static int read_fstree(fstree_t *fs, options_t *opt, sqfs_xattr_writer_t *xwr, - void *selinux_handle) + void *selinux_handle, void *xattrmap) { int ret; ret = fstree_from_file(fs, opt->infile, opt->packdir); - if (ret == 0 && selinux_handle != NULL) + if (ret == 0 && (selinux_handle != NULL || xattrmap != NULL)) ret = relabel_tree_dfs(opt->cfg.filename, xwr, - fs->root, selinux_handle); + fs->root, selinux_handle, xattrmap); return ret; } @@ -175,7 +180,7 @@ int main(int argc, char **argv) goto out; } } else { - if (read_fstree(&sqfs.fs, &opt, sqfs.xwr, sehnd)) + if (read_fstree(&sqfs.fs, &opt, sqfs.xwr, sehnd, xattrmap)) goto out; } diff --git a/configure.ac b/configure.ac index 1cbea64..116735c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.69]) -AC_INIT([squashfs-tools-ng],[1.3.0],[goliath@infraroot.at],[squashfs-tools-ng]) +AC_INIT([squashfs-tools-ng],[1.3.1],[goliath@infraroot.at],[squashfs-tools-ng]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign dist-xz subdir-objects]) AM_SILENT_RULES([yes]) diff --git a/doc/format.adoc b/doc/format.adoc index e3b2e0d..f26bf8a 100644 --- a/doc/format.adoc +++ b/doc/format.adoc @@ -908,7 +908,7 @@ The fragment table location in the superblock points to an array of 64 bit integers that store the on-disk locations of the metadata blocks containing the lookup table. -Each metadata block can store up to 512 entries (`8129 / 16`). +Each metadata block can store up to 512 entries (`8192 / 16`). The "unused" field is there for alignment and *SHOULD* be set to 0, however the Linux kernel currently ignores this field completely, making it impossible for diff --git a/include/util/rbtree.h b/include/util/rbtree.h index aac175b..07f2ce9 100644 --- a/include/util/rbtree.h +++ b/include/util/rbtree.h @@ -52,6 +52,10 @@ static SQFS_INLINE void *rbtree_node_value(rbtree_node_t *n) return n->data + n->value_offset; } +#ifdef __cplusplus +extern "C" { +#endif + SQFS_INTERNAL int rbtree_init(rbtree_t *tree, size_t keysize, size_t valuesize, int(*key_compare)(const void *, const void *, const void *)); |