Jimmy's weblog


Dirty dirvish hack to use “localhost” as client option

Filed under: — jimmy @ 11:03 am

When using dirvish you usually have to use the local hostname for the client option in default.conf. In other words, the output of the command “hostname”. If it’s different than the client option than dirvish assumes that it’s a remote transfer and uses ssh to connect. So you can not use “localhost” which would be rather straightforward ;-(
Lately I needed dirvish on a sytem with heartbeat where two systems share one configuration but have different hostnames. Because I was so angry about this IMO stupid check with “hostname” I made a dirty hack…
Line 258 in /usr/sbin/dirvish looks like this:

chomp($$Options{Server} = `hostname`);

I changed it to:

chomp($$Options{Server} = localhost);

This way dirvish assumes localhost as local tranfer and everything else as remote. The check itself can be found in line 520.
Remember, this hack is really evil. There are several better ways to solve the problem.