#3608 PR open: Fix lftp command to pass options prior to opening the URL¶
Labels: enhancement
rmetrich opened issue at 2026-05-20 08:25:¶
Relax-and-Recover (ReaR) Pull Request Template¶
Please fill in the following items before submitting a new pull request:
Pull Request Details:¶
-
Type: Bug Fix
-
Impact: High
-
Description of the changes in this pull request:
The lftp command needs to apply the user specified options prior to
opening the URL, otherwise the options won't apply for the opening
itself.
This is problematic when users use a custom program to connect, e.g.
OUTPUT_LFTP_OPTIONS=( "set sftp:connect-program 'ssh -i /etc/rear/mykey'" )
The issue was introduced by commit c4ddb00f1f9eba7b036a6a54788080f2197badde.
codacy-production commented at 2026-05-20 08:26:¶
Up to standards ✅¶
🟢 Issues 0 issues
> > > **Results:** > `0` new issues > > [View in > Codacy](https://app.codacy.com/gh/rear/rear/pull-requests/3608/issues) >
NEW Get contextual insights on your PRs based on Codacy's
metrics, along with PR and Jira context, without leaving GitHub. Enable
AI
reviewer
TIP This summary will be updated as you push new changes.
gdha commented at 2026-05-20 09:13:¶
@rmetrich what I normally use is:
# When you connect to sa-borg (non-root) user from root, then ~/.lftprc should contain:
# set sftp:connect-program "ssh -a -x -i /root/.ssh/id_sa-borg"
COPY_AS_IS+=( /root/.lftprc )
rmetrich commented at 2026-05-20 09:15:¶
@rmetrich what I normally use is:
# When you connect to sa-borg (non-root) user from root, then ~/.lftprc should contain: # set sftp:connect-program "ssh -a -x -i /root/.ssh/id_sa-borg" COPY_AS_IS+=( /root/.lftprc )
To avoid any confusion, the set sftp:connect-program command is just
an example to highlight the issue.
Our customer use other settings.
pcahyna commented at 2026-05-20 15:09:¶
The lftp command needs to apply the user specified options prior to opening the URL, otherwise the options won't apply for the opening itself. This is problematic when users use a custom program to connect, e.g.
OUTPUT_LFTP_OPTIONS=( "set sftp:connect-program 'ssh -i /etc/rear/mykey'" )The issue was introduced by commit c4ddb00.
My understanding is that the issue was already present before that
commit in the if contains_visible_char "$OUTPUT_LFTP_USERNAME" branch:
and the commit merely introduced the problem to the other branch as well by unifying them.
Not that it matters much, because the problem got introduced by the
immediately preceding commit in the same PR:
https://github.com/rear/rear/commit/498915c93f3f7bbe5923902e25c83855f45e0c55#diff-f567f242564ffbcefdb83e70b007e4e1b9fee123ec41e969fe49fc355fe23ec0L127-L128
So, I would say instead that the problem was introduced by PR https://github.com/rear/rear/pull/2991 but that's just a nitpick.
pcahyna commented at 2026-05-27 09:28:¶
Hi @rmetrich , thank you for your PR and fixes. The changes look good now. But I looked at the original PR https://github.com/rear/rear/pull/2991 that introduced the bug and noted that it introduces more problems (see my review comments on it). I plan to add fixes for the other regressions. If I don't get around to it soon (let's say by Monday), I will merge the PR and open a new one. In the meantime, other contributors can have a look.
rmetrich commented at 2026-05-27 09:50:¶
Hi @pcahyna, feel free to fix more issues, I won't unfortunately have much time these next days.
[Export of Github issue for rear/rear.]