From unknown Sun Jun 22 08:07:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13575: 24.1; dired-mark-sexp misparses directory contents Resent-From: Sean McAfee Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Jan 2013 08:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13575 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 13575@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.135936104328444 (code B ref -1); Mon, 28 Jan 2013 08:18:01 +0000 Received: (at submit) by debbugs.gnu.org; 28 Jan 2013 08:17:23 +0000 Received: from localhost ([127.0.0.1]:51977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tzju4-0007Og-2c for submit@debbugs.gnu.org; Mon, 28 Jan 2013 03:17:21 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55502) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tzeny-0008H2-4y for submit@debbugs.gnu.org; Sun, 27 Jan 2013 21:50:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TzenR-0002rs-EV for submit@debbugs.gnu.org; Sun, 27 Jan 2013 21:50:17 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:43864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TzenR-0002ro-Az for submit@debbugs.gnu.org; Sun, 27 Jan 2013 21:50:09 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TzenN-0005YU-0L for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2013 21:50:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TzenF-0002XQ-SU for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2013 21:50:04 -0500 Received: from mail-wg0-x22a.google.com ([2a00:1450:400c:c00::22a]:38565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TzenF-0002Vt-GP for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2013 21:49:57 -0500 Received: by mail-wg0-f42.google.com with SMTP id 12so935564wgh.1 for ; Sun, 27 Jan 2013 18:49:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=aRtOmcYByhrMWvda3J2iVZAp9fydY0fKSyJ2cmUcSxM=; b=dMNZBE7jXzacEoXiYm8frUlsP0HloT5+UwW3Gaki4bFzAimjZHNoc/WbqWQ++WzFWI 2UBnf/AsObkoUlUCM3F2S16QwN5kme5bSmPoIQkAbp44wRSm0yg4rKqFAN5lhRUainNt swXk2eSRqXgBDY8qn31k+DTS66yO/472P9iv3DR3QhQZvrv8aHiJIBZMRiBcpC/NytAp tKH0G6yF+yv1+lowqxANj61tZZFho1bSGutKvZCeT1uQkL82+sqmoe7mwZqzJXTEpk9y F2ZBLfr6alXtAbH826kgH4hV2Hyqep/Swto52wdamSCOIPxYjaN0ZxMXVQ2VOv5CscvD vidg== MIME-Version: 1.0 X-Received: by 10.180.33.202 with SMTP id t10mr7254829wii.3.1359341396024; Sun, 27 Jan 2013 18:49:56 -0800 (PST) Received: by 10.216.188.78 with HTTP; Sun, 27 Jan 2013 18:49:55 -0800 (PST) Date: Sun, 27 Jan 2013 18:49:55 -0800 Message-ID: From: Sean McAfee Content-Type: multipart/alternative; boundary=f46d04428f8a09dd4104d4505587 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Mailman-Approved-At: Mon, 28 Jan 2013 03:17:19 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --f46d04428f8a09dd4104d4505587 Content-Type: text/plain; charset=ISO-8859-1 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 * S-SPC 3 0 SPC = SPC C-u M-: ( * S-SPC 2 . 2 5 SPC 3 0 ) C-p C-p C-n C-n C-p RET C-/ M-x t w i t 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 v i C-v C-x k C-a M-< C-p C-n q C-n C-n M-x g n u s q M-B C-x d ~ / C-j + t e s t a M-! t p e c h o SPC f o o SPC > S-SPC f o o ; SPC e h o SPC b 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 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 C-x b m e s s M-x r e [ p r = e p o r t e m - e m b u C-g C-x b 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 d i C-g C-g C-h k M-( C-g C-x 1 M-x M-p 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: --f46d04428f8a09dd4104d4505587 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This bug report will be sent to the Bug-GNU-Emacs mailing list
and the G= NU bug tracker at debb= ugs.gnu.org.=A0 Please check that
the From: line contains a valid em= ail address.=A0 After a delay of up
to one day, you should receive an acknowledgement at that address.

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

Please describe exactly wh= at actions triggered the bug, and
the precise symptoms of the bug.=A0 If you can, give a recipe
starting f= rom `emacs -Q':

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

Here's a test directory I se= t up:

=A0 /home/mcafee/test:
=A0 total used in directory 28 avail= able 102379756
=A0 drwxrwxr-x=A0 2 mcafee mcafee=A0 4096 Jan 27 18:31 .
=A0 drwxr-xr-x 44 mcafee mcafee 12288 Jan 27 18:31 ..
=A0 -rw-rw-r--=A0 = 1 mcafee mcafee=A0=A0=A0=A0 8 Jan 27 18:31 bar
=A0 -rw-rw-r--=A0 1 mcafe= e mcafee=A0=A0=A0 12 Jan 27 18:31 baz
=A0 -rw-rw-r--=A0 1 mcafee mcafee= =A0=A0=A0=A0 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 (messa= ge "name=3D%s;inode=3D%s;s=3D%s;mode=3D%s;nlink=3D%s;uid=3D%s;gid=3D%s= ;size=3D%s;time=3D%s;sym=3D%s" name inodes mode nlink uid gid size tim= e sym) nil)

Here are the messages that were produced:
name=3D.;inode=3D0;s=3D0;m= ode=3Ddrwxrwxr-x;nlink=3D2;uid=3Dmcafee;gid=3D2;size=3D0;time=3D mcafee=A0 = 4096 Jan 27 18:31;sym=3D
name=3D..;inode=3D0;s=3D0;mode=3Ddrwxr-xr-x;nli= nk=3D44;uid=3Dmcafee;gid=3D44;size=3D0;time=3D mcafee 12288 Jan 27 18:31;sy= m=3D
name=3Dbar;inode=3D0;s=3D0;mode=3D-rw-rw-r--;nlink=3D1;uid=3Dmcafee;gid=3D1= ;size=3D0;time=3D mcafee=A0=A0=A0=A0 8 Jan 27 18:31;sym=3D
name=3Dbaz;in= ode=3D0;s=3D0;mode=3D-rw-rw-r--;nlink=3D1;uid=3Dmcafee;gid=3D1;size=3D0;tim= e=3D mcafee=A0=A0=A0 12 Jan 27 18:31;sym=3D
name=3Dfoo;inode=3D0;s=3D0;m= ode=3D-rw-rw-r--;nlink=3D1;uid=3Dmcafee;gid=3D1;size=3D0;time=3D mcafee=A0= =A0=A0=A0 4 Jan 27 18:31;sym=3D

Clearly, the "time" variable includes more of the directory l= isting than
it should, and "size" is incorrectly set to zero f= or 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:
=A0=A0=A0 `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)
=A0of 2012-09-22 on batsu, modified by Debian
Windowing system distribut= or `The X.Org Foundation', version 11.0.11300000
Configured using:=A0`configure '--build' 'x86_64-linux-gnu' '--build&#= 39; 'x86_64-linux-gnu'
=A0'--prefix=3D/usr' '--sharedstatedir=3D/var/lib' '--l= ibexecdir=3D/usr/lib'
=A0'--localstatedir=3D/var/lib' '-= -infodir=3D/usr/share/info'
=A0'--mandir=3D/usr/share/man' &= #39;--with-pop=3Dyes'
=A0'--enable-locallisppath=3D/etc/emacs24:/etc/emacs:/usr/local/share/e= macs/24.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1/= site-lisp:/usr/share/emacs/site-lisp'
=A0'--with-crt-dir=3D/usr/= lib/x86_64-linux-gnu' '--with-x=3Dyes'
=A0'--with-x-toolkit=3Dgtk' '--with-toolkit-scroll-bars'=A0'build_alias=3Dx86_64-linux-gnu' 'CFLAGS=3D-g -O2 -fstack-p= rotector
=A0--param=3Dssp-buffer-size=3D4 -Wformat -Werror=3Dformat-secu= rity -Wall -O2'
=A0'CPPFLAGS=3D-D_FORTIFY_SOURCE=3D2''

Important setting= s:
=A0 value of $LC_ALL: nil
=A0 value of $LC_COLLATE: nil
=A0 val= ue of $LC_CTYPE: nil
=A0 value of $LC_MESSAGES: nil
=A0 value of $LC_= MONETARY: nil
=A0 value of $LC_NUMERIC: nil
=A0 value of $LC_TIME: nil
=A0 value of= $LANG: en_US.UTF-8
=A0 value of $XMODIFIERS: nil
=A0 locale-coding-s= ystem: utf-8-unix
=A0 default enable-multibyte-characters: t

Majo= r mode: Dired by name

Minor modes in effect:
=A0 gnus-dired-mode: t
=A0 recentf-mode: t=
=A0 shell-dirtrack-mode: t
=A0 minibuffer-depth-indicate-mode: t
= =A0 ido-everywhere: t
=A0 global-undo-tree-mode: t
=A0 diff-auto-refi= ne-mode: t
=A0 desktop-save-mode: t
=A0 tooltip-mode: t
=A0 mouse-wheel-mode: t<= br>=A0 menu-bar-mode: t
=A0 file-name-shadow-mode: t
=A0 global-font-= lock-mode: t
=A0 font-lock-mode: t
=A0 blink-cursor-mode: t
=A0 au= to-composition-mode: t
=A0 auto-encryption-mode: t
=A0 auto-compression-mode: t
=A0 line-num= ber-mode: t
=A0 transient-mark-mode: t

Recent input:
y SPC =3D= SPC . 2 5 SPC =3D SPC <backspace> <backspace>
* S-SPC 3 0 = SPC =3D 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 E= SC 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 &l= t;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-ba= ckspace> + 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&g= t;
<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 &l= t;return> g C-p C-n M-: C-g M-( ( p r
o g n SPC ( m e s s a g e S-SP= C 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 =3D
e <backspace> <backspace> <backspace> <backspace> &= lt;backspace>
p o r t e m <tab> <backspace> <backspac= e> - e m <tab>
b u <tab> <return> C-g C-x b <re= turn> 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:
nam= e=3Dfoo;inode=3D0;s=3D0;mode=3D-rw-rw-r--;nlink=3D1;uid=3Dmcafee;gid=3D1;si= ze=3D0;time=3D mcafee=A0=A0=A0=A0 4 Jan 27 18:31;sym=3D
0 '(progn (message name=3D%s;inode=3D%s;s=3D%s;mode=3D%s;nlink=3D%s;uid= =3D%s;gid=3D%s;size=3D%s;time=3D%s;sym=3D%s name inode s mode nlink uid gid= size time sym) nil) files marked.
Quit
Killed 0 lines.
Quit
Ty= pe C-x 1 to delete the help window.
Quit [2 times]

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

Load-path shadows:
--f46d04428f8a09dd4104d4505587-- From unknown Sun Jun 22 08:07:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13575: 24.1; dired-mark-sexp misparses directory contents In-Reply-To: Resent-From: Wolfgang Jenkner Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Jan 2013 19:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13575 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Sean McAfee Cc: 13575@debbugs.gnu.org Received: via spool by 13575-submit@debbugs.gnu.org id=B13575.13594011594832 (code B ref 13575); Mon, 28 Jan 2013 19:26:02 +0000 Received: (at 13575) by debbugs.gnu.org; 28 Jan 2013 19:25:59 +0000 Received: from localhost ([127.0.0.1]:52869 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TzuL8-0001Ft-QV for submit@debbugs.gnu.org; Mon, 28 Jan 2013 14:25:59 -0500 Received: from mx07.lb01.inode.at ([62.99.145.7]:27116 helo=mx.inode.at) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TzuL4-0001Fi-Qx for 13575@debbugs.gnu.org; Mon, 28 Jan 2013 14:25:57 -0500 Received: from [91.119.206.19] (port=13730 helo=iznogoud.viz) by smartmx-07.inode.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1TzuKc-0004YL-Es; Mon, 28 Jan 2013 20:25:26 +0100 Received: from wolfgang by iznogoud.viz with local (Exim 4.80.1 (FreeBSD)) (envelope-from ) id 1TzuKb-0000ct-0d; Mon, 28 Jan 2013 20:25:25 +0100 From: Wolfgang Jenkner Date: Mon, 28 Jan 2013 20:19:17 +0100 References: Message-ID: <85k3qxxg7v.fsf@iznogoud.viz> User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.4 (--) On Mon, Jan 28 2013, Sean McAfee wrote: > 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) -------^ inode s I think you have to customize dired-listing-switches to something like "-alis" so that inode number and block count are actually shown in the buffer. > 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= [...] > 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. That's a bug in dired-x (wrong use of the somewhat awkward directory-listing-before-filename-regexp variable). As a first attempt to fix this I propose the following barely tested patch. Wolfgang diff --git a/lisp/dired-x.el b/lisp/dired-x.el index a2c1303..73eebd1 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -1449,8 +1449,7 @@ to mark all zero length files." ;; to nil or the appropriate value, so they need not be initialized. ;; Moves point within the current line. (dired-move-to-filename) - (let (pos - (mode-len 10) ; length of mode string + (let ((mode-len 10) ; length of mode string ;; like in dired.el, but with subexpressions \1=inode, \2=s: (dired-re-inode-size "\\s *\\([0-9]*\\)\\s *\\([0-9]*\\) ?")) (beginning-of-line) @@ -1472,22 +1471,18 @@ to mark all zero length files." ;; Karsten Wenger fixed uid. (setq uid (buffer-substring (1+ (point)) (progn (forward-word 1) (point)))) - (re-search-forward directory-listing-before-filename-regexp) - (goto-char (match-beginning 1)) - (forward-char -1) - (setq size (string-to-number - (buffer-substring (save-excursion - (backward-word 1) - (setq pos (point))) - (point)))) - (goto-char pos) - (backward-word 1) + (re-search-forward directory-listing-before-filename-regexp) + (re-search-backward directory-listing-before-filename-regexp) + (forward-word 1) + (save-excursion + (setq size (string-to-number + (buffer-substring (point) (progn (backward-word 1) + (point)))) + gid (buffer-substring (1- (point)) (progn (backward-word 1) + (point))))) ;; if no gid is displayed, gid will be set to uid ;; but user will then not reference it anyway in PREDICATE. - (setq gid (buffer-substring (save-excursion - (forward-word 1) (point)) - (point)) - time (buffer-substring (match-beginning 1) + (setq time (buffer-substring (1+ (point)) (1- (dired-move-to-filename))) name (buffer-substring (point) (or From unknown Sun Jun 22 08:07:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13575: 24.1; dired-mark-sexp misparses directory contents In-Reply-To: Resent-From: Wolfgang Jenkner Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Jan 2013 05:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13575 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Sean McAfee Cc: 13575@debbugs.gnu.org Received: via spool by 13575-submit@debbugs.gnu.org id=B13575.135943836132043 (code B ref 13575); Tue, 29 Jan 2013 05:47:02 +0000 Received: (at 13575) by debbugs.gnu.org; 29 Jan 2013 05:46:01 +0000 Received: from localhost ([127.0.0.1]:53465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U041A-0008Ki-Mt for submit@debbugs.gnu.org; Tue, 29 Jan 2013 00:46:01 -0500 Received: from mx11.lb01.inode.at ([62.99.145.13]:30234 helo=mx.inode.at) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0417-0008KX-JG for 13575@debbugs.gnu.org; Tue, 29 Jan 2013 00:45:59 -0500 Received: from [91.119.206.19] (port=14962 helo=iznogoud.viz) by smartmx-11.inode.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1U040d-0001Lv-4Z; Tue, 29 Jan 2013 06:45:27 +0100 Received: from wolfgang by iznogoud.viz with local (Exim 4.80.1 (FreeBSD)) (envelope-from ) id 1U040b-0000XV-Rd; Tue, 29 Jan 2013 06:45:25 +0100 From: Wolfgang Jenkner Date: Tue, 29 Jan 2013 06:35:44 +0100 References: <85k3qxxg7v.fsf@iznogoud.viz> Message-ID: <85wquw8ruy.fsf@iznogoud.viz> User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.4 (--) On Mon, Jan 28 2013, Wolfgang Jenkner wrote: > As a first attempt > to fix this I propose the following barely tested patch. Or perhaps rather try the patch below, which I tested a bit with GNU and FreeBSD ls, and also with ls-lisp.el. It's still WIP but I hope it works for you. Please note that the output of "ls -lh" is parsed correctly, but the unit suffixes are simply ignored for the time being; I'll try to fix this, though. Also, specifying "-s" without also passing "-i" to "ls" will do the wrong thing: the output being ambiguous in this case, a number before the permission string is (arbitrarily) interpreted as inode number; that can't be fixed without actually looking at dired-listing-switches. Wolfgang diff --git a/lisp/dired-x.el b/lisp/dired-x.el index a2c1303..5a33479 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -1449,54 +1449,57 @@ to mark all zero length files." ;; to nil or the appropriate value, so they need not be initialized. ;; Moves point within the current line. (dired-move-to-filename) - (let (pos - (mode-len 10) ; length of mode string - ;; like in dired.el, but with subexpressions \1=inode, \2=s: - (dired-re-inode-size "\\s *\\([0-9]*\\)\\s *\\([0-9]*\\) ?")) - (beginning-of-line) - (forward-char 2) - (if (looking-at dired-re-inode-size) - (progn - (goto-char (match-end 0)) - (setq inode (string-to-number - (buffer-substring (match-beginning 1) - (match-end 1))) - s (string-to-number - (buffer-substring (match-beginning 2) - (match-end 2))))) - (setq inode nil - s nil)) + (let ((mode-len 10) ; length of mode string + ;; like in dired.el, but with subexpressions \1=inode, \2=s: + ;; GNU ls -hs suffixes the block count with a unit and + ;; prints it as a float, FreeBSD does neither. + (dired-re-inode-size "\\=\\s *\\([0-9]+\\s +\\)?\\(?:\\([0-9]+\\(?:\\.[0-9]*\\)?[BkKMGTPEZY]?\\)? ?\\)")) + (beginning-of-line) + (forward-char 2) + (search-forward-regexp dired-re-inode-size nil t) + ;; XXX Might be a size without unit. + (setq inode (when (match-string 1) + (string-to-number (match-string 1)))) + (setq s (when (match-string 2) + ;; XXX Deal with units (for the -h switch). + (string-to-number (match-string 2)))) (setq mode (buffer-substring (point) (+ mode-len (point)))) (forward-char mode-len) (setq nlink (read (current-buffer))) ;; Karsten Wenger fixed uid. - (setq uid (buffer-substring (1+ (point)) - (progn (forward-word 1) (point)))) - (re-search-forward directory-listing-before-filename-regexp) - (goto-char (match-beginning 1)) - (forward-char -1) - (setq size (string-to-number - (buffer-substring (save-excursion - (backward-word 1) - (setq pos (point))) - (point)))) - (goto-char pos) - (backward-word 1) - ;; if no gid is displayed, gid will be set to uid - ;; but user will then not reference it anyway in PREDICATE. - (setq gid (buffer-substring (save-excursion - (forward-word 1) (point)) - (point)) - time (buffer-substring (match-beginning 1) - (1- (dired-move-to-filename))) - name (buffer-substring (point) - (or - (dired-move-to-end-of-filename t) - (point))) - sym (if (looking-at " -> ") - (buffer-substring (progn (forward-char 4) (point)) - (line-end-position)) - "")) + ;; GNU ls -n right-justifies numerical UIDs and GIDs, + ;; while FreeBSD left-justifies them. Both of them + ;; right-justify all other numbers. + (setq uid (buffer-substring (progn (forward-word 1) (point)) + (progn (forward-word -1) (point)))) + (dired-move-to-filename) + (save-excursion + ;; Don't do (forward-char -1) since the regexp search will + ;; then match in the preceding line. + (setq time (buffer-substring (1- (point)) + (progn + (re-search-backward directory-listing-before-filename-regexp) + (forward-word 1) + (1+ (point)))) + ;; XXX Deal with units (for the -h switch). + size (string-to-number + (buffer-substring (point) (progn (forward-word -1) + (when (= (char-before) ?.) + (forward-char -1) + (forward-word -1)) + (point)))) + ;; if no gid is displayed, gid will be set to uid + ;; but user will then not reference it anyway in PREDICATE. + gid (buffer-substring (progn (forward-word -1) (point)) + (progn (forward-word 1) (point))))) + (setq name (buffer-substring (point) + (or + (dired-move-to-end-of-filename t) + (point))) + sym (if (looking-at " -> ") + (buffer-substring (progn (forward-char 4) (point)) + (line-end-position)) + "")) t) (eval predicate))) (format "'%s file" predicate)))) From unknown Sun Jun 22 08:07:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13575: 24.1; dired-mark-sexp misparses directory contents In-Reply-To: Resent-From: Wolfgang Jenkner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Jun 2015 13:00:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13575 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Sean McAfee Cc: 13575@debbugs.gnu.org Received: via spool by 13575-submit@debbugs.gnu.org id=B13575.143532354931518 (code B ref 13575); Fri, 26 Jun 2015 13:00:07 +0000 Received: (at 13575) by debbugs.gnu.org; 26 Jun 2015 12:59:09 +0000 Received: from localhost ([127.0.0.1]:57804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8TDo-0008CH-Nx for submit@debbugs.gnu.org; Fri, 26 Jun 2015 08:59:09 -0400 Received: from b2bqsv11.mx.upcmail.net ([62.179.121.55]:46745) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8TDl-0008Bg-EY for 13575@debbugs.gnu.org; Fri, 26 Jun 2015 08:59:07 -0400 Received: from edge12.upcmail.net ([192.168.13.82]) by b2bfep16.mx.upcmail.net (InterMail vM.8.01.05.05 201-2260-151-110-20120111) with ESMTP id <20150626125812.OEVT8608.b2bfep16-int.chello.at@edge12.upcmail.net> for <13575@debbugs.gnu.org>; Fri, 26 Jun 2015 14:58:12 +0200 Received: from iznogoud.viz ([91.119.136.147]) by edge12.upcmail.net with edge id l0ye1q00B3AzDwj0C0ye2N; Fri, 26 Jun 2015 14:58:38 +0200 X-SourceIP: 91.119.136.147 Received: from wolfgang by iznogoud.viz with local (Exim 4.85 (FreeBSD)) (envelope-from ) id 1Z8TDJ-0000WW-SI; Fri, 26 Jun 2015 14:58:37 +0200 From: Wolfgang Jenkner Date: Fri, 26 Jun 2015 14:54:10 +0200 References: <85k3qxxg7v.fsf@iznogoud.viz> <85wquw8ruy.fsf@iznogoud.viz> Message-ID: <85381elj7m.fsf@iznogoud.viz> User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Since I haven't quite been able to just totally forget about this bug, here's an updated patch instead. -- >8 -- Subject: [PATCH] Fix parsing glitches in dired-mark-sexp (bug#13575) * lisp/dired-x.el (dired-x--string-to-number): New function. (dired-mark-sexp): Use it. Tweak dired-re-inode-size. Fix usage of directory-listing-before-filename-regexp. Consider forward-word harmful and replace it. Add more verbiage in comments and doc string. --- lisp/dired-x.el | 139 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 96 insertions(+), 43 deletions(-) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index eebfa91..93e32e0 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -1396,6 +1396,20 @@ Considers buffers closer to the car of `buffer-list' to be more recent." ;; result)) +(defun dired-x--string-to-number (str) + "Like `string-to-number' but recognize trailing unit prefixes (for ls -h). +The caller should make sure that STR is valid." + (let* ((val (string-to-number str)) + (u (unless (zerop val) + (aref str (1- (length str)))))) + (when (and u (> u ?9)) + (when (= u ?k) + (setq u ?K)) + (let ((units '(?B ?K ?M ?G ?T ?P ?E ?Z ?Y))) + (while (and units (/= (pop units) u)) + (setq val (* 1024.0 val))))) + val)) + ;; Does anyone use this? - lrd 6/29/93. ;; Apparently people do use it. - lrd 12/22/97. @@ -1422,7 +1436,19 @@ For example, use (equal 0 size) -to mark all zero length files." +to mark all zero length files. + +There's an ambiguity when a single integer not followed by a unit +prefix precedes the file mode: It is then parsed as inode number +and not as block size (this always works for GNU coreutils ls). + +Another limitation is that the uid field is needed for the +function to work correctly. In particular, the field is not +present for some values of `ls-lisp-emulation'. + +This function operates only on the buffer content and does not +refer at all to the underlying file system. Contrast this with +`find-dired', which might be preferable for the task at hand." ;; Using sym="" instead of nil avoids the trap of ;; (string-match "foo" sym) into which a user would soon fall. ;; Give `equal' instead of `=' in the example, as this works on @@ -1442,23 +1468,23 @@ to mark all zero length files." ;; to nil or the appropriate value, so they need not be initialized. ;; Moves point within the current line. (dired-move-to-filename) - (let (pos - (mode-len 10) ; length of mode string - ;; like in dired.el, but with subexpressions \1=inode, \2=s: - (dired-re-inode-size "\\s *\\([0-9]*\\)\\s *\\([0-9]*\\) ?")) - (beginning-of-line) - (forward-char 2) - (if (looking-at dired-re-inode-size) - (progn - (goto-char (match-end 0)) - (setq inode (string-to-number - (buffer-substring (match-beginning 1) - (match-end 1))) - s (string-to-number - (buffer-substring (match-beginning 2) - (match-end 2))))) - (setq inode nil - s nil)) + (let ((mode-len 10) ; length of mode string + ;; like in dired.el, but with subexpressions \1=inode, \2=s: + ;; GNU ls -hs suffixes the block count with a unit and + ;; prints it as a float, FreeBSD does neither. + (dired-re-inode-size "\\=\\s *\\([0-9]+\\s +\\)?\ +\\(?:\\([0-9]+\\(?:\\.[0-9]*\\)?[BkKMGTPEZY]?\\)? ?\\)")) + (beginning-of-line) + (forward-char 2) + (search-forward-regexp dired-re-inode-size nil t) + ;; XXX Might be a size not followed by a unit prefix. + ;; We could set s to inode if it were otherwise nil, + ;; with a similar reasoning as below for setting gid to uid, + ;; but it would be even more whimsical. + (setq inode (when (match-string 1) + (string-to-number (match-string 1)))) + (setq s (when (match-string 2) + (dired-x--string-to-number (match-string 2)))) (setq mode (buffer-substring (point) (+ mode-len (point)))) (forward-char mode-len) ;; Skip any extended attributes marker ("." or "+"). @@ -1466,33 +1492,60 @@ to mark all zero length files." (forward-char 1)) (setq nlink (read (current-buffer))) ;; Karsten Wenger fixed uid. - (setq uid (buffer-substring (1+ (point)) - (progn (forward-word 1) (point)))) - (re-search-forward directory-listing-before-filename-regexp) - (goto-char (match-beginning 1)) - (forward-char -1) - (setq size (string-to-number - (buffer-substring (save-excursion - (backward-word 1) - (setq pos (point))) + ;; Another issue is that GNU ls -n right-justifies numerical + ;; UIDs and GIDs, while FreeBSD left-justifies them, so + ;; don't rely on a specific whitespace layout. Both of them + ;; right-justify all other numbers, though. + ;; XXX Return a number if the uid or gid seems to be + ;; numerical? + (setq uid (buffer-substring (progn + (skip-chars-forward " \t") + (point)) + (progn + (skip-chars-forward "^ \t") (point)))) - (goto-char pos) - (backward-word 1) - ;; if no gid is displayed, gid will be set to uid - ;; but user will then not reference it anyway in PREDICATE. - (setq gid (buffer-substring (save-excursion - (forward-word 1) (point)) + (dired-move-to-filename) + (save-excursion + (setq time + ;; The regexp below tries to match from the last + ;; digit of the size field through a space after the + ;; date. Also, dates may have different formats + ;; depending on file age, so the date column need + ;; not be aligned to the right. + (buffer-substring (save-excursion + (skip-chars-backward " \t") (point)) - time (buffer-substring (match-beginning 1) - (1- (dired-move-to-filename))) - name (buffer-substring (point) - (or - (dired-move-to-end-of-filename t) - (point))) - sym (if (looking-at-p " -> ") - (buffer-substring (progn (forward-char 4) (point)) - (line-end-position)) - "")) + (progn + (re-search-backward + directory-listing-before-filename-regexp) + (skip-chars-forward "^ \t") + (1+ (point)))) + size (dired-x--string-to-number + ;; We know that there's some kind of number + ;; before point because the regexp search + ;; above succeeded. I don't think it's worth + ;; doing an extra check for leading garbage. + (buffer-substring (point) + (progn + (skip-chars-backward "^ \t") + (point)))) + ;; If no gid is displayed, gid will be set to uid + ;; but the user will then not reference it anyway in + ;; PREDICATE. + gid (buffer-substring (progn + (skip-chars-backward " \t") + (point)) + (progn + (skip-chars-backward "^ \t") + (point))))) + (setq name (buffer-substring (point) + (or + (dired-move-to-end-of-filename t) + (point))) + sym (if (looking-at " -> ") + (buffer-substring (progn (forward-char 4) (point)) + (line-end-position)) + "")) t) (eval predicate `((inode . ,inode) -- 2.4.2 From unknown Sun Jun 22 08:07:54 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Sean McAfee Subject: bug#13575: closed (Re: bug#13575: 24.1; dired-mark-sexp misparses directory contents) Message-ID: References: <857fqd4e97.fsf@iznogoud.viz> X-Gnu-PR-Message: they-closed 13575 X-Gnu-PR-Package: emacs Reply-To: 13575@debbugs.gnu.org Date: Mon, 06 Jul 2015 13:18:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1436188682-7656-1" This is a multi-part message in MIME format... ------------=_1436188682-7656-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #13575: 24.1; dired-mark-sexp misparses directory contents which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 13575@debbugs.gnu.org. --=20 13575: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D13575 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1436188682-7656-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 13575-done) by debbugs.gnu.org; 6 Jul 2015 13:17:23 +0000 Received: from localhost ([127.0.0.1]:41613 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZC6Gw-0001yQ-03 for submit@debbugs.gnu.org; Mon, 06 Jul 2015 09:17:22 -0400 Received: from b2bfep13.mx.upcmail.net ([62.179.121.58]:54459) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZC6Gt-0001yB-Cc for 13575-done@debbugs.gnu.org; Mon, 06 Jul 2015 09:17:20 -0400 Received: from edge12.upcmail.net ([192.168.13.82]) by b2bfep13.mx.upcmail.net (InterMail vM.8.01.05.11 201-2260-151-128-20120928) with ESMTP id <20150706131712.PUYC2939.b2bfep13-int.chello.at@edge12.upcmail.net> for <13575-done@debbugs.gnu.org>; Mon, 6 Jul 2015 15:17:12 +0200 Received: from iznogoud.viz ([91.119.237.22]) by edge12.upcmail.net with edge id p1HC1q0030VgqNK0C1HCVy; Mon, 06 Jul 2015 15:17:12 +0200 X-SourceIP: 91.119.237.22 Received: from wolfgang by iznogoud.viz with local (Exim 4.85 (FreeBSD)) (envelope-from ) id 1ZC6Gi-0003B2-QI; Mon, 06 Jul 2015 15:17:08 +0200 From: Wolfgang Jenkner To: Sean McAfee Subject: Re: bug#13575: 24.1; dired-mark-sexp misparses directory contents Date: Mon, 06 Jul 2015 15:08:35 +0200 References: <85k3qxxg7v.fsf@iznogoud.viz> <85wquw8ruy.fsf@iznogoud.viz> <85381elj7m.fsf@iznogoud.viz> Message-ID: <857fqd4e97.fsf@iznogoud.viz> User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 13575-done Cc: 13575-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Version: 25.1 No complaints, so pushed. For the record, the OP's example can easily be tested like this: Yank the directory listing into some new buffer, load dired-x and call virtual-dired. Then run dired-mark-sexp as described (but correct the typo "inodes" to "inode s"). The relevant output in *Messages* is name=.;inode=nil;s=nil;mode=drwxrwxr-x;nlink=2;uid=mcafee;gid=mcafee;size=4096;time=Jan 27 18:31;sym= name=..;inode=nil;s=nil;mode=drwxr-xr-x;nlink=44;uid=mcafee;gid=mcafee;size=12288;time=Jan 27 18:31;sym= name=bar;inode=nil;s=nil;mode=-rw-rw-r--;nlink=1;uid=mcafee;gid=mcafee;size=8;time=Jan 27 18:31;sym= name=baz;inode=nil;s=nil;mode=-rw-rw-r--;nlink=1;uid=mcafee;gid=mcafee;size=12;time=Jan 27 18:31;sym= name=foo;inode=nil;s=nil;mode=-rw-rw-r--;nlink=1;uid=mcafee;gid=mcafee;size=4;time=Jan 27 18:31;sym= ------------=_1436188682-7656-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 28 Jan 2013 08:17:23 +0000 Received: from localhost ([127.0.0.1]:51977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tzju4-0007Og-2c for submit@debbugs.gnu.org; Mon, 28 Jan 2013 03:17:21 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55502) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tzeny-0008H2-4y for submit@debbugs.gnu.org; Sun, 27 Jan 2013 21:50:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TzenR-0002rs-EV for submit@debbugs.gnu.org; Sun, 27 Jan 2013 21:50:17 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:43864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TzenR-0002ro-Az for submit@debbugs.gnu.org; Sun, 27 Jan 2013 21:50:09 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TzenN-0005YU-0L for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2013 21:50:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TzenF-0002XQ-SU for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2013 21:50:04 -0500 Received: from mail-wg0-x22a.google.com ([2a00:1450:400c:c00::22a]:38565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TzenF-0002Vt-GP for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2013 21:49:57 -0500 Received: by mail-wg0-f42.google.com with SMTP id 12so935564wgh.1 for ; Sun, 27 Jan 2013 18:49:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=aRtOmcYByhrMWvda3J2iVZAp9fydY0fKSyJ2cmUcSxM=; b=dMNZBE7jXzacEoXiYm8frUlsP0HloT5+UwW3Gaki4bFzAimjZHNoc/WbqWQ++WzFWI 2UBnf/AsObkoUlUCM3F2S16QwN5kme5bSmPoIQkAbp44wRSm0yg4rKqFAN5lhRUainNt swXk2eSRqXgBDY8qn31k+DTS66yO/472P9iv3DR3QhQZvrv8aHiJIBZMRiBcpC/NytAp tKH0G6yF+yv1+lowqxANj61tZZFho1bSGutKvZCeT1uQkL82+sqmoe7mwZqzJXTEpk9y F2ZBLfr6alXtAbH826kgH4hV2Hyqep/Swto52wdamSCOIPxYjaN0ZxMXVQ2VOv5CscvD vidg== MIME-Version: 1.0 X-Received: by 10.180.33.202 with SMTP id t10mr7254829wii.3.1359341396024; Sun, 27 Jan 2013 18:49:56 -0800 (PST) Received: by 10.216.188.78 with HTTP; Sun, 27 Jan 2013 18:49:55 -0800 (PST) Date: Sun, 27 Jan 2013 18:49:55 -0800 Message-ID: Subject: 24.1; dired-mark-sexp misparses directory contents From: Sean McAfee To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=f46d04428f8a09dd4104d4505587 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 28 Jan 2013 03:17:19 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --f46d04428f8a09dd4104d4505587 Content-Type: text/plain; charset=ISO-8859-1 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 * S-SPC 3 0 SPC = SPC C-u M-: ( * S-SPC 2 . 2 5 SPC 3 0 ) C-p C-p C-n C-n C-p RET C-/ M-x t w i t 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 v i C-v C-x k C-a M-< C-p C-n q C-n C-n M-x g n u s q M-B C-x d ~ / C-j + t e s t a M-! t p e c h o SPC f o o SPC > S-SPC f o o ; SPC e h o SPC b 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 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 C-x b m e s s M-x r e [ p r = e p o r t e m - e m b u C-g C-x b 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 d i C-g C-g C-h k M-( C-g C-x 1 M-x M-p 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: --f46d04428f8a09dd4104d4505587 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This bug report will be sent to the Bug-GNU-Emacs mailing list
and the G= NU bug tracker at debb= ugs.gnu.org.=A0 Please check that
the From: line contains a valid em= ail address.=A0 After a delay of up
to one day, you should receive an acknowledgement at that address.

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

Please describe exactly wh= at actions triggered the bug, and
the precise symptoms of the bug.=A0 If you can, give a recipe
starting f= rom `emacs -Q':

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

Here's a test directory I se= t up:

=A0 /home/mcafee/test:
=A0 total used in directory 28 avail= able 102379756
=A0 drwxrwxr-x=A0 2 mcafee mcafee=A0 4096 Jan 27 18:31 .
=A0 drwxr-xr-x 44 mcafee mcafee 12288 Jan 27 18:31 ..
=A0 -rw-rw-r--=A0 = 1 mcafee mcafee=A0=A0=A0=A0 8 Jan 27 18:31 bar
=A0 -rw-rw-r--=A0 1 mcafe= e mcafee=A0=A0=A0 12 Jan 27 18:31 baz
=A0 -rw-rw-r--=A0 1 mcafee mcafee= =A0=A0=A0=A0 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 (messa= ge "name=3D%s;inode=3D%s;s=3D%s;mode=3D%s;nlink=3D%s;uid=3D%s;gid=3D%s= ;size=3D%s;time=3D%s;sym=3D%s" name inodes mode nlink uid gid size tim= e sym) nil)

Here are the messages that were produced:
name=3D.;inode=3D0;s=3D0;m= ode=3Ddrwxrwxr-x;nlink=3D2;uid=3Dmcafee;gid=3D2;size=3D0;time=3D mcafee=A0 = 4096 Jan 27 18:31;sym=3D
name=3D..;inode=3D0;s=3D0;mode=3Ddrwxr-xr-x;nli= nk=3D44;uid=3Dmcafee;gid=3D44;size=3D0;time=3D mcafee 12288 Jan 27 18:31;sy= m=3D
name=3Dbar;inode=3D0;s=3D0;mode=3D-rw-rw-r--;nlink=3D1;uid=3Dmcafee;gid=3D1= ;size=3D0;time=3D mcafee=A0=A0=A0=A0 8 Jan 27 18:31;sym=3D
name=3Dbaz;in= ode=3D0;s=3D0;mode=3D-rw-rw-r--;nlink=3D1;uid=3Dmcafee;gid=3D1;size=3D0;tim= e=3D mcafee=A0=A0=A0 12 Jan 27 18:31;sym=3D
name=3Dfoo;inode=3D0;s=3D0;m= ode=3D-rw-rw-r--;nlink=3D1;uid=3Dmcafee;gid=3D1;size=3D0;time=3D mcafee=A0= =A0=A0=A0 4 Jan 27 18:31;sym=3D

Clearly, the "time" variable includes more of the directory l= isting than
it should, and "size" is incorrectly set to zero f= or 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:
=A0=A0=A0 `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)
=A0of 2012-09-22 on batsu, modified by Debian
Windowing system distribut= or `The X.Org Foundation', version 11.0.11300000
Configured using:=A0`configure '--build' 'x86_64-linux-gnu' '--build&#= 39; 'x86_64-linux-gnu'
=A0'--prefix=3D/usr' '--sharedstatedir=3D/var/lib' '--l= ibexecdir=3D/usr/lib'
=A0'--localstatedir=3D/var/lib' '-= -infodir=3D/usr/share/info'
=A0'--mandir=3D/usr/share/man' &= #39;--with-pop=3Dyes'
=A0'--enable-locallisppath=3D/etc/emacs24:/etc/emacs:/usr/local/share/e= macs/24.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1/= site-lisp:/usr/share/emacs/site-lisp'
=A0'--with-crt-dir=3D/usr/= lib/x86_64-linux-gnu' '--with-x=3Dyes'
=A0'--with-x-toolkit=3Dgtk' '--with-toolkit-scroll-bars'=A0'build_alias=3Dx86_64-linux-gnu' 'CFLAGS=3D-g -O2 -fstack-p= rotector
=A0--param=3Dssp-buffer-size=3D4 -Wformat -Werror=3Dformat-secu= rity -Wall -O2'
=A0'CPPFLAGS=3D-D_FORTIFY_SOURCE=3D2''

Important setting= s:
=A0 value of $LC_ALL: nil
=A0 value of $LC_COLLATE: nil
=A0 val= ue of $LC_CTYPE: nil
=A0 value of $LC_MESSAGES: nil
=A0 value of $LC_= MONETARY: nil
=A0 value of $LC_NUMERIC: nil
=A0 value of $LC_TIME: nil
=A0 value of= $LANG: en_US.UTF-8
=A0 value of $XMODIFIERS: nil
=A0 locale-coding-s= ystem: utf-8-unix
=A0 default enable-multibyte-characters: t

Majo= r mode: Dired by name

Minor modes in effect:
=A0 gnus-dired-mode: t
=A0 recentf-mode: t=
=A0 shell-dirtrack-mode: t
=A0 minibuffer-depth-indicate-mode: t
= =A0 ido-everywhere: t
=A0 global-undo-tree-mode: t
=A0 diff-auto-refi= ne-mode: t
=A0 desktop-save-mode: t
=A0 tooltip-mode: t
=A0 mouse-wheel-mode: t<= br>=A0 menu-bar-mode: t
=A0 file-name-shadow-mode: t
=A0 global-font-= lock-mode: t
=A0 font-lock-mode: t
=A0 blink-cursor-mode: t
=A0 au= to-composition-mode: t
=A0 auto-encryption-mode: t
=A0 auto-compression-mode: t
=A0 line-num= ber-mode: t
=A0 transient-mark-mode: t

Recent input:
y SPC =3D= SPC . 2 5 SPC =3D SPC <backspace> <backspace>
* S-SPC 3 0 = SPC =3D 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 E= SC 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 &l= t;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-ba= ckspace> + 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&g= t;
<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 &l= t;return> g C-p C-n M-: C-g M-( ( p r
o g n SPC ( m e s s a g e S-SP= C 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 =3D
e <backspace> <backspace> <backspace> <backspace> &= lt;backspace>
p o r t e m <tab> <backspace> <backspac= e> - e m <tab>
b u <tab> <return> C-g C-x b <re= turn> 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:
nam= e=3Dfoo;inode=3D0;s=3D0;mode=3D-rw-rw-r--;nlink=3D1;uid=3Dmcafee;gid=3D1;si= ze=3D0;time=3D mcafee=A0=A0=A0=A0 4 Jan 27 18:31;sym=3D
0 '(progn (message name=3D%s;inode=3D%s;s=3D%s;mode=3D%s;nlink=3D%s;uid= =3D%s;gid=3D%s;size=3D%s;time=3D%s;sym=3D%s name inode s mode nlink uid gid= size time sym) nil) files marked.
Quit
Killed 0 lines.
Quit
Ty= pe C-x 1 to delete the help window.
Quit [2 times]

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

Load-path shadows:
--f46d04428f8a09dd4104d4505587-- ------------=_1436188682-7656-1--