Skip to content

Commit 81662b7

Browse files
committed
try to adjust install command to enclose the package name in quotes
1 parent f8d1730 commit 81662b7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cf-agent/verify_packages.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -2724,6 +2724,7 @@ static bool ExecuteSchedule(EvalContext *ctx, const PackageManager *schedule, Pa
27242724
Attributes a = GetPackageAttributes(ctx, ppi);
27252725

27262726
const size_t command_len = strlen(command_string);
2727+
const size_t name_len = strlen(pi->name);
27272728
char *offset = command_string + command_len;
27282729

27292730
if ((a.packages.package_file_repositories) && ((action == PACKAGE_ACTION_ADD) || (action == PACKAGE_ACTION_UPDATE)))
@@ -2740,7 +2741,9 @@ static bool ExecuteSchedule(EvalContext *ctx, const PackageManager *schedule, Pa
27402741
}
27412742
else
27422743
{
2743-
strcat(offset, pi->name);
2744+
strcat(offset, "\"");
2745+
strcat(offset+1, pi->name);
2746+
strcat(offset+name_len, "\"");
27442747
}
27452748

27462749
PromiseResult result = PROMISE_RESULT_NOOP;
@@ -2780,6 +2783,7 @@ static bool ExecuteSchedule(EvalContext *ctx, const PackageManager *schedule, Pa
27802783
if (pi->name)
27812784
{
27822785
const size_t command_len = strlen(command_string);
2786+
const size_t name_len = strlen(pi->name);
27832787
char *offset = command_string + command_len;
27842788

27852789
if (a.packages.package_file_repositories &&
@@ -2798,7 +2802,9 @@ static bool ExecuteSchedule(EvalContext *ctx, const PackageManager *schedule, Pa
27982802
}
27992803
else
28002804
{
2801-
strcpy(offset, pi->name);
2805+
strcpy(offset, "\"");
2806+
strcpy(offset+1, pi->name);
2807+
strcpy(offset+name_len, "\"");
28022808
}
28032809

28042810
strcat(command_string, " ");

0 commit comments

Comments
 (0)