Delayed variable expansion for P_PATH/P_STRING is missing (loadparm.c)
Florian Sager
sager at agitos.de
Tue Dec 10 02:28:32 MST 2013
Hi,
the section "Global Parameters" of the current
http://rsync.samba.org/ftp/rsync/rsyncd.conf.html 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
parameters:
>>>
/* now switch on the type of variable it is */
switch (parm_table[parmnum].type) {
case P_PATH:
case P_STRING:
/* delay expansion of vars */
break;
default:
/* expand any %VARS% now */
parmvalue = expand_vars(parmvalue);
break;
}
<<<
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
https://bugzilla.samba.org/buglist.cgi?query_format=specific&order=relevance+desc&bug_status=__all__&product=rsync
but didn't find anything related.
Cheers,
Florian
===
Agitos Webhosting
Florian Sager
Emil-Geis-Straße 40, 81379 München, GERMANY
More information about the rsync
mailing list