Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maurerdietmar
Copy link
Contributor

Exclude files matching patterns listed in FILE.

Signed-off-by: Dietmar Maurer dietmar@proxmox.com

Exclude files matching patterns listed in FILE.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Copy link
Member

@poettering poettering left a 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing OOM check.

Copy link
Member

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.

@poettering
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants