diff options
author | rm88369 <none@none> | 2006-09-27 05:14:58 -0700 |
---|---|---|
committer | rm88369 <none@none> | 2006-09-27 05:14:58 -0700 |
commit | 9c84d166d34399061330ff651f11e12622bc0700 (patch) | |
tree | 11abbc36b662c5429359254b4ed4eab9b4d9ed2c /usr/src | |
parent | c40f76e346ad844b9326c2049644b7b1d1a93e48 (diff) | |
download | illumos-joyent-9c84d166d34399061330ff651f11e12622bc0700.tar.gz |
6408879 /usr/bin/bart create not including all files in manifest for multiple subtrees in a block
6408957 global rules for /usr/bin/bart not working properly
6408975 adding excluding pattern to rules file for /usr/bin/bart has unexpected side-effects
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/bart/bart.h | 8 | ||||
-rw-r--r-- | usr/src/cmd/bart/create.c | 26 | ||||
-rw-r--r-- | usr/src/cmd/bart/rules.c | 15 |
3 files changed, 15 insertions, 34 deletions
diff --git a/usr/src/cmd/bart/bart.h b/usr/src/cmd/bart/bart.h index f84f6b681f..517562a129 100644 --- a/usr/src/cmd/bart/bart.h +++ b/usr/src/cmd/bart/bart.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -137,7 +136,6 @@ struct rule { struct tree_modifier *modifiers; struct rule *next; struct rule *prev; - boolean_t traversed; }; struct dir_component { diff --git a/usr/src/cmd/bart/create.c b/usr/src/cmd/bart/create.c index dccfa3795b..529b625033 100644 --- a/usr/src/cmd/bart/create.c +++ b/usr/src/cmd/bart/create.c @@ -242,16 +242,6 @@ create_manifest_rule(char *reloc_root, FILE *rule_fp) root = get_next_subtree(root)) { /* - * This subtree has already been traversed by a - * previous stanza, i.e. this rule is a subset of a - * previous rule. - * - * Subtree has already been handled so move on! - */ - if (root->traversed) - continue; - - /* * Check to see if this subtree should have contents * checking turned on or off. * @@ -273,7 +263,6 @@ create_manifest_rule(char *reloc_root, FILE *rule_fp) */ subtree_root = root; (void) nftw64(root->subtree, &walker, 20, FTW_PHYS); - root->traversed = B_TRUE; /* * Ugly but necessary: @@ -340,7 +329,7 @@ output_manifest(void) * Also, make sure the output is unique, since a given file may be * included by several stanzas. */ - if (execle("/usr/bin/sort", "sort", NULL, env) < 0) { + if (execle("/usr/bin/sort", "sort", "-u", NULL, env) < 0) { perror(""); exit(FATAL_EXIT); } @@ -375,19 +364,6 @@ walker(const char *name, const struct stat64 *sp, int type, struct FTW *ftwx) case FTW_NS: /* unstatable file */ break; case FTW_D: /* enter directory */ - - /* - * Check to see if any subsequent rules are a subset - * of this rule; if they are, then mark them as - * "traversed". - */ - rule = subtree_root->next; - while (rule != NULL) { - if (strcmp(name, rule->subtree) == 0) - rule->traversed = B_TRUE; - - rule = rule->next; - } dir_flag = B_TRUE; ret = statvfs(name, &path_vfs); if (ret < 0) diff --git a/usr/src/cmd/bart/rules.c b/usr/src/cmd/bart/rules.c index 363a69381c..537fb8afbb 100644 --- a/usr/src/cmd/bart/rules.c +++ b/usr/src/cmd/bart/rules.c @@ -94,7 +94,10 @@ exclude_fname(const char *fname, char fname_type, struct rule *rule_ptr) * FILES and the entry is a directory, its excluded! */ if (fname_type == 'D') { - ret_val = 1; + if (mod_ptr->include == B_FALSE) + ret_val = 0; + else + ret_val = 1; break; } @@ -356,7 +359,6 @@ gen_rulestruct(void) struct rule *new_rule; new_rule = (struct rule *)safe_calloc(sizeof (struct rule)); - new_rule->traversed = B_FALSE; return (new_rule); } @@ -418,6 +420,7 @@ read_rules(FILE *file, char *reloc_root, uint_t in_flags, int create) struct rule *block_begin = NULL, *new_rule, *rp; struct attr_keyword *akp; int check_flag, ignore_flag, syntax_err, ret_code; + int global_block; ret_code = EXIT; @@ -425,6 +428,7 @@ read_rules(FILE *file, char *reloc_root, uint_t in_flags, int create) check_flag = 0; ignore_flag = 0; syntax_err = 0; + global_block = 1; if (file == NULL) { (void) setup_default_rule(reloc_root, in_flags); @@ -454,6 +458,9 @@ read_rules(FILE *file, char *reloc_root, uint_t in_flags, int create) * subtrees. */ if (s[0] == '/') { + /* subtree definition hence not a global block */ + global_block = 0; + new_rule = add_subtree_rule(s, reloc_root, create, &ret_code); @@ -496,14 +503,14 @@ read_rules(FILE *file, char *reloc_root, uint_t in_flags, int create) /* * For all the flags, check if this is a global - * IGNORE/CHECK. If so, set the global flag. + * IGNORE/CHECK. If so, set the global flags. * * NOTE: The only time you can have a * global ignore is when its the * stmt before any blocks have been * spec'd. */ - if (block_begin == NULL) { + if (global_block) { if (check_kw) in_flags |= akp->ak_flags; else |