[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fs:directory-list & ip-tcp/ftp



>From:  snicoud@atc.boeing.com (Stephen L. Nicoud)
>Newsgroups: bcr.digest.slug
>Message-ID:  <23076@bellcore.bellcore.com>

> 
> 
> 
> When I try to read my unix mail inbox "/usr/spool/mail/snicoud" I
> sometimes have to wait five or more minutes while my Symbolics waits for
> a directory listing of our Ultrix host's /usr/spool/mail directory,
> which is very large.
> 
> So, I think I've traced it down to a call to FS:DIRECTORY-LIST which is
> passed "bcsaic:/usr/spool/mail/snicoud.zmail" (the .zmail file being the
> renamed file for my inbox).  The Ultrix host has FTP as its only FILE
> service.  Well my Symbolics (7.2 ip-tcp 67.8 (eco 3)) asks Ultrix for
> listing of "/usr/spool/mail".  Why should it do that?  Why not the whole
> spec:  "/usr/spool/mail/snicoud.zmail"?  Is this a bug in IP-TCP or is
> this a bug at all?
> 
> Has anyone else noticed this behavior?
> 
> Ideas, suggestions?
> 
> Steve
> --
> Stephen L. Nicoud  <snicoud@atc.boeing.com>  uw-beaver!bcsaic!snicoud
> Boeing Advanced Technology Center for Computer Sciences
> 

Here is what was sent to us from MCC.  Try it, it seems to work.
Leslie Walko

p.s. for questions, contact the authors at MCC.  [I hope they don't mind]

;;; -*- Mode: LISP; Syntax: Common-lisp; Package: FILE-SYSTEM; Base: 10 -*-

;;
;; Selective Work Around, from source SYS: IP-TCP; TCP-FTP.LISP.1528 (Rel 7.2)
;;

(defvar *Assume-Unix-Hosts-That-Can-List-Part-Of-Directory* NIL)

(defvar *Unix-Hosts-That-Can-List-Part-Of-Directory* ()
  "List of UNIX host objects (e.g. (NET:PARSE-HOST \"FOO\")) for Unix hosts
   that can answer FTP LIST requests that include file names as well as directory specs.")

(defun Unix-Host-Can-List-Part-Of-Directory (Host)
  (or *Assume-Unix-Hosts-That-Can-List-Part-Of-Directory*
      (member Host *Unix-Hosts-That-Can-List-Part-Of-Directory*)))

(defmethod (:directory-command unix-tcp-ftp-file-access-path) (pathname options)
  (let ((cmd (if (member :fast options)
		 "NLST"
		 "LIST")))
    (values cmd
	    ;; Some UNIX hosts can do this, others can't.  Symbolics
	    ;; didn't think any of them could, so systems like Ultrix
	    ;; (which the Symbolics code didn't get recognized as Unix!)
	    ;; did better than :Unix or :Unix42 systems.  The penalty is
	    ;; that for large directories, the FTP response will have to
	    ;; list all of the files in the directory, rather than the
	    ;; only the files matching some file spec (i.e., the
	    ;; PATHNAME parameter to this function).
1	    (if (Unix-Host-Can-List-Part-Of-Directory Host)
0		;; Send the full pathname, so file server can reply with
		;; just the directory info for the file(s) we want.
1		pathname
0		;; Send just the directory spec;  the file server will
		;; send back a complete directory listing, and we will
		;; pick out the entries of interest ourselves.
		(send pathname :directory-pathname-as-file))
	    t)))
;
;Posted-Date: Tue, 16 Jan 90 15:13 CST
;Date: Tue, 16 Jan 90 16:13 EST
;From: Cohen@MCC
;Sender: weitzman@mcc
;Subject: UNIX FTP directory lists 
;To: Hollan@flash
;cc: Weitzman@MCC
;Character-Type-Mappings: (1 0 (NIL 0) (NIL :BOLD NIL) "CPTFONTCB")
;Fonts: CPTFONT, CPTFONTCB
;
;
;Here's a copy of a bug-report we just sent to Symbolics, along with a
;work-around that should solve your ZMAIL problem for the moment.
;You probably want to put something like
;
; (PUSH (NET:PARSE-HOST "Flash") *Unix-Hosts-That-Can-List-Part-Of-Directory*)
;
;in an appropriate place.  Or, if you're really daring, you might
;
; (setf *Assume-Unix-Hosts-That-Can-List-Part-Of-Directory* T).
;
;We'll let you know if they say something useful.
;
;Good luck.
;
;-- Rich & Louie.
;
;
;The standard 7.2 IP-TCP code assumes that Unix systems FTP servers don't
;support LIST for selected files within a directory.  Thus, to implement
;(directory "Unix-Host:/dir/file.lisp") it would pass the FTP command
;"LIST /dir", get back  a full directory listing over the FTP connection,
;and select the line for "file".  Our Sun systems (and Ultrix systems, too)
;support the "LIST /dir/file.lisp" command, in which the file server reports
;just a directory listing of the desired file.  This is much more efficient
;when the directory is large.
;
;The general TCP-FTP-FILE-ACCESS-PATH supports this partial listing
;capability, but the UNIX-TCP-FTP-FILE-ACCESS-PATH explicitly doesn't.
;Is there some reason for this?  Are Unix FTP servers known to be
;deficient in this respect?  If so, have some newer servers overcome
;this, as appears to be the case here?
;
;-- Rich
;
;;;
;;; Selective Work Around, from source SYS: IP-TCP; TCP-FTP.LISP.1528 (Rel 7.2)
;;;
;
;(defvar *Assume-Unix-Hosts-That-Can-List-Part-Of-Directory* NIL)
;
;(defvar *Unix-Hosts-That-Can-List-Part-Of-Directory* ()
;  "List of UNIX host objects (e.g. (NET:PARSE-HOST \"FOO\")) for Unix hosts
;   that can answer FTP LIST requests that include file names as well as directory specs.")
;
;(defun Unix-Host-Can-List-Part-Of-Directory (Host)
;  (or *Assume-Unix-Hosts-That-Can-List-Part-Of-Directory*
;      (member Host *Unix-Hosts-That-Can-List-Part-Of-Directory*)))
;
;(defmethod (:directory-command unix-tcp-ftp-file-access-path) (pathname options)
;  (let ((cmd (if (member :fast options)
;		 "NLST"
;		 "LIST")))
;    (values cmd
;	    ;; Some UNIX hosts can do this, others can't.  Symbolics
;	    ;; didn't think any of them could, so systems like Ultrix
;	    ;; (which the Symbolics code didn't get recognized as Unix!)
;	    ;; did better than :Unix or :Unix42 systems.  The penalty is
;	    ;; that for large directories, the FTP response will have to
;	    ;; list all of the files in the directory, rather than the
;	    ;; only the files matching some file spec (i.e., the
;	    ;; PATHNAME parameter to this function).
;1	    (if (Unix-Host-Can-List-Part-Of-Directory Host)
0;		;; Send the full pathname, so file server can reply with
;		;; just the directory info for the file(s) we want.
;1		pathname
0;		;; Send just the directory spec;  the file server will
;		;; send back a complete directory listing, and we will
;		;; pick out the entries of interest ourselves.
;		(send pathname :directory-pathname-as-file))
;	    t)))