Bug 825538

Summary: sftp: remote directory always prepended to relative symbolic links
Product: [Fedora] Fedora Reporter: Enrico Scholz <rh-bugzilla>
Component: opensshAssignee: Petr Lautrbach <plautrba>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 20CC: jjelen, mattias.ellert, mgrepl, plautrba, spamfaenger, tmraz
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openssh-6.4p1-8.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-03 07:02:40 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
Dist git patch to backport fix from upstream to f20 none

Description Enrico Scholz 2012-05-27 11:44:17 EDT
Description of problem:

It is impossible to create relative symbolic links with recent 'sftp' utilities because the remote path will always be prepended:

----
$ sftp `hostname`
sftp> symlink foo0 /tmp/foo
debug3: Sent message SSH2_FXP_SYMLINK "/home/ensc/foo0" -> "/tmp/foo"

sftp> symlink ../bar /tmp/bar
debug3: Sent message SSH2_FXP_SYMLINK "/home/ensc/../bar" -> "/tmp/bar"

$ ls -l /tmp/foo /tmp/bar
lrwxrwxrwx. 1 ensc ensc 17 27. Mai 17:37 /tmp/bar -> /home/ensc/../bar
lrwxrwxrwx. 1 ensc ensc 14 27. Mai 17:37 /tmp/foo -> /home/ensc/foo0
----

Working symbolic links are critical because they do not depend on how filesystems are mounted.

The 'symlink' implementations of RHEL6 (openssh-5.3p1-70.el6_2.2.x86_64) and RHEL5 are creating relative links.


Version-Release number of selected component (if applicable):

openssh-clients-5.8p2-25.fc16.x86_64
Comment 1 Fedora End Of Life 2013-01-16 12:02:15 EST
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '16'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 is end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" and open it against that version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 2 Enrico Scholz 2013-01-16 17:23:51 EST
still with openssh-5.9p1-28.fc17.x86_64
Comment 3 Fedora End Of Life 2013-07-03 22:42:04 EDT
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 4 Fedora End Of Life 2013-08-01 05:12:52 EDT
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 5 Enrico Scholz 2014-02-01 20:44:38 EST
reopening; still with openssh-6.4p1-3.fc20.x86_64
Comment 6 Jakub Jelen 2015-01-09 10:45:07 EST
I tried your use case and it works for me now on current F-21 release:
openssh-6.6.1p1-9.fc21.x86_64


[root@localhost ~]# sftp localhost
Connected to localhost.
sftp> symlink foo0 /tmp/foo
sftp> symlink ../bar /tmp/bar
sftp> ^D
[root@localhost ~]# 
[root@localhost ~]# ls -l /tmp/foo /tmp/bar
lrwxrwxrwx. 1 root root 6 Jan  9 16:16 /tmp/bar -> ../bar
lrwxrwxrwx. 1 root root 4 Jan  9 16:16 /tmp/foo -> foo0


But still doesn't work on current F-20:
openssh-6.4p1-7.fc20.x86_64

This problem should be pretty easy to fix with patch from bz1084079. This fix was introduced into upstream in version 6.5 [1]

[1] https://anongit.mindrot.org/openssh.git/commit/?id=034f27a0c09e69fe3589045b41f03f6e345b63f5
Comment 7 Jakub Jelen 2015-01-09 11:17:25 EST
Created attachment 978264 [details]
Dist git patch to backport fix from upstream to f20
Comment 8 Petr Lautrbach 2015-01-09 11:23:40 EST
I've pushed it to dist git. It will be in the next update. Thanks Jakub!
Comment 9 Fedora Update System 2015-01-15 10:03:34 EST
openssh-6.4p1-8.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/openssh-6.4p1-8.fc20
Comment 10 Fedora Update System 2015-01-17 00:40:10 EST
Package openssh-6.4p1-8.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing openssh-6.4p1-8.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-0756/openssh-6.4p1-8.fc20
then log in and leave karma (feedback).
Comment 11 Fedora Update System 2015-02-03 07:02:40 EST
openssh-6.4p1-8.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.