Delayed variable expansion for P_PATH/P_STRING is missing (loadparm.c)

Florian Sager sager at
Tue Dec 10 02:28:32 MST 2013


the section "Global Parameters" of the current says:
"You may use references to environment variables in the values of
parameters. String parameters will have %VAR% references expanded as
late as possible (when the string is used in the program), allowing for
the use of variables that rsync sets at connection time, such as
RSYNC_USER_NAME. Non-string parameters (such as true/false settings) are
expanded when read from the config file."

So I configured in the config file ($USER is set in the environment):
path = /home/%USER%/test

At execution time an error occurs:
rsync: chroot /home/%USER%/test failed: No such file or directory (2)

That means the config parameter expansion did not work at runtime.

In loadparm.c line 668 there is a special handling of P_PATH/P_STRING
    /* now switch on the type of variable it is */
    switch (parm_table[parmnum].type) {
    case P_PATH:
    case P_STRING:
        /* delay expansion of vars */
        /* expand any %VARS% now */
        parmvalue = expand_vars(parmvalue);

This handling delays the expansion of $USER in the path parameters. I
removed the special handling as a workaround: with this change the
expansion is done and my configuration works well.

Does anybody know how to force the "delayed expansion"?
I didn't find the delayed expansion handling somewhere in the source code.

BTW: I checked
but didn't find anything related.



Agitos Webhosting
Florian Sager
Emil-Geis-Straße 40, 81379 München, GERMANY

More information about the rsync mailing list