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
ea1aa68f
Commit
ea1aa68f
authored
Dec 14, 2021
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
param: Add a %n expansion to cc_command
parent
b328f7f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
mgt_vcc.c
bin/varnishd/mgt/mgt_vcc.c
+8
-2
c00109.vtc
bin/varnishtest/tests/c00109.vtc
+4
-2
params.h
include/tbl/params.h
+1
-0
No files found.
bin/varnishd/mgt/mgt_vcc.c
View file @
ea1aa68f
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include "config.h"
#include "config.h"
#include <limits.h>
#include <fcntl.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -131,6 +132,7 @@ run_vcc(void *priv)
...
@@ -131,6 +132,7 @@ run_vcc(void *priv)
static
const
char
*
static
const
char
*
cc_expand
(
struct
vsb
*
sb
,
const
char
*
cc_cmd
,
char
exp
)
cc_expand
(
struct
vsb
*
sb
,
const
char
*
cc_cmd
,
char
exp
)
{
{
char
buf
[
PATH_MAX
];
const
char
*
p
;
const
char
*
p
;
int
pct
;
int
pct
;
...
@@ -157,6 +159,10 @@ cc_expand(struct vsb *sb, const char *cc_cmd, char exp)
...
@@ -157,6 +159,10 @@ cc_expand(struct vsb *sb, const char *cc_cmd, char exp)
return
(
"recursive expansion"
);
return
(
"recursive expansion"
);
cc_expand
(
sb
,
mgt_cc_cmd_def
,
pct
);
cc_expand
(
sb
,
mgt_cc_cmd_def
,
pct
);
break
;
break
;
case
'n'
:
AN
(
getcwd
(
buf
,
sizeof
buf
));
VSB_cat
(
sb
,
buf
);
break
;
case
'%'
:
case
'%'
:
VSB_putc
(
sb
,
'%'
);
VSB_putc
(
sb
,
'%'
);
break
;
break
;
...
@@ -191,8 +197,6 @@ run_cc(void *priv)
...
@@ -191,8 +197,6 @@ run_cc(void *priv)
VJ_subproc
(
JAIL_SUBPROC_CC
);
VJ_subproc
(
JAIL_SUBPROC_CC
);
CAST_OBJ_NOTNULL
(
vp
,
priv
,
VCC_PRIV_MAGIC
);
CAST_OBJ_NOTNULL
(
vp
,
priv
,
VCC_PRIV_MAGIC
);
AZ
(
chdir
(
VSB_data
(
vp
->
dir
)));
sb
=
VSB_new_auto
();
sb
=
VSB_new_auto
();
AN
(
sb
);
AN
(
sb
);
err
=
cc_expand
(
sb
,
mgt_cc_cmd
,
'\0'
);
err
=
cc_expand
(
sb
,
mgt_cc_cmd
,
'\0'
);
...
@@ -203,6 +207,8 @@ run_cc(void *priv)
...
@@ -203,6 +207,8 @@ run_cc(void *priv)
}
}
AZ
(
VSB_finish
(
sb
));
AZ
(
VSB_finish
(
sb
));
AZ
(
chdir
(
VSB_data
(
vp
->
dir
)));
(
void
)
umask
(
027
);
(
void
)
umask
(
027
);
(
void
)
execl
(
"/bin/sh"
,
"/bin/sh"
,
"-c"
,
VSB_data
(
sb
),
(
char
*
)
0
);
(
void
)
execl
(
"/bin/sh"
,
"/bin/sh"
,
"-c"
,
VSB_data
(
sb
),
(
char
*
)
0
);
VSB_destroy
(
&
sb
);
// For flexelint
VSB_destroy
(
&
sb
);
// For flexelint
...
...
bin/varnishtest/tests/c00109.vtc
View file @
ea1aa68f
...
@@ -3,9 +3,11 @@ varnishtest "cc_command and cc_warnings"
...
@@ -3,9 +3,11 @@ varnishtest "cc_command and cc_warnings"
varnish v1 -cliok {param.set debug +vcl_keep}
varnish v1 -cliok {param.set debug +vcl_keep}
varnish v1 -cliok {param.set cc_warnings hello}
varnish v1 -cliok {param.set cc_warnings hello}
varnish v1 -cliok {param.set cc_command << EOF
varnish v1 -cliok {param.set cc_command << EOF
! printf 'd="%%s" D="%%s" w="%%s"
' '%d' '%D' '%w
' >world
! printf 'd="%%s" D="%%s" w="%%s"
n="%%s"' '%d' '%D' '%w' '%n
' >world
EOF}
EOF}
varnish v1 -errvcl "VCL compilation failed" "backend be none;"
varnish v1 -errvcl "VCL compilation failed" "backend be none;"
shell -match {d=".+" D=".+hello.+" w="hello"} "cat v1/vcl_*/world"
shell -match {d=".+" D=".+hello.+" w="hello" n="${v1_name}"} {
exec cat v1/vcl_*/world
}
include/tbl/params.h
View file @
ea1aa68f
...
@@ -1538,6 +1538,7 @@ PARAM_STRING(
...
@@ -1538,6 +1538,7 @@ PARAM_STRING(
"- %w: the cc_warnings parameter
\n
"
"- %w: the cc_warnings parameter
\n
"
"- %d: the raw default cc_command
\n
"
"- %d: the raw default cc_command
\n
"
"- %D: the expanded default cc_command
\n
"
"- %D: the expanded default cc_command
\n
"
"- %n: the working directory (-n option)
\n
"
"- %%: a percent sign
\n
"
"- %%: a percent sign
\n
"
"
\n
"
"
\n
"
"Unknown percent expansion sequences are ignored, and to "
"Unknown percent expansion sequences are ignored, and to "
...
...
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