Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
b328f7f7
Commit
b328f7f7
authored
Dec 14, 2021
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
param: Add a %D expansion to cc_command
And slightly polish the cc_command description.
parent
60181878
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
mgt_vcc.c
bin/varnishd/mgt/mgt_vcc.c
+15
-3
c00109.vtc
bin/varnishtest/tests/c00109.vtc
+2
-2
params.h
include/tbl/params.h
+16
-6
No files found.
bin/varnishd/mgt/mgt_vcc.c
View file @
b328f7f7
...
...
@@ -128,7 +128,7 @@ run_vcc(void *priv)
* Expand the cc_command argument
*/
static
void
static
const
char
*
cc_expand
(
struct
vsb
*
sb
,
const
char
*
cc_cmd
,
char
exp
)
{
const
char
*
p
;
...
...
@@ -136,7 +136,7 @@ cc_expand(struct vsb *sb, const char *cc_cmd, char exp)
AN
(
sb
);
AN
(
cc_cmd
);
(
void
)
exp
;
for
(
p
=
cc_cmd
,
pct
=
0
;
*
p
;
++
p
)
{
if
(
pct
)
{
switch
(
*
p
)
{
...
...
@@ -152,6 +152,11 @@ cc_expand(struct vsb *sb, const char *cc_cmd, char exp)
case
'd'
:
VSB_cat
(
sb
,
mgt_cc_cmd_def
);
break
;
case
'D'
:
if
(
exp
==
pct
)
return
(
"recursive expansion"
);
cc_expand
(
sb
,
mgt_cc_cmd_def
,
pct
);
break
;
case
'%'
:
VSB_putc
(
sb
,
'%'
);
break
;
...
...
@@ -169,6 +174,7 @@ cc_expand(struct vsb *sb, const char *cc_cmd, char exp)
}
if
(
pct
)
VSB_putc
(
sb
,
'%'
);
return
(
NULL
);
}
/*--------------------------------------------------------------------
...
...
@@ -180,6 +186,7 @@ run_cc(void *priv)
{
struct
vcc_priv
*
vp
;
struct
vsb
*
sb
;
const
char
*
err
;
VJ_subproc
(
JAIL_SUBPROC_CC
);
CAST_OBJ_NOTNULL
(
vp
,
priv
,
VCC_PRIV_MAGIC
);
...
...
@@ -188,7 +195,12 @@ run_cc(void *priv)
sb
=
VSB_new_auto
();
AN
(
sb
);
cc_expand
(
sb
,
mgt_cc_cmd
,
'\0'
);
err
=
cc_expand
(
sb
,
mgt_cc_cmd
,
'\0'
);
if
(
err
!=
NULL
)
{
VSB_destroy
(
&
sb
);
fprintf
(
stderr
,
"cc_command: %s
\n
"
,
err
);
exit
(
1
);
}
AZ
(
VSB_finish
(
sb
));
(
void
)
umask
(
027
);
...
...
bin/varnishtest/tests/c00109.vtc
View file @
b328f7f7
...
...
@@ -3,9 +3,9 @@ varnishtest "cc_command and cc_warnings"
varnish v1 -cliok {param.set debug +vcl_keep}
varnish v1 -cliok {param.set cc_warnings hello}
varnish v1 -cliok {param.set cc_command << EOF
! printf 'd="%%s"
w="%%s"' '%d
' '%w' >world
! printf 'd="%%s"
D="%%s" w="%%s"' '%d' '%D
' '%w' >world
EOF}
varnish v1 -errvcl "VCL compilation failed" "backend be none;"
shell -match {d=".+" w="hello"} "cat v1/vcl_*/world"
shell -match {d=".+"
D=".+hello.+"
w="hello"} "cat v1/vcl_*/world"
include/tbl/params.h
View file @
b328f7f7
...
...
@@ -1530,12 +1530,22 @@ PARAM_STRING(
/* priv */
&
mgt_cc_cmd
,
/* def */
VCC_CC
,
/* descr */
"Command used for compiling the C source code to a "
"dlopen(3) loadable object. Any occurrence of %s in "
"the string will be replaced with the source file name, "
"%o will be replaced with the output file name, and %w "
"will be replaced by the cc_warnings parameter. The %d "
"sequence expands to the default value for cc_command."
,
"The command used for compiling the C source code to a "
"dlopen(3) loadable object. The following expansions can "
"be used:
\n\n
"
"- %s: the source file name
\n
"
"- %o: the output file name
\n
"
"- %w: the cc_warnings parameter
\n
"
"- %d: the raw default cc_command
\n
"
"- %D: the expanded default cc_command
\n
"
"- %%: a percent sign
\n
"
"
\n
"
"Unknown percent expansion sequences are ignored, and to "
"avoid future incompatibilities percent characters should "
"be escaped with a double percent sequence.
\n\n
"
"The %d and %D expansions allow passing the parameter's "
"default value to a wrapper script to perform additional "
"processing."
,
/* flags */
MUST_RELOAD
|
BUILD_OPTIONS
,
/* dyn_min_reason */
NULL
,
/* dyn_max_reason */
NULL
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment