-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new --exclude-from=FILE option #146
base: main
Are you sure you want to change the base?
Conversation
Exclude files matching patterns listed in FILE. Signed-off-by: Dietmar Maurer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review! Looks great, just some minor nitpick!
@@ -521,7 +524,11 @@ static int parse_argv(int argc, char *argv[]) { | |||
arg_exclude_file = r; | |||
break; | |||
|
|||
case ARG_UNDO_IMMUTABLE: | |||
case ARG_EXCLUDE_FROM: | |||
arg_exclude_from = strdup(optarg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing OOM check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why strdup? This now causes a leak when the program exits. I think it should be fine to use the optarg here.
btw, ideally we'd serialize all info we use for putting together an image into the caidx/catar. This means in the long run any additional exclusion lists should probably serialized somehow into both too. That way things become more reproducible, as this means you can validate a tree against a serialization and need no other info. |
@@ -521,7 +524,11 @@ static int parse_argv(int argc, char *argv[]) { | |||
arg_exclude_file = r; | |||
break; | |||
|
|||
case ARG_UNDO_IMMUTABLE: | |||
case ARG_EXCLUDE_FROM: | |||
arg_exclude_from = strdup(optarg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why strdup? This now causes a leak when the program exits. I think it should be fine to use the optarg here.
if (s->direction != CA_SYNC_ENCODE) | ||
return -EINVAL; | ||
|
||
s->exclude_from = strdup(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If s->exclude_from
was previously set, it needs to be freed before reassigning.
A corresponding free at the end is also needed. Prolly where archive_path
is being freed.
Exclude files matching patterns listed in FILE.
Signed-off-by: Dietmar Maurer [email protected]