Florian Sager
2013-Dec-10 09:28 UTC
Delayed variable expansion for P_PATH/P_STRING is missing (loadparm.c)
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
Wayne Davison
2013-Dec-23 19:05 UTC
Delayed variable expansion for P_PATH/P_STRING is missing (loadparm.c)
On Tue, Dec 10, 2013 at 1:28 AM, Florian Sager <sager at agitos.de> wrote:> So I configured in the config file ($USER is set in the environment): > >>> > path = /home/%USER%/test > <<< >$USER has to be set in the daemon's environment. If it is set, it will be substituted. If it is not set, rsync leaves it unchanged. Since it worked fine in my testing, I'd imagine that whatever is starting your daemon process is not setting USER. ..wayne.. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20131223/642808ca/attachment.html>