From: Whitfield Diffie <whitfield.diffie@sun.com>
Subject: Apprent bug in directory-files-and-attributes
Date: Mon, 16 Feb 2004 12:19:36 -0800 [thread overview]
Message-ID: <200402162019.i1GKJbWo001490@ushabti.sfbay.sun.com> (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
next reply other threads:[~2004-02-16 20:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-16 20:19 Whitfield Diffie [this message]
2004-02-17 23:20 ` Apprent bug in directory-files-and-attributes Kevin Rodgers
2004-02-22 22:42 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200402162019.i1GKJbWo001490@ushabti.sfbay.sun.com \
--to=whitfield.diffie@sun.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).