unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* -I switch to ls and dired.
@ 2004-06-09  3:42 Luc Teirlinck
  2004-06-09  3:49 ` Luc Teirlinck
  2004-06-10  6:55 ` Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Luc Teirlinck @ 2004-06-09  3:42 UTC (permalink / raw)


Using both the -R switch (to ls) and the -I switch with a pattern
containing R in dired can cause trouble.

Make sure to have a file with an "R" in its name, say "aRa", in a
subdir, say "subdir" of ~/.  Make sure that "subdir" contains other
files, say myfile1 and myfile2.  Then do `C-u C-x d RET -al -I *R* RET
RET, then do 'i' on subdir.  Note that not only "aRa" is not listed
(clearly it should not), but also myfile{1,2} are not listed.

The reason for this is that dired and dired-aux systematically check
whether the "R" switch has been used by just checking whether the
string passed as switches to ls contains _some_ "R" _anywhere_ and if
for some reason the "R" switch needs to be removed, _all_ R's in the
string are removed.  Thus the shell pattern `*R* becomes `**' matching
anything (except `.' and `..' for technical reasons).

There is no telling what pattern the user might want to ignore with
-I.  There is no reason why that pattern could not contain "R". 

What do we do with the above?  Completely ignore it?  Just document
it?  Fix it?  Fixing it unconditionally might be difficult, but fixing
it modulo some (to be documented) conventions seems very feasible.
Conventions making things easy would be to always use -I instead of
the long --ignore= option (that is what people would do anyway) and, if
one is going to use both the -R switch and -I *R*, use the R switch
_before_ the -I switch (that again is what people would probably do
anyway).

Sincerely,

Luc.

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

* Re: -I switch to ls and dired.
  2004-06-09  3:42 -I switch to ls and dired Luc Teirlinck
@ 2004-06-09  3:49 ` Luc Teirlinck
  2004-06-10  6:55 ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Luc Teirlinck @ 2004-06-09  3:49 UTC (permalink / raw)
  Cc: emacs-devel

>From my previous message:

   Using both the -R switch (to ls) and the -I switch with a pattern
   containing R in dired can cause trouble.

That was misformulated.  Using the -I switch with a pattern containing
R in dired can cause trouble, _regardless_ of whether the -R switch is
used.  In the example I gave, the -R switch was _not_ used.

Sincerely,

Luc.

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

* Re: -I switch to ls and dired.
  2004-06-09  3:42 -I switch to ls and dired Luc Teirlinck
  2004-06-09  3:49 ` Luc Teirlinck
@ 2004-06-10  6:55 ` Richard Stallman
  2004-06-10 20:47   ` Luc Teirlinck
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2004-06-10  6:55 UTC (permalink / raw)
  Cc: emacs-devel

    The reason for this is that dired and dired-aux systematically check
    whether the "R" switch has been used by just checking whether the
    string passed as switches to ls contains _some_ "R" _anywhere_ and if
    for some reason the "R" switch needs to be removed, _all_ R's in the
    string are removed.  Thus the shell pattern `*R* becomes `**' matching
    anything (except `.' and `..' for technical reasons).

    There is no telling what pattern the user might want to ignore with
    -I.  There is no reason why that pattern could not contain "R". 

    What do we do with the above?  Completely ignore it?  Just document
    it?  Fix it?  Fixing it unconditionally might be difficult, but fixing
    it modulo some (to be documented) conventions seems very feasible.

The code that removes -R could be made smarter so that it detects
R as an option, but not R as an argument.  The rules for options
are not that complicated.

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

* Re: -I switch to ls and dired.
  2004-06-10  6:55 ` Richard Stallman
@ 2004-06-10 20:47   ` Luc Teirlinck
  2004-06-11 11:55     ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Luc Teirlinck @ 2004-06-10 20:47 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:

   The code that removes -R could be made smarter so that it detects
   R as an option, but not R as an argument.  The rules for options
   are not that complicated.

I believe that would be possible.  However, it would seem that this
would not be the end of the problems with options that take arguments
(I believe that this just covers -I and nothing else.)  Indeed, these
arguments are not processed the way the shell does.  Instead, they are
just split at spaces.  Quoting is ignored, shell variables are not
expanded and so on.

As a result, for instance, -I '* *', to exclude file names containing
a space, will lead to an error.

Also, R is by no means the _only_ problem and arguments are not the
only problem either.

For instance, trying `C-u i --ignore-backups' on some listed directory
yields an error:

Can't have dirs with and without -b switches together.

Of course, there is a b in backups.

There seem to be other examples all over dired and dired-aux. 

Dired seems to _systematically_ make two assumptions:

1.  No options take arguments.  Equivalently (or so I believe), -I is
    not used.

2.  No long options are used.

We can either just document those two assumptions or try to
systematically get rid of them.  I have the impression that the second
possibility will require many changes in dired and dired-aux (and
probably in dired-x), all well as changes in `insert-directory' in
files.el.

Sincerely,

Luc.

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

* Re: -I switch to ls and dired.
  2004-06-10 20:47   ` Luc Teirlinck
@ 2004-06-11 11:55     ` Richard Stallman
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2004-06-11 11:55 UTC (permalink / raw)
  Cc: emacs-devel

    Dired seems to _systematically_ make two assumptions:

    1.  No options take arguments.  Equivalently (or so I believe), -I is
	not used.

    2.  No long options are used.

    We can either just document those two assumptions or try to
    systematically get rid of them.

I'd say document them.  It isn't worth a lot of work to get rid of
them.

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

end of thread, other threads:[~2004-06-11 11:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-09  3:42 -I switch to ls and dired Luc Teirlinck
2004-06-09  3:49 ` Luc Teirlinck
2004-06-10  6:55 ` Richard Stallman
2004-06-10 20:47   ` Luc Teirlinck
2004-06-11 11:55     ` Richard Stallman

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).