all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Apprent bug in directory-files-and-attributes
@ 2004-02-16 20:19 Whitfield Diffie
  2004-02-17 23:20 ` Kevin Rodgers
  2004-02-22 22:42 ` Richard Stallman
  0 siblings, 2 replies; 3+ messages in thread
From: Whitfield Diffie @ 2004-02-16 20:19 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 45 bytes --]


This is a multi-part message in MIME format.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/plain; charset=us-ascii, Size: 5401 bytes --]

				Sunday  15 February 2004  at 17:16

    I have a case in which directory-files-and-attributes returns a list
in which some entries are of the form (<filename>), i.e., the attributes
portion is nil.  I believe the filename portion is correct.

    Unfortunately, this is a directory of files with very ill-behaved
names.  The names were manufactured from the `from addresses' of incoming
spam.  As far as I can tell, however, the directory itself is well formed
and the files actually exist.

    I conjecture that diectory-files-and-attributes has been implemented by
calling directory-files and then applying file-attributes to each element
of this list.  Certainly file-attributes (or file-exists-p) fails to find
the files under any encoding I can think to apply.

    I apologize for the plethera of evidence below.  I include it because
I am worried that the tar file of the directory (which is the basic evidence)
might not come out exactly the same on some other system.

				Thanks,
					Whit

Listing the directory from-logs-1 with ls -l on a Powerbook G4, produces:

total 80
-rw-------  1 diffie  staff  61 Apr 18  2003 zyl20@cam.ac.uk
-rw-------  1 diffie  staff  81 Apr  6  2003 zzaa928723a@hotmail.com
-rw-------  1 diffie  staff  78 Apr  9  2003 ?????????mms02es.mms.us.syntegra.com
-rw-------  1 diffie  staff  76 Apr 16  2003 ????????????ms11es.mms.us.syntegra.com
-rw-------  1 diffie  staff  70 Apr 17  2003 ???????mms12es.mms.us.syntegra.com
-rw-------  1 diffie  staff  73 Apr 12  2003 ????????????ms11es.mms.us.syntegra.com
-rw-------  1 diffie  staff  66 Apr 14  2003 ?????????mms02es.mms.us.syntegra.com
-rw-------  1 diffie  staff  72 Apr 13  2003 ?????????mms12es.mms.us.syntegra.com
-rw-------  1 diffie  staff  72 Apr  9  2003 ?????????s12es.mms.us.syntegra.com
-rw-------  1 diffie  staff  66 Apr 16  2003 ??????ms12es.mms.us.syntegra.com


    From the directory superior to from-logs-1,

    (let ((files (cddr (directory-files-and-attributes "from-logs-1"))) (cnt 0))
      (while files
        (insert (encode-coding-string (stringify (nth cnt aa)) 'raw-text) "\n")
	(setq cnt (1+ cnt))
	(setq files (cdr files)))))

produces:

("zyl20@cam.ac.uk" nil 1 504 20 (16432 6555) (16032 32322) (16422 40168) 61 "-rw-------" nil 4469272 -33554427)
("zzaa928723a@hotmail.com" nil 1 504 20 (16432 6555) (16017 1488) (16422 40168) 81 "-rw-------" nil 4469273 -33554427)
("á¤¾íº¢í½\200mms02es.mms.us.syntegra.com")
("᥹á\204\201á\205¯á\207\200ms11es.mms.us.syntegra.com")
("㹧ñ±¨\200mms12es.mms.us.syntegra.com")
("è±¹á\204\201á\205¯á\207\200ms11es.mms.us.syntegra.com")
("è²¼í½\206í³\200mms02es.mms.us.syntegra.com")
("èµ¡íº¢í½\200mms12es.mms.us.syntegra.com")
("è·¨í\236¾í¼­s12es.mms.us.syntegra.com")
("黽■ms12es.mms.us.syntegra.com" nil 1 504 20 (16432 6555) (16029 42474) (16422 40121) 66 "-rw-------" nil 4467995 -33554427)

which shows that seven of ten of the files have no attributes but doesn't give (me)
much insight into the filenames.  (I have no explanation for the newline character in
the middle of the attributes of the last entry.)

    Alternatively, given the subordinate definition:

(defun string-to-raw-text-vector (string)

  " String-to-raw-text-vector converts a string to a vector of the
   character codes of the characters in the string."

  (let* ((string (encode-coding-string string 'raw-text))
	 (string-length (length string)) (cnt 0)
	 (vector (make-vector string-length 0)))
    (while (< cnt string-length)
      (aset vector cnt (aref string cnt))
      (setq cnt (1+ cnt)))
    vector))

the expression:

        (let ((files (cddr (directory-files-and-attributes "from-logs-1")))
	      (cnt 0))
	  (while files
	    (insert (prin1-to-string
		     (string-to-raw-text-vector (car (nth cnt aa))))
		    "\n")
	    (setq cnt (1+ cnt))
	    (setq files (cdr files))))

produces:

[122 121 108 50 48 64 99 97 109 46 97 99 46 117 107]
[122 122 97 97 57 50 56 55 50 51 97 64 104 111 116 109 97 105 108 46 99 111 109]
[129 225 129 164 129 190 129 237 129 186 129 162 129 237 129 189 128 109 109 115 48 50 101 115 46 109 109 115 46 117 115 46 115 121 110 116 101 103 114 97 46 99 111 109]
[129 225 129 165 129 185 129 225 132 129 129 225 133 129 175 129 225 135 128 109 115 49 49 101 115 46 109 109 115 46 117 115 46 115 121 110 116 101 103 114 97 46 99 111 109]
[129 227 129 185 129 167 129 241 129 177 129 168 128 109 109 115 49 50 101 115 46 109 109 115 46 117 115 46 115 121 110 116 101 103 114 97 46 99 111 109]
[129 232 129 177 129 185 129 225 132 129 129 225 133 129 175 129 225 135 128 109 115 49 49 101 115 46 109 109 115 46 117 115 46 115 121 110 116 101 103 114 97 46 99 111 109]
[129 232 129 178 129 188 129 237 129 189 134 129 237 129 179 128 109 109 115 48 50 101 115 46 109 109 115 46 117 115 46 115 121 110 116 101 103 114 97 46 99 111 109]
[129 232 129 181 129 161 129 237 129 186 129 162 129 237 129 189 128 109 109 115 49 50 101 115 46 109 109 115 46 117 115 46 115 121 110 116 101 103 114 97 46 99 111 109]
[129 232 129 183 129 168 129 237 158 129 190 129 237 129 188 129 173 115 49 50 101 115 46 109 109 115 46 117 115 46 115 121 110 116 101 103 114 97 46 99 111 109]
[129 233 129 187 129 189 129 239 129 191 129 173 109 115 49 50 101 115 46 109 109 115 46 117 115 46 115 121 110 116 101 103 114 97 46 99 111 109]


[-- Attachment #3: from-logs-1.tar --]
[-- Type: application/octet-stream, Size: 20480 bytes --]

[-- Attachment #4: Type: text/plain, Size: 148 bytes --]

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Apprent bug in directory-files-and-attributes
  2004-02-16 20:19 Apprent bug in directory-files-and-attributes Whitfield Diffie
@ 2004-02-17 23:20 ` Kevin Rodgers
  2004-02-22 22:42 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2004-02-17 23:20 UTC (permalink / raw)


Whitfield Diffie wrote:
 >     I have a case in which directory-files-and-attributes returns a list
 > in which some entries are of the form (<filename>), i.e., the attributes
 > portion is nil.  I believe the filename portion is correct.
 >
 >     Unfortunately, this is a directory of files with very ill-behaved
 > names.  The names were manufactured from the `from addresses' of incoming
 > spam.  As far as I can tell, however, the directory itself is well formed
 > and the files actually exist.
 >
 >     I conjecture that diectory-files-and-attributes has been implemented by
 > calling directory-files and then applying file-attributes to each element
 > of this list.  Certainly file-attributes (or file-exists-p) fails to find
 > the files under any encoding I can think to apply.

Including mule-utf-8?  I saved your from-logs-1.tar attachment and
visited it in Emacs 21.3 (emacs -q --no-site-file) via `C-x RET c
mule-utf-8 RET C-x C-f'.  All the file names except the last (the one
that ends with "mms02es.mms.us.syntegra.com") were readable.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Apprent bug in directory-files-and-attributes
  2004-02-16 20:19 Apprent bug in directory-files-and-attributes Whitfield Diffie
  2004-02-17 23:20 ` Kevin Rodgers
@ 2004-02-22 22:42 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2004-02-22 22:42 UTC (permalink / raw)
  Cc: bug-gnu-emacs

	I conjecture that diectory-files-and-attributes has been implemented =
    by
    calling directory-files and then applying file-attributes to each element
    of this list.  Certainly file-attributes (or file-exists-p) fails to find
    the files under any encoding I can think to apply.

Yes, more or less.  It looks like Ffile_attributes just returned nil.
So I suggest you debug what happens inside that function.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-02-22 22:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-16 20:19 Apprent bug in directory-files-and-attributes Whitfield Diffie
2004-02-17 23:20 ` Kevin Rodgers
2004-02-22 22:42 ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.