bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18851: 24.4; emacs cannot be started if the current directory has be


From: Glenn Morris
Subject: bug#18851: 24.4; emacs cannot be started if the current directory has been removed
Date: Fri, 12 Jun 2015 21:29:05 -0400
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

Eli Zaretskii wrote:

> Maybe SMC cannot work with current directory removed?

It looks that way, though xsmfns.c already seems to take the necessary
precautions for that case, and a super-quick look at the libSM source
didn't show any obvious issue. The only solution I can think of is to
disable session-management in such a case:

--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -28,6 +28,7 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #include <unistd.h>
 #include <sys/param.h>
+#include <errno.h>
 #include <stdio.h>
 
 #include "lisp.h"
@@ -402,6 +403,14 @@ x_session_initialize (struct x_display_info *dpyinfo)
   SmcCallbacks callbacks;
   ptrdiff_t name_len = 0;
 
+  /* libSM seems to crash if pwd is missing - see bug#18851.  */
+  if (! get_current_dir_name ())
+    {
+      fprintf (stderr, "Disabling session management due to pwd error: %s\n",
+               emacs_strerror (errno));
+      return;
+    }
+
   ice_fd = -1;
   doing_interact = false;
 

For completeness, here's a backtrace with debug libSM and libICE included.
(What about the address-out-of-bounds in #3?)


bt:

#0  0x00007ffff12e5640 in __memcpy_ssse3_back () from /lib64/libc.so.6
#1  0x00007ffff69df80d in memcpy (__len=<optimized out>, 
    __src=<optimized out>, __dest=0x15b675c) at /usr/include/bits/string3.h:51
#2  SmcSetProperties (smcConn=<optimized out>, numProps=4, 
    props=0x7fffffff28e0) at sm_client.c:379
#3  0x0000000000536f5b in smc_save_yourself_CB (smcConn=0xea0370, 
    clientData=0x0, saveType=1, shutdown=0, interactStyle=0, fast=0)
    at xsmfns.c:262
#4  0x00007ffff69e1c5d in _SmcProcessMessage (iceConn=0xea0f90, 
    clientData=0xea0370, opcode=<optimized out>, length=<optimized out>, 
    swap=0, replyWait=<optimized out>, replyReadyRet=0x7fffffff2a00)
    at sm_process.c:241
#5  0x00007ffff67d1b97 in IceProcessMessages (iceConn=0xea0f90, replyWait=0x0, 
    replyReadyRet=0x0) at process.c:386
#6  0x00000000005367d5 in x_session_check_input (fd=11, data=0x0)
    at xsmfns.c:110
#7  0x0000000000637484 in wait_reading_process_output (time_limit=0, nsecs=0, 
    read_kbd=-1, do_display=true, wait_for_cell=..., wait_proc=0x0, 
    just_wait_proc=0) at process.c:5081
#8  0x000000000054e66b in kbd_buffer_get_event (kbp=0x7fffffff2ff8, 
    used_mouse_menu=0x7fffffff395f, end_time=0x0) at keyboard.c:3927
#9  0x000000000054ac3e in read_event_from_main_queue (end_time=0x0, 
    local_getcjmp=0x7fffffff3510, used_mouse_menu=0x7fffffff395f)
    at keyboard.c:2200
#10 0x000000000054aea3 in read_decoded_event_from_main_queue (end_time=0x0, 
    local_getcjmp=0x7fffffff3510, prev_event=..., 
    used_mouse_menu=0x7fffffff395f) at keyboard.c:2265
#11 0x000000000054c421 in read_char (commandflag=1, map=..., prev_event=..., 
    used_mouse_menu=0x7fffffff395f, end_time=0x0) at keyboard.c:2875
#12 0x0000000000558b68 in read_key_sequence (keybuf=0x7fffffff3b30, 
    bufsize=30, prompt=..., dont_downcase_last=false, 
    can_return_switch_frame=true, fix_current_buffer=true, 
    prevent_redisplay=false) at keyboard.c:9159
#13 0x0000000000548d11 in command_loop_1 () at keyboard.c:1407
#14 0x00000000005e229a in internal_condition_case (
    bfun=0x5488f2 <command_loop_1>, handlers=..., hfun=0x5480d7 <cmd_error>)
    at eval.c:1348
#15 0x00000000005485fa in command_loop_2 (ignore=...) at keyboard.c:1139
#16 0x00000000005e1a2d in internal_catch (tag=..., 
    func=0x5485d1 <command_loop_2>, arg=...) at eval.c:1108
#17 0x000000000054859a in command_loop () at keyboard.c:1118
#18 0x0000000000547cb2 in recursive_edit_1 () at keyboard.c:728
#19 0x0000000000547e3c in Frecursive_edit () at keyboard.c:799
#20 0x0000000000545c0f in main (argc=2, argv=0x7fffffff3ff8) at emacs.c:1626
#0  0x00007ffff12e5640 in __memcpy_ssse3_back () from /lib64/libc.so.6


bt full:

#1  0x00007ffff69df80d in memcpy (__len=<optimized out>, 
    __src=<optimized out>, __dest=0x15b675c) at /usr/include/bits/string3.h:51
No locals.
#2  SmcSetProperties (smcConn=<optimized out>, numProps=4, 
    props=0x7fffffff28e0) at sm_client.c:379
        _i = <optimized out>
        _j = 4
        iceConn = 0xea0f90
        pMsg = <optimized out>
        pBuf = 0x15b675c ""
        pStart = 0x15b65d0 "\004"
        bytes = 400
#3  0x0000000000536f5b in smc_save_yourself_CB (smcConn=0xea0370, 
    clientData=0x0, saveType=1, shutdown=0, interactStyle=0, fast=0)
    at xsmfns.c:262
        props =           {0x7fffffff2840,
          0x7fffffff2860,
          0x7fffffff2880,
          0x7fffffff28a0,
          0xea0a00}
        prop_ptr =           {{
            name = 0xd887e0 "CloneCommand", 
            type = 0xda4930 "LISTofARRAY8", 
            num_vals = 1, 
            vals = 0x7fffffff2700
          },
          {
            name = 0xe733b0 "Program", 
            type = 0xea0ba0 "ARRAY8", 
            num_vals = 1, 
            vals = 0x7fffffff2710
          },
          {
            name = 0xf533a0 "UserID", 
            type = 0xf54070 "ARRAY8", 
            num_vals = 1, 
            vals = 0x7fffffff2720
          },
          {
            name = 0xf54150 "RestartCommand", 
            type = 0xf54230 "LISTofARRAY8", 
            num_vals = 5, 
            vals = 0x1008d10
          },
          {
            name = 0x7fffffff28d0 "\020$|\366\377\177", 
            type = 0x712665236f658c00 <Address 0x712665236f658c00 out of 
bounds>, 
            num_vals = -159636464, 
            vals = 0x7ffff7fc6000
          }}
        values =           {{
            length = 45, 
            value = 0xea1460
          },
          {
            length = 5, 
            value = 0xe64690
          },
          {
            length = 7, 
            value = 0xe61810
          },
          {
            length = 20421677, 
            value = 0x1
          },
          {
            length = 500000000, 
            value = 0x7ffff7de44c9 <check_match.9344+89>
          },
          {
            length = 0, 
            value = 0x7ffff67c16a8
          },
          {
            length = 10, 
            value = 0x5b
          },
          {
            length = -456570963, 
            value = 0x7ffff7de4ccb <do_lookup_x+1803>
          },
          {
            length = 499925475, 
            value = 0x7fffffff27c0
          },
          {
            length = -159640236, 
            value = 0x7ffff67c2410
          },
          {
            length = -55088, 
            value = 0x7fffffff28c0
          },
          {
            length = 45, 
            value = 0x1231d
          },
          {
            length = 0, 
            value = 0x0
          },
          {
            length = -134455296, 
            value = 0x406e31
          },
          {
            length = -159634424, 
            value = 0x403e10
          },
          {
            length = 0, 
            value = 0x10000008f
          },
          {
            length = 17519331, 
            value = 0x7fffffff2988
          },
          {
            length = -54944, 
            value = 0x1
          },
          {
            length = 16, 
            value = 0x7fffffff2920
          },
          {
            length = -55232, 
            value = 0x712665236f658c00
          }}
        vp = 0x1008d10
        val_idx = 3
        vp_idx = 4
        props_idx = 4
        i = 2
        smid_opt = 0xf2c690 "--smid=26667490d-357a-48ea-b51a-9851440ed37c"
        chdir_opt = 0x0
        user_login_name = {
          i = 18634644
        }
        cwd = 0x0
#4  0x00007ffff69e1c5d in _SmcProcessMessage (iceConn=0xea0f90, 
    clientData=0xea0370, opcode=<optimized out>, length=<optimized out>, 
    swap=0, replyWait=<optimized out>, replyReadyRet=0x7fffffff2a00)
    at sm_process.c:241
        pMsg = 0xea4910
        errVal = 0 '\000'
        errOffset = -1
        smcConn = <optimized out>
#5  0x00007ffff67d1b97 in IceProcessMessages (iceConn=0xea0f90, replyWait=0x0, 
    replyReadyRet=0x0) at process.c:386
        processProc = <optimized out>
        processMsgInfo = <optimized out>
        header = 0xea4910
        replyReady = 0
        useThisReplyWait = 0x0
        retStatus = IceProcessMessagesSuccess
#6  0x00000000005367d5 in x_session_check_input (fd=11, data=0x0)
    at xsmfns.c:110
        ret = 11
#7  0x0000000000637484 in wait_reading_process_output (time_limit=0, nsecs=0, 
    read_kbd=-1, do_display=true, wait_for_cell=..., wait_proc=0x0, 
    just_wait_proc=0) at process.c:5081
        d = 0xc5cde8 <fd_callback_info+264>
        timeout_reduced_for_timers = true
        channel = 11
        nfds = 1
        Available = {
          fds_bits =             {2048,
            0 <repeats 15 times>}
        }
        Writeok = {
          fds_bits =             {0 <repeats 16 times>}
        }
        check_write = true
        check_delay = 0
        no_avail = false
        xerrno = 11
        proc = {
          i = 0
        }
        timeout = {
          tv_sec = 0, 
          tv_nsec = 499969517
        }
        end_time = {
          tv_sec = 5506081, 
          tv_nsec = 0
        }
        got_some_input = -1
        count = 2
#8  0x000000000054e66b in kbd_buffer_get_event (kbp=0x7fffffff2ff8, 
    used_mouse_menu=0x7fffffff395f, end_time=0x0) at keyboard.c:3927
        do_display = true
        obj = {
          i = 0
        }
#9  0x000000000054ac3e in read_event_from_main_queue (end_time=0x0, 
    local_getcjmp=0x7fffffff3510, used_mouse_menu=0x7fffffff395f)
    at keyboard.c:2200
        c = {
          i = 0
        }
        save_jump =           {{
            __jmpbuf =               {0,
              0,
              0,
              0,
              0,
              0,
              0,
              0}, 
            __mask_was_saved = 0, 
            __saved_mask = {
              __val =                 {0 <repeats 16 times>}
            }
          }}
        kb = 0x1dcd6500
#10 0x000000000054aea3 in read_decoded_event_from_main_queue (end_time=0x0, 
    local_getcjmp=0x7fffffff3510, prev_event=..., 
    used_mouse_menu=0x7fffffff395f) at keyboard.c:2265
        nextevt = {
          i = 13589501
        }
        frame = 0x7fffffff3270
        terminal = 0xcf5bfd
        events =           {{
            i = 13076624
          },
          {
            i = 0
          },
          {
            i = 0
          },
          {
            i = 140737488302576
          },
          {
            i = 5506081
          },
          {
            i = 499988655
          },
          {
            i = 140737488302640
          },
          {
            i = 5560959
          },
          {
            i = 13076624
          },
          {
            i = 4294967296
          },
          {
            i = 0
          },
          {
            i = 140737488302640
          },
          {
            i = 5506081
          },
          {
            i = 0
          },
          {
            i = 140737488302688
          },
          {
            i = 5587002
          }}
        n = 0
#11 0x000000000054c421 in read_char (commandflag=1, map=..., prev_event=..., 
    used_mouse_menu=0x7fffffff395f, end_time=0x0) at keyboard.c:2875
        c = {
          i = 0
        }
        jmpcount = 2
        local_getcjmp =           {{
            __jmpbuf =               {0,
              -2368210174059533009,
              17161965,
              43008,
              0,
              0,
              -2368210174200042193,
              2368209730108206383}, 
            __mask_was_saved = 0, 
            __saved_mask = {
              __val =                 {140737488303472,
                5506081,
                0,
                140737488303760,
                5643396,
                0,
                0,
                43008,
                0,
                566608,
                0,
                0,
                0,
                12476142,
                9644764,
                12476117}
            }
          }}
        save_jump =           {{
            __jmpbuf =               {16844352,
              18467472,
              5390848,
              13627136,
              20960179,
              16844352,
              13076624,
              0}, 
            __mask_was_saved = 5390848, 
            __saved_mask = {
              __val =                 {140737488303264,
                13076624,
                0,
                140737488303472,
                140737488303296,
                5506081,
                0,
                140737488303472,
                6187899,
                0,
                2,
                0,
                6600973,
                0,
                5506321,
                5390848}
            }
          }}
        tem = {
          i = 774368
        }
        save = {
          i = 0
        }
        previous_echo_area_message = {
          i = 0
        }
        also_record = {
          i = 0
        }
        reread = false
        gcpro1 = {
          next = 0x7fffffff3400, 
          var = 0x540614 <CAR_SAFE+47>, 
          nvars = 21474836480
        }
        gcpro2 = {
          next = 0xc78890 <lispsym>, 
          var = 0x7fffffff33e0, 
          nvars = 5506081
        }
        polling_stopped_here = true
        orig_kboard = 0xe9ab20
#12 0x0000000000558b68 in read_key_sequence (keybuf=0x7fffffff3b30, 
    bufsize=30, prompt=..., dont_downcase_last=false, 
    can_return_switch_frame=true, fix_current_buffer=true, 
    prevent_redisplay=false) at keyboard.c:9159
        interrupted_kboard = 0xe9ab20
        interrupted_frame = 0x12d3c50
        key = {
          i = 140737488304592
        }
        used_mouse_menu = false
        echo_local_start = 0
        last_real_key_start = 0
        keys_local_start = 0
        new_binding = {
          i = 5510211
        }
        count = 2
        t = 0
        echo_start = 0
        keys_start = 0
        current_binding = {
          i = 17524643
        }
        first_event = {
          i = 0
        }
        first_unbound = 31
        mock_input = 0
        fkey = {
          parent = {
            i = 17364467
          }, 
          map = {
            i = 17364467
          }, 
          start = 0, 
          end = 0
        }
        keytran = {
          parent = {
            i = 13581891
          }, 
          map = {
            i = 13581891
          }, 
          start = 0, 
          end = 0
        }
        indec = {
          parent = {
            i = 17364547
          }, 
          map = {
            i = 17364547
          }, 
          start = 0, 
          end = 0
        }
        shift_translated = false
        delayed_switch_frame = {
          i = 0
        }
        original_uppercase = {
          i = 13076624
        }
        original_uppercase_position = -1
        dummyflag = false
        starting_buffer = 0xcfef40
        fake_prefixed_keys = {
          i = 0
        }
        gcpro1 = {
          next = 0x0, 
          var = 0x54a6a4 <safe_run_hook_funcall+93>, 
          nvars = 26832
        }
#13 0x0000000000548d11 in command_loop_1 () at keyboard.c:1407
        cmd = {
          i = 140737488305264
        }
        keybuf =           {{
            i = 0
          },
          {
            i = 4274848
          },
          {
            i = 13076624
          },
          {
            i = 0
          },
          {
            i = 0
          },
          {
            i = 140737488305008
          },
          {
            i = 5506081
          },
          {
            i = 0
          },
          {
            i = 140737488305184
          },
          {
            i = 6187899
          },
          {
            i = 16933475
          },
          {
            i = 2
          },
          {
            i = 0
          },
          {
            i = 12914144
          },
          {
            i = 8354000
          },
          {
            i = 0
          },
          {
            i = 16933475
          },
          {
            i = 13104320
          },
          {
            i = 10674493
          },
          {
            i = 21808368
          },
          {
            i = 140737488305184
          },
          {
            i = 6186898
          },
          {
            i = 3
          },
          {
            i = 140737488305152
          },
          {
            i = 27696
          },
          {
            i = 27696
          },
          {
            i = 0
          },
          {
            i = 13104320
          },
          {
            i = 4274848
          },
          {
            i = 0
          }}
        i = 0
        prev_modiff = 0
        prev_buffer = 0x0
        already_adjusted = false
#14 0x00000000005e229a in internal_condition_case (
    bfun=0x5488f2 <command_loop_1>, handlers=..., hfun=0x5480d7 <cmd_error>)
    at eval.c:1348
        val = {
          i = 16933475
        }
        c = 0xe6b410
#15 0x00000000005485fa in command_loop_2 (ignore=...) at keyboard.c:1139
        val = {
          i = 15119072
        }
#16 0x00000000005e1a2d in internal_catch (tag=..., 
    func=0x5485d1 <command_loop_2>, arg=...) at eval.c:1108
        val = {
          i = 0
        }
        c = 0xe6b2e0
#17 0x000000000054859a in command_loop () at keyboard.c:1118
No locals.
#18 0x0000000000547cb2 in recursive_edit_1 () at keyboard.c:728
        count = 1
        val = {
          i = 140737488305616
        }
#19 0x0000000000547e3c in Frecursive_edit () at keyboard.c:799
        count = 0
        buffer = {
          i = 0
        }
#20 0x0000000000545c0f in main (argc=2, argv=0x7fffffff3ff8) at emacs.c:1626
        dummy = {
          i = 80
        }
        stack_bottom_variable = 0 '\000'
        do_initial_setlocale = true
        dumping = false
        skip_args = 0
        rlim = {
          rlim_cur = 33554432, 
          rlim_max = 18446744073709551615
        }
        no_loadup = false
        junk = 0x0
        dname_arg = 0x0
        ch_to_dir = 0x0
        original_pwd = 0x0
A debugging session is active.

        Inferior 1 [process 3610] will be killed.

Quit anyway? (y or n) 





reply via email to

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