help-emacs-windows
[Top][All Lists]
Advanced

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

Re: [h-e-w] I found a way to list the c:/ directory


From: Dr Francis J. Wright
Subject: Re: [h-e-w] I found a way to list the c:/ directory
Date: Wed, 11 Jun 2003 13:33:56 +0100

From: "Chris McMahan" <address@hidden>
To: "Dr Francis J. Wright" <address@hidden>
Cc: "Paul Whitfield" <address@hidden>;
<address@hidden>
Sent: Wednesday, June 11, 2003 12:51 PM
Subject: Re: [h-e-w] I found a way to list the c:/ directory


> I'm running Windows XP Pro. The other issue I was addressing was the
> inconsistency of the listing of file permissions between ls-lisp and
> cygwin ls. Here's an example:
>
> using ls-lisp
>   drwxrwxrwx   2        0 Jun  9 14:35 archive/
>   drwxrwxrwx   2        0 May  5 07:56 q/
>   -rw-rw-rw-   1    20917 Oct 28  2002 comp.emacs
>   -rw-rw-rw-   1   224174 Jun  9 14:02 emacs
>   -rw-rw-rw-   1   107892 Apr  9 08:51 gnu.emacs.help
>   -rw-rw-rw-   1    92414 May 13 10:57 gnu.emacs.sources
>   -rw-rw-rw-   1     2938 Apr 22 16:28 gnu.emacs.vm.bug
>   -rw-rw-rw-   1    19576 May 13 10:58 gnu.emacs.vm.info
>
>
> using ls -laFG
>   drwxr-xr-x+   7 chris           0 Jun 11 07:36 ./
>   drwxr-xr-x+  15 chris           0 Jun 11 07:30 ../
>   drwxr-xr-x+   5 chris           0 Jun  9 14:35 archive/
>   -rw-------    1 chris       20917 Oct 28  2002 comp.emacs
>   -rw-------    1 chris      224174 Jun  9 14:02 emacs
>   -rw-------    1 chris      107892 Apr  9 08:51 gnu.emacs.help
>   -rw-------    1 chris       92414 May 13 10:57 gnu.emacs.sources
>   -rw-------    1 chris        2938 Apr 22 16:28 gnu.emacs.vm.bug
>   -rw-------    1 chris       19576 May 13 10:58 gnu.emacs.vm.info
>   drwxr-xr-x+   2 chris           0 May  5 07:56 q/
>
>
> (I truncated the listings for brevity)
>
> The \ls version seems to reflect any changes I make to permissions
> using chmod, while the ls-lisp version does not.
>
> Thanks for taking the time to look at this!
>
>  - Chris


I will probably get some of the following wrong, in which case I invite
someone who knows more about it all to correct me!

I think the link-count error was explained by Jason a while ago.  If I
recall correctly, it is time consuming to determine it correctly, so it is
controlled by a user option, which currently defaults to off.  I think it
will default to on in some future version, but it's still off by default in
Emacs 21.3.  You can turn it on by putting this in your .emacs:

(setq w32-get-true-file-attributes t)

The absence of a user name is an ls-lisp configuration option, of which
there are several; take a look at the ls-lisp configuration buffer.

The recent appearance of a + in Cygwin ls listings is currently a mystery to
me.  Can anyone enlighten me about what it means, whether it can be turned
off, where it's documented, etc, please?  I'm sure ls-lisp could emulate it
if there is any reason to do so.

The rest of the difference concerns essentially bogus information that is
being emulated differently by Cygwin ls and ls-lisp.  Under Win 9x etc.
there is no real concept of user at all and any file permissions apply to
all users.  For files, ls-lisp emulates the Unix user, group and other
permissions as identical, whereas Cygwin ls pretends that the Windows file
permissions apply to the user and that group and other users have no access
at all.  (Actually, I think that ls-lisp is a better emulation in this
case.)  On Win NT etc. file permissions are much more complicated and since
my machines are all single-user I have never bothered to get to grips with
them.  But the mapping to Unix user, group and other permissions is no
simpler.

I would expect Cygwin ls to agree with Cygwin chmod, but that doesn't make
the mapping to Windows file attributes any less arbitrary.

I will, nevertheless, give some thought to making ls-lisp emulate Cygwin
more closely (which has been the guiding principle behind a lot of the
changes I have made to ls-lisp), perhaps as an option.

I have finally found the code that I thought I wrote ages ago.  It was in my
.emacs but commented out!  Here it is.  You will see from the doc string
just how old it is!  If anyone tries it and finds it doesn't work then
please let me know and I'll endeavour to fix it.

; (defadvice insert-directory (around insert-directory-advice activate)
;   "FJW: Hack around a bug in the Cygwin beta 20.1 `ls' program
; when listing the root partition under Windows NT (not 9x).
; For use with (setq ls-lisp-use-insert-directory-program t)."
;   (condition-case desc ad-do-it
;     (file-error
;      (save-excursion
;        (goto-char (point-min))
;        (if (looking-at ".*pagefile\.sys: No such file or directory")
;     (delete-region (point) (1+ (line-end-position)))
;   ;; This may not work in all cases:
;   (error (concat (nth 1 desc) ": " (nth 2 desc) ", " (nth 3 desc))))
;        ))))

Francis





reply via email to

[Prev in Thread] Current Thread [Next in Thread]