Subject: Re: issue with Emacs 24.4.1 but not with 24.3.1 : changed on disk; really edit the buffer

From: Bertrand Brelier <[email-masked]>
Date: Thu, 22 Jan 2015 09:16:26 -0500

Hello Paul,

I followed the steps but as soon as I try to edit the file when using gdb,
the emacs windows freezes and I cannot do anything (I tried to open a local
file, not on the network, with no encryption).

Here is what I did :
pwd
/home/bertrand/Emacs/emacs-24.4/src

gdb ./emacs
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./emacs...done.
warning: File "/home/bertrand/Emacs/emacs-24.4/src/.gdbinit" auto-loading
has been declined by your `auto-load safe-path' set to
"$debugdir:$datadir/auto-load".
To enable execution of this file add
        add-auto-load-safe-path /home/bertrand/Emacs/emacs-24.4/src/.gdbinit
line to your configuration file "/home/bertrand/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/bertrand/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the
shell:
        info "(gdb)Auto-loading safe path"
(gdb) source .gdbinit
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not from
terminal]
DISPLAY = localhost:10.0
TERM = xterm
Breakpoint 1 at 0x5432ba: file emacs.c, line 351.
Temporary breakpoint 2 at 0x56507f: file sysdep.c, line 850.
(gdb) b fileio.c:5338
Breakpoint 3 at 0x58e027: file fileio.c, line 5338.
(gdb) r
Starting program: /home/bertrand/Emacs/emacs-24.4/src/emacs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffea11c700 (LWP 2263)]

** (emacs:2259): WARNING **: Couldn't connect to accessibility bus: Failed
to connect to socket /tmp/dbus-eho0AgRKqo: Connection refused
[New Thread 0x7fffe928d700 (LWP 2265)]
[New Thread 0x7fffe8a8c700 (LWP 2267)]
[New Thread 0x7fffd80a7700 (LWP 2268)]
[New Thread 0x7fffd78a6700 (LWP 2269)]
[Thread 0x7fffd78a6700 (LWP 2269) exited]
[New Thread 0x7fffd78a6700 (LWP 2270)]
[Thread 0x7fffd80a7700 (LWP 2268) exited]
[New Thread 0x7fffd80a7700 (LWP 2272)]
[Thread 0x7fffd78a6700 (LWP 2270) exited]

Breakpoint 3, Fverify_visited_file_modtime (buf=29001941) at fileio.c:5338
5338      if (timespec_cmp (mtime, b->modtime) == 0
(gdb)
(gdb) quit
A debugging session is active.

        Inferior 1 [process 2259] will be killed.

Quit anyway? (y or n) y

I had to quit the gdb session as the emacs windows froze (repeated the
procedure 3 times and it froze each time).

I thought the problem could come from the bus warning but without gdb I
have the same warning but no issue to edit the same file :
./emacs

** (emacs:2275): WARNING **: Couldn't connect to accessibility bus: Failed
to connect to socket /tmp/dbus-eho0AgRKqo: Connection refused

Any suggestions ?

Thank you for your help,

Cheers,

Bertrand

On Wed, Jan 21, 2015 at 9:20 PM, Paul Eggert <[email-masked]> wrote:

> Sorry, I'm still having trouble seeing what the bug is. strace doesn't
> output full time stamps; it tells us their values only to the nearest
> second.
> Can you run Emacs under a debugger?  Here's a recipe, if you have the time:
>
> $ wget ftp://ftp.gnu.org/gnu/emacs/emacs-24.4.tar.xz
> $ tar xf emacs-24.4.tar.xz
> $ cd emacs-24.4
> $ ./configure CFLAGS='-g3 -O0'
> $ make
> $ cd src
> $ gdb emacs
> (gdb) source .gdbinit
> (gdb) b fileio.c:5338
> (gdb) r
> [ Now edit the file in Emacs, until the breakpoint is hit. ]
> (gdb) p mtime
> (gdb) p b->modtime
>
> I just now tried all that and got:
>
> (gdb) p mtime
> $5 = {
>   tv_sec = 1421893112,
>   tv_nsec = 705816459
> }
> (gdb) p b->modtime
> $6 = {
>   tv_sec = 1421893112,
>   tv_nsec = 705816459
> }
>
> which is what I'd expect: the last-modified time of the file (mtime)
> equals the buffer's opinion of it (b->modtime). What do you get?
>