From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Fazal Majid Newsgroups: gmane.emacs.bugs Subject: bug#15776: 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 Message-ID: <8836FBC9-C1AB-4B94-AC54-86FB8FDC559C@apsalar.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1816\)) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1383287127 31398 80.91.229.3 (1 Nov 2013 06:25:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Nov 2013 06:25:27 +0000 (UTC) To: 15776@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 01 07:25:29 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vc8Ah-0007DV-2d for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Nov 2013 07:25:27 +0100 Original-Received: from localhost ([::1]:60493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vc8Ag-00015h-ML for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Nov 2013 02:25:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vc8AX-00015W-4b for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2013 02:25:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vc8AR-0008Dm-1u for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2013 02:25:17 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vc8AQ-0008Di-Us for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2013 02:25:10 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Vc8AP-0001nB-57 for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2013 02:25:09 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Fazal Majid Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Nov 2013 06:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15776 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13832870636826 (code B ref -1); Fri, 01 Nov 2013 06:25:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Nov 2013 06:24:23 +0000 Original-Received: from localhost ([127.0.0.1]:56270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vc89e-0001lz-Bq for submit@debbugs.gnu.org; Fri, 01 Nov 2013 02:24:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49873) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vc7r5-0001K6-Eo for submit@debbugs.gnu.org; Fri, 01 Nov 2013 02:05:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vc7qu-0005c0-1S for submit@debbugs.gnu.org; Fri, 01 Nov 2013 02:05:06 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:42604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vc7qt-0005bU-TT for submit@debbugs.gnu.org; Fri, 01 Nov 2013 02:04:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vc7qo-0004O6-85 for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2013 02:04:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vc7qf-0005GU-Hm for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2013 02:04:54 -0400 Original-Received: from mail-pd0-f169.google.com ([209.85.192.169]:60012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vc7qf-0005Fz-B8 for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2013 02:04:45 -0400 Original-Received: by mail-pd0-f169.google.com with SMTP id q10so3424583pdj.14 for ; Thu, 31 Oct 2013 23:04:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:content-transfer-encoding :subject:message-id:date:to:mime-version; bh=fpLf6uU4sS9WFgHyptlpGaSf4Zk1D0avgT39LZ08al8=; b=JdvxADf/LjUM1m2QZK9FwxhvDnh9wKAvAzZ5r3o2tGOmiL3lVKPMWHqQhuuEQeRAIS fZ2TO/9DAdjONud5SDMOhfq4BZE9nnEbBHSnr3Bly2RHhScchPmG2+4iJHpaJfsLYKFa 6G/30crA+NrAHNgZUT+UxKgw/T2XZeYOHp5VUlzDd1Y08lvmALbg7UMbv7Ty8pr6ZJrT RI0PNigPtHPscMoqZez4ceE0xPt68070pSARanfzf83fTHpO/ZHFwUxBvA9kjefLDNKU HCoSnUIOUnR4rWJT5UFx4yH+vqm+2vSEu0evIA12pjWLFsXVcQkKo4Jqem2JxCf9L6nT hZQQ== X-Gm-Message-State: ALoCoQnQLuwG8wYhCTLkdSJRxPD8Z60Zf5ZqUYbewJ9vPecnvNt7KarblaC88gyOzuZ4f6Hv2iRw X-Received: by 10.66.141.199 with SMTP id rq7mr1539127pab.9.1383285883588; Thu, 31 Oct 2013 23:04:43 -0700 (PDT) Original-Received: from undr.majid.org (m208-9.dsl.rawbw.com. [198.144.208.9]) by mx.google.com with ESMTPSA id qw8sm8426720pbb.27.2013.10.31.23.04.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Oct 2013 23:04:42 -0700 (PDT) X-Mailer: Apple Mail (2.1816) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Fri, 01 Nov 2013 02:24:20 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:79844 Archived-At: 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 =93-psn=94, and if so, perform a = chdir(getenv(=93HOME=94)). 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 */ =97 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=3Dno' '--x-includes=3D/usr/X11R6/include' '--x-libraries=3D/usr/X11R6/lib' '--with-xpm' 'CC=3Dclang'' 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 o r 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@apsalar.com +1 415 347-1277 (347-1APP)