aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/eshell
diff options
context:
space:
mode:
authorPaul Eggert2018-09-23 18:30:46 -0700
committerPaul Eggert2018-09-23 18:32:59 -0700
commit662bee7d70ccd3903e123b08c7ec9108a1a2ce0b (patch)
tree416de288b7f995a05f620c5a6e72cb5a30168551 /lisp/eshell
parentc2dee17e19e1cf80c2263f8de276cceb0252b76d (diff)
downloademacs-662bee7d70ccd3903e123b08c7ec9108a1a2ce0b.tar.gz
emacs-662bee7d70ccd3903e123b08c7ec9108a1a2ce0b.zip
file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with more-informative calls like (file-attribute-access-time A). It also fixes some documentation and minor timestamp coding issues that I noticed while looking into this. * doc/lispref/files.texi (File Attributes): * lisp/files.el (file-attribute-size) (file-attribute-inode-number, file-attribute-device-number): * src/dired.c (Fdirectory_files_and_attributes) (Ffile_attributes): Mention which attributes must be integers, or nonnegative integers, as opposed to merely being numbers. Remove no-longer-correct talk about representing large integers as conses of integers. * doc/lispref/files.texi (Magic File Names): * doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary): * lisp/autorevert.el (auto-revert-find-file-function) (auto-revert-tail-mode, auto-revert-handler): * lisp/auth-source.el (auth-source-netrc-parse): * lisp/cedet/ede/files.el (ede--inode-for-dir): * lisp/cedet/semantic/db-file.el (object-write): * lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook): * lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p) (semanticdb-synchronize): * lisp/cedet/srecode/table.el (srecode-mode-table-new): * lisp/desktop.el (desktop-save, desktop-read): * lisp/dired-aux.el (dired-file-set-difference) (dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive) (dired-create-files): * lisp/dired.el (dired-directory-changed-p, dired-readin): * lisp/dos-w32.el (w32-direct-print-region-helper): * lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads) (autoload-find-destination, update-directory-autoloads): * lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent): * lisp/epg.el (epg--start, epg-wait-for-completion): * lisp/eshell/em-ls.el (eshell-ls-filetype-p) (eshell-ls-applicable, eshell-ls-size-string) (eshell-ls-file, eshell-ls-dir, eshell-ls-files) (eshell-ls-entries): * lisp/eshell/em-pred.el (eshell-predicate-alist) (eshell-pred-file-type, eshell-pred-file-links) (eshell-pred-file-size): * lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat) (eshell-du-sum-directory, eshell/du): * lisp/eshell/esh-util.el (eshell-read-passwd) (eshell-read-hosts): * lisp/files.el (remote-file-name-inhibit-cache) (find-file-noselect, insert-file-1, dir-locals-find-file) (dir-locals-read-from-dir, backup-buffer) (file-ownership-preserved-p, copy-directory) (read-file-modes): * lisp/find-lisp.el (find-lisp-format): * lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles) (gnus-agent-read-agentview, gnus-agent-expire-group-1) (gnus-agent-request-article, gnus-agent-regenerate-group) (gnus-agent-update-files-total-fetched-for) (gnus-agent-update-view-total-fetched-for): * lisp/gnus/gnus-cache.el (gnus-cache-read-active) (gnus-cache-update-file-total-fetched-for) (gnus-cache-update-overview-total-fetched-for): * lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p): * lisp/gnus/gnus-score.el (gnus-score-score-files): * lisp/gnus/gnus-start.el (gnus-save-newsrc-file) (gnus-master-read-slave-newsrc): * lisp/gnus/gnus-sum.el (gnus-summary-import-article): * lisp/gnus/gnus-util.el (gnus-file-newer-than) (gnus-cache-file-contents): * lisp/gnus/mail-source.el (mail-source-delete-old-incoming) (mail-source-callback, mail-source-movemail): * lisp/gnus/nneething.el (nneething-create-mapping) (nneething-make-head): * lisp/gnus/nnfolder.el (nnfolder-read-folder): * lisp/gnus/nnheader.el (nnheader-file-size) (nnheader-insert-nov-file): * lisp/gnus/nnmail.el (nnmail-activate): * lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum) (nnmaildir--new-number, nnmaildir--update-nov) (nnmaildir--scan, nnmaildir-request-scan) (nnmaildir-request-update-info) (nnmaildir-request-expire-articles): * lisp/gnus/nnmh.el (nnmh-request-list-1) (nnmh-request-expire-articles, nnmh-update-gnus-unreads): * lisp/gnus/nnml.el (nnml-request-expire-articles): * lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load) (spam-stat-process-directory, spam-stat-test-directory): * lisp/ido.el (ido-directory-too-big-p) (ido-file-name-all-completions): * lisp/image-dired.el (image-dired-get-thumbnail-image) (image-dired-create-thumb-1): * lisp/info.el (info-insert-file-contents): * lisp/ls-lisp.el (ls-lisp-insert-directory) (ls-lisp-handle-switches, ls-lisp-classify-file) (ls-lisp-format): * lisp/mail/blessmail.el: * lisp/mail/feedmail.el (feedmail-default-date-generator) (feedmail-default-message-id-generator): * lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases) (mail-abbrevs-setup): * lisp/mail/mspools.el (mspools-size-folder): * lisp/mail/rmail.el (rmail-insert-inbox-text): * lisp/mail/sendmail.el (sendmail-sync-aliases): * lisp/mh-e/mh-alias.el (mh-alias-tstamp): * lisp/net/ange-ftp.el (ange-ftp-parse-netrc) (ange-ftp-write-region, ange-ftp-file-newer-than-file-p) (ange-ftp-cf1): * lisp/net/eudcb-mab.el (eudc-mab-query-internal): * lisp/net/eww.el (eww-read-bookmarks): * lisp/net/netrc.el (netrc-parse): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file): * lisp/obsolete/fast-lock.el (fast-lock-save-cache): * lisp/obsolete/vc-arch.el (vc-arch-state) (vc-arch-diff3-rej-p): * lisp/org/ob-eval.el (org-babel--shell-command-on-region): * lisp/org/org-attach.el (org-attach-commit): * lisp/org/org-macro.el (org-macro-initialize-templates): * lisp/org/org.el (org-babel-load-file) (org-file-newer-than-p): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-publish.el (org-publish-find-date) (org-publish-cache-ctime-of-src): * lisp/pcmpl-gnu.el (pcomplete/tar): * lisp/pcmpl-rpm.el (pcmpl-rpm-packages): * lisp/play/cookie1.el (cookie-snarf): * lisp/progmodes/cmacexp.el (c-macro-expansion): * lisp/ps-bdf.el (bdf-file-mod-time): * lisp/server.el (server-ensure-safe-dir): * lisp/simple.el (shell-command-on-region): * lisp/speedbar.el (speedbar-item-info-file-helper) (speedbar-check-obj-this-line): * lisp/thumbs.el (thumbs-cleanup-thumbsdir): * lisp/time.el (display-time-mail-check-directory) (display-time-file-nonempty-p): * lisp/url/url-cache.el (url-is-cached): * lisp/url/url-file.el (url-file-asynch-callback): * lisp/vc/diff-mode.el (diff-delete-if-empty): * lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries): * lisp/vc/vc-bzr.el (vc-bzr-state-heuristic): * lisp/vc/vc-cvs.el (vc-cvs-checkout-model) (vc-cvs-state-heuristic, vc-cvs-merge-news) (vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry): * lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1) (vc-hg--ignore-patterns-valid-p) (vc-hg--cached-dirstate-search, vc-hg-state-fast): * lisp/vc/vc-hooks.el (vc-after-save): * lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer): * lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status): * lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file): * lisp/xdg.el (xdg-mime-apps): Prefer (file-attribute-size A) to (nth 7 A), and similarly for other file attributes accessors. * doc/lispref/files.texi (File Attributes): * doc/lispref/intro.texi (Version Info): * doc/lispref/os.texi (Idle Timers): * lisp/erc/erc.el (erc-string-to-emacs-time): * lisp/files.el (file-attribute-access-time) (file-attribute-modification-time) (file-attribute-status-change-time): * lisp/net/tramp-compat.el: (tramp-compat-file-attribute-modification-time) (tramp-compat-file-attribute-size): * src/buffer.c (syms_of_buffer): * src/editfns.c (Fget_internal_run_time): * src/fileio.c (Fvisited_file_modtime) (Fset_visited_file_modtime): * src/keyboard.c (Fcurrent_idle_time): * src/process.c (Fprocess_attributes): Defer implementation details about timestamp format to the section that talks about timestamp format, to make it easier to change the documentation later if timestamp formats are extended. * lisp/gnus/gnus-util.el (gnus-file-newer-than): * lisp/speedbar.el (speedbar-check-obj-this-line): * lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer): Prefer time-less-p to doing it by hand. * lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses. * lisp/vc/vc-bzr.el (vc-bzr-state-heuristic): Use eql, not eq, to compare integers that might be bignums. * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): Prefer float-time to doing time arithmetic by hand.
Diffstat (limited to 'lisp/eshell')
-rw-r--r--lisp/eshell/em-ls.el38
-rw-r--r--lisp/eshell/em-pred.el14
-rw-r--r--lisp/eshell/em-unix.el49
-rw-r--r--lisp/eshell/esh-util.el4
4 files changed, 56 insertions, 49 deletions
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 2b568a991a2..53de7f7ec63 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -183,9 +183,9 @@ really need to stick around for very long."
183 "The face used for highlighting junk file names.") 183 "The face used for highlighting junk file names.")
184 184
185(defsubst eshell-ls-filetype-p (attrs type) 185(defsubst eshell-ls-filetype-p (attrs type)
186 "Test whether ATTRS specifies a directory." 186 "Test whether ATTRS specifies a file of type TYPE."
187 (if (nth 8 attrs) 187 (if (file-attribute-modes attrs)
188 (eq (aref (nth 8 attrs) 0) type))) 188 (eq (aref (file-attribute-modes attrs) 0) type)))
189 189
190(defmacro eshell-ls-applicable (attrs index func file) 190(defmacro eshell-ls-applicable (attrs index func file)
191 "Test whether, for ATTRS, the user can do what corresponds to INDEX. 191 "Test whether, for ATTRS, the user can do what corresponds to INDEX.
@@ -193,8 +193,8 @@ ATTRS is a string of file modes. See `file-attributes'.
193If we cannot determine the answer using ATTRS (e.g., if we need 193If we cannot determine the answer using ATTRS (e.g., if we need
194to know what group the user is in), compute the return value by 194to know what group the user is in), compute the return value by
195calling FUNC with FILE as an argument." 195calling FUNC with FILE as an argument."
196 `(let ((owner (nth 2 ,attrs)) 196 `(let ((owner (file-attribute-user-id ,attrs))
197 (modes (nth 8 ,attrs))) 197 (modes (file-attribute-modes ,attrs)))
198 (cond ((cond ((numberp owner) 198 (cond ((cond ((numberp owner)
199 (= owner (user-uid))) 199 (= owner (user-uid)))
200 ((stringp owner) 200 ((stringp owner)
@@ -437,7 +437,7 @@ Sort entries alphabetically across.")
437 437
438(defsubst eshell-ls-size-string (attrs size-width) 438(defsubst eshell-ls-size-string (attrs size-width)
439 "Return the size string for ATTRS length, using SIZE-WIDTH." 439 "Return the size string for ATTRS length, using SIZE-WIDTH."
440 (let* ((str (eshell-ls-printable-size (nth 7 attrs) t)) 440 (let* ((str (eshell-ls-printable-size (file-attribute-size attrs) t))
441 (len (length str))) 441 (len (length str)))
442 (if (< len size-width) 442 (if (< len size-width)
443 (concat (make-string (- size-width len) ? ) str) 443 (concat (make-string (- size-width len) ? ) str)
@@ -503,19 +503,19 @@ whose cdr is the list of file attributes."
503 (if numeric-uid-gid 503 (if numeric-uid-gid
504 "%s%4d %-8s %-8s " 504 "%s%4d %-8s %-8s "
505 "%s%4d %-14s %-8s ") 505 "%s%4d %-14s %-8s ")
506 (or (nth 8 attrs) "??????????") 506 (or (file-attribute-modes attrs) "??????????")
507 (or (nth 1 attrs) 0) 507 (or (file-attribute-link-number attrs) 0)
508 (or (let ((user (nth 2 attrs))) 508 (or (let ((user (file-attribute-user-id attrs)))
509 (and (stringp user) 509 (and (stringp user)
510 (eshell-substring user 14))) 510 (eshell-substring user 14)))
511 (nth 2 attrs) 511 (file-attribute-user-id attrs)
512 "") 512 "")
513 (or (let ((group (nth 3 attrs))) 513 (or (let ((group (file-attribute-group-id attrs)))
514 (and (stringp group) 514 (and (stringp group)
515 (eshell-substring group 8))) 515 (eshell-substring group 8)))
516 (nth 3 attrs) 516 (file-attribute-group-id attrs)
517 "")) 517 ""))
518 (let* ((str (eshell-ls-printable-size (nth 7 attrs))) 518 (let* ((str (eshell-ls-printable-size (file-attribute-size attrs)))
519 (len (length str))) 519 (len (length str)))
520 ;; Let file sizes shorter than 9 align neatly. 520 ;; Let file sizes shorter than 9 align neatly.
521 (if (< len (or size-width 8)) 521 (if (< len (or size-width 8))
@@ -585,12 +585,12 @@ relative to that directory."
585 (let ((total 0.0)) 585 (let ((total 0.0))
586 (setq size-width 0) 586 (setq size-width 0)
587 (dolist (e entries) 587 (dolist (e entries)
588 (if (nth 7 (cdr e)) 588 (if (file-attribute-size (cdr e))
589 (setq total (+ total (nth 7 (cdr e))) 589 (setq total (+ total (file-attribute-size (cdr e)))
590 size-width 590 size-width
591 (max size-width 591 (max size-width
592 (length (eshell-ls-printable-size 592 (length (eshell-ls-printable-size
593 (nth 7 (cdr e)) 593 (file-attribute-size (cdr e))
594 (not 594 (not
595 ;; If we are under -l, count length 595 ;; If we are under -l, count length
596 ;; of sizes in bytes, not in blocks. 596 ;; of sizes in bytes, not in blocks.
@@ -700,7 +700,7 @@ Each member of FILES is either a string or a cons cell of the form
700 (if (not show-size) 700 (if (not show-size)
701 (setq display-files (mapcar 'eshell-ls-annotate files)) 701 (setq display-files (mapcar 'eshell-ls-annotate files))
702 (dolist (file files) 702 (dolist (file files)
703 (let* ((str (eshell-ls-printable-size (nth 7 (cdr file)) t)) 703 (let* ((str (eshell-ls-printable-size (file-attribute-size (cdr file)) t))
704 (len (length str))) 704 (len (length str)))
705 (if (< len size-width) 705 (if (< len size-width)
706 (setq str (concat (make-string (- size-width len) ? ) str))) 706 (setq str (concat (make-string (- size-width len) ? ) str)))
@@ -766,14 +766,14 @@ need to be printed."
766 (if show-size 766 (if show-size
767 (max size-width 767 (max size-width
768 (length (eshell-ls-printable-size 768 (length (eshell-ls-printable-size
769 (nth 7 (cdr entry)) t)))))) 769 (file-attribute-size (cdr entry)) t))))))
770 (setq dirs (cons entry dirs))) 770 (setq dirs (cons entry dirs)))
771 (setq files (cons entry files) 771 (setq files (cons entry files)
772 size-width 772 size-width
773 (if show-size 773 (if show-size
774 (max size-width 774 (max size-width
775 (length (eshell-ls-printable-size 775 (length (eshell-ls-printable-size
776 (nth 7 (cdr entry)) t))))))) 776 (file-attribute-size (cdr entry)) t)))))))
777 (when files 777 (when files
778 (eshell-ls-files (eshell-ls-sort-entries files) 778 (eshell-ls-files (eshell-ls-sort-entries files)
779 size-width show-recursive) 779 size-width show-recursive)
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index b3b16d909ba..c3b942d25a7 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -89,10 +89,12 @@ ordinary strings."
89 (?t . (eshell-pred-file-mode 1000)) ; sticky bit 89 (?t . (eshell-pred-file-mode 1000)) ; sticky bit
90 (?U . #'(lambda (file) ; owned by effective uid 90 (?U . #'(lambda (file) ; owned by effective uid
91 (if (file-exists-p file) 91 (if (file-exists-p file)
92 (= (nth 2 (file-attributes file)) (user-uid))))) 92 (= (file-attribute-user-id (file-attributes file))
93 (user-uid)))))
93 ;; (?G . #'(lambda (file) ; owned by effective gid 94 ;; (?G . #'(lambda (file) ; owned by effective gid
94 ;; (if (file-exists-p file) 95 ;; (if (file-exists-p file)
95 ;; (= (nth 2 (file-attributes file)) (user-uid))))) 96 ;; (= (file-attribute-user-id (file-attributes file))
97 ;; (user-uid)))))
96 (?* . #'(lambda (file) 98 (?* . #'(lambda (file)
97 (and (file-regular-p file) 99 (and (file-regular-p file)
98 (not (file-symlink-p file)) 100 (not (file-symlink-p file))
@@ -460,7 +462,7 @@ that `ls -l' will show in the first column of its display. "
460 `(lambda (file) 462 `(lambda (file)
461 (let ((attrs (eshell-file-attributes (directory-file-name file)))) 463 (let ((attrs (eshell-file-attributes (directory-file-name file))))
462 (if attrs 464 (if attrs
463 (memq (aref (nth 8 attrs) 0) 465 (memq (aref (file-attribute-modes attrs) 0)
464 ,(if (eq type ?%) 466 ,(if (eq type ?%)
465 '(?b ?c) 467 '(?b ?c)
466 (list 'quote (list type)))))))) 468 (list 'quote (list type))))))))
@@ -489,7 +491,8 @@ that `ls -l' will show in the first column of its display. "
489 '< 491 '<
490 (if (eq qual ?+) 492 (if (eq qual ?+)
491 '> 493 '>
492 '=)) (nth 1 attrs) ,amount)))))) 494 '=))
495 (file-attribute-link-number attrs) ,amount))))))
493 496
494(defun eshell-pred-file-size () 497(defun eshell-pred-file-size ()
495 "Return a predicate to test whether a file is of a given size." 498 "Return a predicate to test whether a file is of a given size."
@@ -518,7 +521,8 @@ that `ls -l' will show in the first column of its display. "
518 '< 521 '<
519 (if (eq qual ?+) 522 (if (eq qual ?+)
520 '> 523 '>
521 '=)) (nth 7 attrs) ,amount)))))) 524 '=))
525 (file-attribute-size attrs) ,amount))))))
522 526
523(defun eshell-pred-substitute (&optional repeat) 527(defun eshell-pred-substitute (&optional repeat)
524 "Return a modifier function that will substitute matches." 528 "Return a modifier function that will substitute matches."
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index 9a99c53571c..3aecebc2ebf 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -370,12 +370,14 @@ Remove the DIRECTORY(ies), if they are empty.")
370 (or (not (eshell-under-windows-p)) 370 (or (not (eshell-under-windows-p))
371 (eq system-type 'ms-dos)) 371 (eq system-type 'ms-dos))
372 (setq attr (eshell-file-attributes (car files))) 372 (setq attr (eshell-file-attributes (car files)))
373 (nth 10 attr-target) (nth 10 attr) 373 (file-attribute-inode-number attr-target)
374 ;; Use equal, not -, since the inode and the device could 374 (file-attribute-inode-number attr)
375 ;; cons cells. 375 (equal (file-attribute-inode-number attr-target)
376 (equal (nth 10 attr-target) (nth 10 attr)) 376 (file-attribute-inode-number attr))
377 (nth 11 attr-target) (nth 11 attr) 377 (file-attribute-device-number attr-target)
378 (equal (nth 11 attr-target) (nth 11 attr))) 378 (file-attribute-device-number attr)
379 (equal (file-attribute-device-number attr-target)
380 (file-attribute-device-number attr)))
379 (eshell-error (format-message "%s: `%s' and `%s' are the same file\n" 381 (eshell-error (format-message "%s: `%s' and `%s' are the same file\n"
380 command (car files) target))) 382 command (car files) target)))
381 (t 383 (t
@@ -397,16 +399,16 @@ Remove the DIRECTORY(ies), if they are empty.")
397 (let (eshell-warn-dot-directories) 399 (let (eshell-warn-dot-directories)
398 (if (and (not deep) 400 (if (and (not deep)
399 (eq func 'rename-file) 401 (eq func 'rename-file)
400 ;; Use equal, since the device might be a 402 (equal (file-attribute-device-number
401 ;; cons cell. 403 (eshell-file-attributes
402 (equal (nth 11 (eshell-file-attributes 404 (file-name-directory
403 (file-name-directory 405 (directory-file-name
404 (directory-file-name 406 (expand-file-name source)))))
405 (expand-file-name source))))) 407 (file-attribute-device-number
406 (nth 11 (eshell-file-attributes 408 (eshell-file-attributes
407 (file-name-directory 409 (file-name-directory
408 (directory-file-name 410 (directory-file-name
409 (expand-file-name target))))))) 411 (expand-file-name target)))))))
410 (apply 'eshell-funcalln func source target args) 412 (apply 'eshell-funcalln func source target args)
411 (unless (file-directory-p target) 413 (unless (file-directory-p target)
412 (if em-verbose 414 (if em-verbose
@@ -612,7 +614,8 @@ symlink, then revert to the system's definition of cat."
612 (> (length arg) 0) 614 (> (length arg) 0)
613 (eq (aref arg 0) ?-)) 615 (eq (aref arg 0) ?-))
614 (let ((attrs (eshell-file-attributes arg))) 616 (let ((attrs (eshell-file-attributes arg)))
615 (and attrs (memq (aref (nth 8 attrs) 0) 617 (and attrs
618 (memq (aref (file-attribute-modes attrs) 0)
616 '(?d ?l ?-))))) 619 '(?d ?l ?-)))))
617 (throw 'special t))))) 620 (throw 'special t)))))
618 (let ((ext-cat (eshell-search-path "cat"))) 621 (let ((ext-cat (eshell-search-path "cat")))
@@ -843,19 +846,19 @@ external command."
843 (unless (string-match "\\`\\.\\.?\\'" (caar entries)) 846 (unless (string-match "\\`\\.\\.?\\'" (caar entries))
844 (let* ((entry (concat path "/" 847 (let* ((entry (concat path "/"
845 (caar entries))) 848 (caar entries)))
846 (symlink (and (stringp (cadr (car entries))) 849 (symlink (and (stringp (file-attribute-type (cdar entries)))
847 (cadr (car entries))))) 850 (file-attribute-type (cdar entries)))))
848 (unless (or (and symlink (not dereference-links)) 851 (unless (or (and symlink (not dereference-links))
849 (and only-one-filesystem 852 (and only-one-filesystem
850 (/= only-one-filesystem 853 (/= only-one-filesystem
851 (nth 12 (car entries))))) 854 (file-attribute-device-number (cdar entries)))))
852 (if symlink 855 (if symlink
853 (setq entry symlink)) 856 (setq entry symlink))
854 (setq size 857 (setq size
855 (+ size 858 (+ size
856 (if (eq t (cadr (car entries))) 859 (if (eq t (car (cdar entries)))
857 (eshell-du-sum-directory entry (1+ depth)) 860 (eshell-du-sum-directory entry (1+ depth))
858 (let ((file-size (nth 8 (car entries)))) 861 (let ((file-size (file-attribute-size (cdar entries))))
859 (prog1 862 (prog1
860 file-size 863 file-size
861 (if show-all 864 (if show-all
@@ -926,7 +929,7 @@ Summarize disk usage of each FILE, recursively for directories.")
926 (while args 929 (while args
927 (if only-one-filesystem 930 (if only-one-filesystem
928 (setq only-one-filesystem 931 (setq only-one-filesystem
929 (nth 11 (eshell-file-attributes 932 (file-attribute-device-number (eshell-file-attributes
930 (file-name-as-directory (car args)))))) 933 (file-name-as-directory (car args))))))
931 (setq size (+ size (eshell-du-sum-directory 934 (setq size (+ size (eshell-du-sum-directory
932 (directory-file-name (car args)) 0))) 935 (directory-file-name (car args)) 0)))
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index 5ef1ae41297..8fe8c461fdb 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -447,7 +447,7 @@ list."
447 (not (symbol-value timestamp-var)) 447 (not (symbol-value timestamp-var))
448 (time-less-p 448 (time-less-p
449 (symbol-value timestamp-var) 449 (symbol-value timestamp-var)
450 (nth 5 (file-attributes file)))) 450 (file-attribute-modification-time (file-attributes file))))
451 (progn 451 (progn
452 (set result-var (eshell-read-passwd-file file)) 452 (set result-var (eshell-read-passwd-file file))
453 (set timestamp-var (current-time)))) 453 (set timestamp-var (current-time))))
@@ -501,7 +501,7 @@ list."
501 (not (symbol-value timestamp-var)) 501 (not (symbol-value timestamp-var))
502 (time-less-p 502 (time-less-p
503 (symbol-value timestamp-var) 503 (symbol-value timestamp-var)
504 (nth 5 (file-attributes file)))) 504 (file-attribute-modification-time (file-attributes file))))
505 (progn 505 (progn
506 (set result-var (eshell-read-hosts-file file)) 506 (set result-var (eshell-read-hosts-file file))
507 (set timestamp-var (current-time)))) 507 (set timestamp-var (current-time))))