cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Last sftp commit may break test 613 and 614

From: James Housley <jim_at_thehousleys.net>
Date: Tue, 10 Jul 2007 22:42:45 -0400

On Jul 10, 2007, at 9:25 PM, Dan Fandrich wrote:

> On Tue, Jul 10, 2007 at 08:26:52PM -0400, James Housley wrote:
>> But usernames can be much longer, 8 or 16 are common max sizes.
>
> Yes, but those longer than (typically) 8 are normally truncated in
> directory
> listings. I tried the latest code and I see what the problem is
> now. The
> libcurl's directory list building code is a bit naive about this
> problem,
> and doesn't truncate anything. The result is a listing that's much
> different
> than, for example, GNU ls -l would produce in the same case.
>
> I suggest that libcurl be modified to produce a listing in exactly the
> same format as some common ftp directory listing format (GNU ls -l
> would be
> the obvious choice) so that libcurl client applications can use the
> same
> parsing routines for sftp as for ftp.

The new version uses a directory listing that matches that of the OS
it is on. For example it is in the exact same format as I see for
"ls -l" on the same host, can't say much about GNU ls. I know it
matches BSD style ls -l

[pied:~/work/curl/tests] housley% uname -a
Darwin pied.int.thehousleys.net 8.10.0 Darwin Kernel Version 8.10.0:
Wed May 23 16:50:59 PDT 2007; root:xnu-792.21.3~1/RELEASE_PPC Power
Macintosh powerpc
[pied:~/work/curl/tests] housley% ../src/curl sftp://
housley:******@localhost/Users/
drwxrwxr-t 9 root admin 306 Dec 27 2006 .
drwxrwxr-t 33 root admin 1224 Jul 10 06:16 ..
-rw-rw-r-- 1 admin admin 6148 Mar 3 2006 .DS_Store
-rw-r--r-- 1 root wheel 0 Mar 20 2005 .localized
drwxr-xr-x 15 admin admin 510 Mar 31 09:47 admin
drwxr-xr-x 18 demo admin 612 Jun 29 09:21 demo
drwxr-xr-x 20 donna staff 680 Jul 1 18:40 donna
drwxr-xr-x 88 housley staff 2992 Jul 10 19:08 housley
drwxrwxrwt 6 root wheel 204 Apr 26 2006 Shared
[pied:~/work/curl/tests] housley% ls -la /Users/
total 8
drwxrwxr-t 9 root admin 306 Dec 27 2006 ./
drwxrwxr-t 33 root admin 1224 Jul 10 06:16 ../
-rw-rw-r-- 1 admin admin 6148 Mar 3 2006 .DS_Store
-rw-r--r-- 1 root wheel 0 Mar 20 2005 .localized
drwxrwxrwt 6 root wheel 204 Apr 26 2006 Shared/
drwxr-xr-x 15 admin admin 510 Mar 31 09:47 admin/
drwxr-xr-x 18 demo admin 612 Jun 29 09:21 demo/
drwxr-xr-x 20 donna staff 680 Jul 1 18:40 donna/
drwxr-xr-x 88 housley staff 2992 Jul 10 19:08 housley/

[pied:~/work/curl/tests] housley% ../src/curl sftp://
housley:jeh3545_at_cat/usr/
drwxr-xr-x 21 root wheel 512 May 27 12:31 .
drwxr-xr-x 22 root wheel 512 May 24 15:21 ..
lrwxr-xr-x 1 root wheel 10 May 27 12:31 X11R6 -> /usr/
local
drwxr-xr-x 2 root wheel 10240 May 24 15:31 bin
drwxr-xr-x 2 root wheel 512 May 11 2002 compat
drwxr-xr-x 3 root wheel 1024 May 24 15:24 games
drwxr-xr-x 28 root wheel 1024 Apr 13 2006 home
drwxr-xr-x 47 root wheel 4608 May 24 15:22 include
drwxr-xr-x 4 root wheel 9728 May 24 15:31 lib
drwxr-xr-x 9 root wheel 512 Oct 17 2001 libdata
drwxr-xr-x 7 root wheel 1536 May 24 15:31 libexec
drwxr-xr-x 23 root wheel 512 Apr 23 11:41 local
drwx------ 3 root wheel 512 Jun 2 2006 obj
drwxr-xr-x 22 root wheel 1024 May 24 07:15 src
drwxr-xr-x 58 root wheel 1536 Jul 9 16:54 ports
drwxr-xr-x 2 root wheel 6144 May 24 15:31 sbin
drwxr-xr-x 29 root wheel 512 Jul 6 2005 share
drwxr-xr-x 3 root wheel 512 Apr 15 2004 sup
drwxr-xr-x 28 root wheel 512 May 26 21:02 var
drwxr-xr-x 13 root wheel 512 Mar 10 2006 FREEBSD_CVS
lrwx------ 1 root wheel 12 May 11 2002 tmp -> /usr/
var/tmp
drwxrwx--- 2 root operator 512 Mar 11 2006 .snap
drwxr-xr-x 11 root wheel 512 May 20 2003 X11R6-hold
[pied:~/work/curl/tests] housley% ssh cat uname -a
FreeBSD cat.int.thehousleys.net 6.2-RELEASE-p5 FreeBSD 6.2-RELEASE-p5
#22: Thu May 24 11:09:27 EDT 2007 root_at_cat.int.thehousleys.net:/
usr/obj/usr/src/sys/SERVERKERNEL i386
[pied:~/work/curl/tests] housley% ssh cat ls -la /usr
total 65
drwxr-xr-x 21 root wheel 512 May 27 12:31 .
drwxr-xr-x 22 root wheel 512 May 24 15:21 ..
drwxrwx--- 2 root operator 512 Mar 11 2006 .snap
drwxr-xr-x 13 root wheel 512 Mar 10 2006 FREEBSD_CVS
lrwxr-xr-x 1 root wheel 10 May 27 12:31 X11R6 -> /usr/local
drwxr-xr-x 11 root wheel 512 May 20 2003 X11R6-hold
drwxr-xr-x 2 root wheel 10240 May 24 15:31 bin
drwxr-xr-x 2 root wheel 512 May 11 2002 compat
drwxr-xr-x 3 root wheel 1024 May 24 15:24 games
drwxr-xr-x 28 root wheel 1024 Apr 13 2006 home
drwxr-xr-x 47 root wheel 4608 May 24 15:22 include
drwxr-xr-x 4 root wheel 9728 May 24 15:31 lib
drwxr-xr-x 9 root wheel 512 Oct 17 2001 libdata
drwxr-xr-x 7 root wheel 1536 May 24 15:31 libexec
drwxr-xr-x 23 root wheel 512 Apr 23 11:41 local
drwx------ 3 root wheel 512 Jun 2 2006 obj
drwxr-xr-x 58 root wheel 1536 Jul 9 16:54 ports
drwxr-xr-x 2 root wheel 6144 May 24 15:31 sbin
drwxr-xr-x 29 root wheel 512 Jul 6 2005 share
drwxr-xr-x 22 root wheel 1024 May 24 07:15 src
drwxr-xr-x 3 root wheel 512 Apr 15 2004 sup
lrwx------ 1 root wheel 12 May 11 2002 tmp -> /usr/var/tmp
drwxr-xr-x 28 root wheel 512 May 26 21:02 var

Those seem to be matched except for some spacing issues.

Jim

--
/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
  X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
                      http://www.FreeBSD.org     The Power to Serve
jim@TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
Do not meddle in the affairs of dragons, for you are crunchy and taste
     good with ketchup.
Received on 2007-07-11