Echo statement in .bashrc causing failure


i put this in my .bashrc

echo 'cylc version is...' $CYLC_VERSION

… and it’s causing all tasks to fail…

[FAIL] maui02:/scale_wlg_nobackup/filesets/nobackup/niwa00013/williamsjh/cylc-run/u-cy574/run22/work/19500101T0000Z/fcm_make_drivers/cylc version is 8.1.4
[FAIL] /scale_wlg_persistent/filesets/home/williamsjh/cylc-run/u-cy574/run22/share/fcm_make_drivers <- /home/williamsjh/cylc-run/u-cy574/run22/share/fcm_make_drivers/extract: mirror failed
[FAIL] rsync -a --exclude=.* --delete-excluded --timeout=900 --rsh=ssh\ -oBatchMode=yes /home/williamsjh/cylc-run/u-cy574/run22/share/fcm_make_drivers/extract maui02:/scale_wlg_nobackup/filesets/nobackup/niwa00013/williamsjh/cylc-run/u-cy574/run22/work/19500101T0000Z/fcm_make_drivers/cylc\ version\ is\ 8.1.4\
[FAIL] /scale_wlg_persistent/filesets/home/williamsjh/cylc-run/u-cy574/run22/share/fcm_make_drivers # rc=2
[FAIL] protocol version mismatch -- is your shell clean?
[FAIL] (see the rsync man page for an explanation)
[FAIL] rsync error: protocol incompatibility (code 2) at compat.c(174) [sender=3.0.9]

is there way to fix this or to get the cylc version at login a different way?



Hi @jonnyhtw

That error is coming from rsync, in this case called by one of your task scripts, not by Cylc itself.

Login scripts should not generate output in non-interactive shells because it can mess with programs like rsync.

From man rsync:

rsync occasionally produces error messages that may seem a little cryptic. The one that
seems to cause the most confusion is “protocol version mismatch – is your shell clean?”.

This message is usually caused by your startup scripts or remote shell facility producing
unwanted garbage on the stream that rsync is using for its transport. The way to diagnose
this problem is to run your remote shell like this:

       ssh remotehost /bin/true > out.dat

then look at out.dat. If everything is working correctly then out.dat should be a zero
length file. If you are getting the above error from rsync then you will probably find that
out.dat contains some text or data. Look at the contents and try to work out what is produc‐
ing it. The most common cause is incorrectly configured shell startup scripts (such as
.cshrc or .profile) that contain output statements for non-interactive logins.

If you really want to print stuff from your .bashrc, wrap the output-generating code in a test for interactive shell.

1 Like

ok cool, thanks for that. i don’t think i’ve come across this type of error before but that all makes sense. thanks!