Bug 978

Summary: The supplied realpath function mangles pathnames.
Product: Portable OpenSSH Reporter: Paul Green <Paul.Green>
Component: MiscellaneousAssignee: OpenSSH Bugzilla mailing list <openssh-bugs>
Status: CLOSED WORKSFORME    
Severity: minor    
Priority: P3    
Version: 3.7.1p2   
Hardware: Other   
OS: Other   

Description Paul Green 2005-02-03 08:55:23 AEDT
When the realpath function supplied with Portable OpenSSH is used, one quickly 
discovers that it mangles the pathnames.  The code that combines the 'real' 
directory name with the name of the last component has a special-case to 
handle a directory name consisting of only '/'.  Sadly, when it comes time to 
use the 'needslash' variable, the test is backwards.  When it needs a slash, 
it doesn't put one in, and vice versa.  needslash==1 is supposed to mean that 
a slash is needed but the code tests for needslash==0.  I guess I must have 
one of the few operating systems (the Stratus VOS POSIX environment) that 
doesn't supply a working version of realpath, and so rely upon this version.  
I found this bug in 3.7.1p2 but it is still present in 3.9p1.  I've tested the 
fix and it works great.  Found by using PuTTY psftp client get request to a 
system with the broken code; it only worked on files in the root ('/') 
directory; a file in a lower-level directory failed; the echoed pathname was 
always missing the final slash.
Comment 1 Paul Green 2005-02-03 09:00:33 AEDT
Oh heck. I see you fixed this bug in 3.9p1; perhaps even earlier. Sorry for 
the noise.
Comment 2 Damien Miller 2005-02-03 09:32:49 AEDT
The realpath function was recently updates again (after 3.9p1), so you may want
to test one of the development snapshots from
http://www.openssh.com/portable.html#cvs 
Comment 3 Darren Tucker 2005-02-04 14:54:28 AEDT
Please reopen if there is any issues with realpath() in -current.
Comment 4 Darren Tucker 2006-10-07 11:38:37 AEST
Change all RESOLVED bug to CLOSED with the exception of the ones fixed post-4.4.