Subject: 24.1; dired-mark-sexp misparses directory contents

From: Sean McAfee <[email-masked]>
Date: Sun, 27 Jan 2013 18:49:55 -0800

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

I recently wanted to mark all zero-size files in a dired buffer.  I
found that dired-mark-sexp seemed to be just what I needed, but when I
invoked it with the expression (= size 0), I found that it marked every
file, even those of nonzero size.

Here's a test directory I set up:

  /home/mcafee/test:
  total used in directory 28 available 102379756
  drwxrwxr-x  2 mcafee mcafee  4096 Jan 27 18:31 .
  drwxr-xr-x 44 mcafee mcafee 12288 Jan 27 18:31 ..
  -rw-rw-r--  1 mcafee mcafee     8 Jan 27 18:31 bar
  -rw-rw-r--  1 mcafee mcafee    12 Jan 27 18:31 baz
  -rw-rw-r--  1 mcafee mcafee     4 Jan 27 18:31 foo

In this directory, I ran dired-mark-sexp with the following expression,
intended to exercise all of the available symbols:

(progn (message
"name=%s;inode=%s;s=%s;mode=%s;nlink=%s;uid=%s;gid=%s;size=%s;time=%s;sym=%s"
name inodes mode nlink uid gid size time sym) nil)

Here are the messages that were produced:
name=.;inode=0;s=0;mode=drwxrwxr-x;nlink=2;uid=mcafee;gid=2;size=0;time=
mcafee  4096 Jan 27 18:31;sym=
name=..;inode=0;s=0;mode=drwxr-xr-x;nlink=44;uid=mcafee;gid=44;size=0;time=
mcafee 12288 Jan 27 18:31;sym=
name=bar;inode=0;s=0;mode=-rw-rw-r--;nlink=1;uid=mcafee;gid=1;size=0;time=
mcafee     8 Jan 27 18:31;sym=
name=baz;inode=0;s=0;mode=-rw-rw-r--;nlink=1;uid=mcafee;gid=1;size=0;time=
mcafee    12 Jan 27 18:31;sym=
name=foo;inode=0;s=0;mode=-rw-rw-r--;nlink=1;uid=mcafee;gid=1;size=0;time=
mcafee     4 Jan 27 18:31;sym=

Clearly, the "time" variable includes more of the directory listing than
it should, and "size" is incorrectly set to zero for all files, as I
originally noticed.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/24.1/etc/DEBUG.

In GNU Emacs 24.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.12)
 of 2012-09-22 on batsu, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -O2'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Dired by name

Minor modes in effect:
  gnus-dired-mode: t
  recentf-mode: t
  shell-dirtrack-mode: t
  minibuffer-depth-indicate-mode: t
  ido-everywhere: t
  global-undo-tree-mode: t
  diff-auto-refine-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
y SPC = SPC . 2 5 SPC = SPC <backspace> <backspace>
* S-SPC 3 0 SPC = SPC C-u M-: ( * S-SPC 2 <backspace>
. 2 5 SPC 3 0 ) <S-return> <return> C-p C-p C-n C-n
C-p RET C-/ M-x t w i t <return> i ESC ESC ESC ESC
ESC ESC ESC ESC ESC ESC ESC ESC ESC ESC ESC ESC C-p
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-a C-n C-f C-f C-f C-f <return> v
i C-v C-x k <return> C-a M-< <return> C-p <return>
C-n q C-n C-n M-x g n u s <return> <return> q M-B C-x
d ~ / C-j <S-backspace> + t e s t <return> a M-! t
p <backspace> <backspace> e c h o SPC f o o SPC > S-SPC
f o o ; SPC e h o SPC b <backspace> <backspace> <backspace>
<backspace> c h o SPC b a r SPC b a r SPC > S-SPC b
a r ; SPC e c h o SPC b a z SPC b a z SPC b a z SPC
> S-SPC b a z <return> g C-p C-n M-: C-g M-( ( p r
o g n SPC ( m e s s a g e S-SPC C-g M-( M-p M-p M-n
C-e <return> C-x b m e s s <return> M-x r e [ p r =
e <backspace> <backspace> <backspace> <backspace> <backspace>
p o r t e m <tab> <backspace> <backspace> - e m <tab>
b u <tab> <return> C-g C-x b <return> k M-( C-h C-g
C-h k C-g C-g M-( C-g C-h k M-( C-x 1 M-x M-p <return>
d i C-g C-g C-h k M-( C-g C-x 1 M-x M-p <return>

Recent messages:
name=foo;inode=0;s=0;mode=-rw-rw-r--;nlink=1;uid=mcafee;gid=1;size=0;time=
mcafee     4 Jan 27 18:31;sym=
0 '(progn (message
name=%s;inode=%s;s=%s;mode=%s;nlink=%s;uid=%s;gid=%s;size=%s;time=%s;sym=%s
name inode s mode nlink uid gid size time sym) nil) files marked.
Quit
Killed 0 lines.
Quit
Type C-x 1 to delete the help window.
Quit [2 times]

Quit [2 times]
Type C-x 1 to delete the help window, C-M-v to scroll help.
Quit

Load-path shadows: