GNU bug report logs - #15776
On Mac OS X 10.9 Mavericks, Cocoa Emacs starts in the root directory instead of the home directory

Previous Next

Package: emacs;

Reported by: Fazal Majid <majid <at> apsalar.com>

Date: Fri, 1 Nov 2013 06:25:01 UTC

Severity: normal

Merged with 15607

Done: Jan Djärv <jan.h.d <at> swipnet.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15776 in the body.
You can then email your comments to 15776 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15776; Package emacs. (Fri, 01 Nov 2013 06:25:09 GMT) Full text and rfc822 format available.

Acknowledgement sent to Fazal Majid <majid <at> apsalar.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 01 Nov 2013 06:25:10 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Fazal Majid <majid <at> apsalar.com>
To: bug-gnu-emacs <at> gnu.org
Subject: On Mac OS X 10.9 Mavericks,
 Cocoa Emacs starts in the root directory instead of the home directory
Date: Thu, 31 Oct 2013 23:04:46 -0700
I have a build of GNU Emacs for the Mac. On 10.8 Mountain Lion, launching the app works normally - the working directory is my home directory. On 10.9 Mavericks. when launched from the Dock or Finder, the default directory is the root directory instead of my home directory. If launched from the command-line, the correct behavior holds.

It looks like there is custom code in src/emacs.c #ifdef-ed for HAVE_NS and NS_IMPL_COCOA that checks to see if the first or second command-line argument starts with “-psn”, and if so, perform a chdir(getenv(“HOME”)).

It seems like the behavior changes in Mavericks, and apps no longer get the -psn command-line argument. Apps are always launched with a cwd of /, even in Mountain Lion, but now Emacs is not taking corrective action.

The solution is probably to do a version check of OS X and if 10.9 or above, do the chdir anyway.

Here is the patch I am using, which is cruder, as it does not check for OS X version:

--- emacs-24.3/src/emacs.c.dist	2013-10-31 22:36:23.000000000 -0700
+++ emacs-24.3/src/emacs.c	2013-10-31 23:00:45.000000000 -0700
@@ -1173,6 +1173,9 @@
               chdir (getenv ("HOME"));
             }
         }
+      /* On Mavericks, there is no -psn command-line argument so do this anyway,
+         otherwise the CWD would be the root directory */
+      chdir (getenv ("HOME"));
 #endif  /* COCOA */
     }
 #endif /* HAVE_NS */


— Fazal Majid

In GNU Emacs 24.3.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00)
 of 2013-10-31 on undr.majid.org
Windowing system distributor `Apple', version 10.3.1265
Configured using:
 `configure '--prefix' '/usr/local' '--with-ns' '--with-gif=no'
 '--x-includes=/usr/X11R6/include' '--x-libraries=/usr/X11R6/lib'
 '--with-xpm' 'CC=clang''

Important settings:
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x C-f C-g M-x r e p <tab> o <tab> r <tab> <retur
n>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Making completion list... [2 times]

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr warnings emacsbug message format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils help-mode server disp-table ps-print
ps-def lpr vc vc-dispatcher python rx comint ring ansi-color cc-mode
cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs time-date tooltip ediff-hook vc-hooks lisp-float-type
mwheel ns-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process ns multi-tty emacs)

--
Fazal Majid
CTO, Apsalar Inc.
majid <at> apsalar.com
+1 415 347-1277 (347-1APP)





Reply sent to Jan Djärv <jan.h.d <at> swipnet.se>:
You have taken responsibility. (Fri, 01 Nov 2013 08:20:01 GMT) Full text and rfc822 format available.

Notification sent to Fazal Majid <majid <at> apsalar.com>:
bug acknowledged by developer. (Fri, 01 Nov 2013 08:20:03 GMT) Full text and rfc822 format available.

Message #10 received at 15776-done <at> debbugs.gnu.org (full text, mbox):

From: Jan Djärv <jan.h.d <at> swipnet.se>
To: Fazal Majid <majid <at> apsalar.com>
Cc: 15776-done <at> debbugs.gnu.org
Subject: Re: bug#15776: On Mac OS X 10.9 Mavericks,
 Cocoa Emacs starts in the root directory instead of the home directory
Date: Fri, 1 Nov 2013 09:19:04 +0100
Hello.

This is fixed in the trunk.

	Jan D.

1 nov 2013 kl. 07:04 skrev Fazal Majid <majid <at> apsalar.com>:

> I have a build of GNU Emacs for the Mac. On 10.8 Mountain Lion, launching the app works normally - the working directory is my home directory. On 10.9 Mavericks. when launched from the Dock or Finder, the default directory is the root directory instead of my home directory. If launched from the command-line, the correct behavior holds.
> 
> It looks like there is custom code in src/emacs.c #ifdef-ed for HAVE_NS and NS_IMPL_COCOA that checks to see if the first or second command-line argument starts with “-psn”, and if so, perform a chdir(getenv(“HOME”)).
> 
> It seems like the behavior changes in Mavericks, and apps no longer get the -psn command-line argument. Apps are always launched with a cwd of /, even in Mountain Lion, but now Emacs is not taking corrective action.
> 
> The solution is probably to do a version check of OS X and if 10.9 or above, do the chdir anyway.
> 
> Here is the patch I am using, which is cruder, as it does not check for OS X version:
> 
> --- emacs-24.3/src/emacs.c.dist	2013-10-31 22:36:23.000000000 -0700
> +++ emacs-24.3/src/emacs.c	2013-10-31 23:00:45.000000000 -0700
> @@ -1173,6 +1173,9 @@
>               chdir (getenv ("HOME"));
>             }
>         }
> +      /* On Mavericks, there is no -psn command-line argument so do this anyway,
> +         otherwise the CWD would be the root directory */
> +      chdir (getenv ("HOME"));
> #endif  /* COCOA */
>     }
> #endif /* HAVE_NS */
> 
> 
> — Fazal Majid
> 
> In GNU Emacs 24.3.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00)
> of 2013-10-31 on undr.majid.org
> Windowing system distributor `Apple', version 10.3.1265
> Configured using:
> `configure '--prefix' '/usr/local' '--with-ns' '--with-gif=no'
> '--x-includes=/usr/X11R6/include' '--x-libraries=/usr/X11R6/lib'
> '--with-xpm' 'CC=clang''
> 
> Important settings:
>  locale-coding-system: nil
>  default enable-multibyte-characters: t
> 
> Major mode: Fundamental
> 
> Minor modes in effect:
>  tooltip-mode: t
>  mouse-wheel-mode: t
>  menu-bar-mode: t
>  file-name-shadow-mode: t
>  global-font-lock-mode: t
>  blink-cursor-mode: t
>  auto-composition-mode: t
>  auto-encryption-mode: t
>  auto-compression-mode: t
>  buffer-read-only: t
>  line-number-mode: t
>  transient-mark-mode: t
> 
> Recent input:
> C-x C-f C-g M-x r e p <tab> o <tab> r <tab> <retur
> n>
> 
> Recent messages:
> For information about GNU Emacs and the GNU system, type C-h C-a.
> Quit
> Making completion list... [2 times]
> 
> Load-path shadows:
> None found.
> 
> Features:
> (shadow sort gnus-util mail-extr warnings emacsbug message format-spec
> rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
> mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
> mm-util mail-prsvr mail-utils help-mode server disp-table ps-print
> ps-def lpr vc vc-dispatcher python rx comint ring ansi-color cc-mode
> cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
> cc-vars cc-defs time-date tooltip ediff-hook vc-hooks lisp-float-type
> mwheel ns-win tool-bar dnd fontset image regexp-opt fringe
> tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
> timer select scroll-bar mouse jit-lock font-lock syntax facemenu
> font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
> thai tai-viet lao korean japanese hebrew greek romanian slovak czech
> european ethiopic indian cyrillic chinese case-table epa-hook
> jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
> cus-face macroexp files text-properties overlay sha1 md5 base64 format
> env code-pages mule custom widget hashtable-print-readable backquote
> make-network-process ns multi-tty emacs)
> 
> --
> Fazal Majid
> CTO, Apsalar Inc.
> majid <at> apsalar.com
> +1 415 347-1277 (347-1APP)
> 
> 
> 





Merged 15607 15776. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 01 Nov 2013 16:08:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 30 Nov 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 199 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.