GNU bug report logs - #1009
Carbon: posix-file-name-to-mac

Previous Next

Package: emacs22;

Reported by: David Reitter <david.reitter <at> gmail.com>

Date: Sat, 20 Sep 2008 12:40:05 UTC

Severity: normal

Done: Glenn Morris <rgm <at> gnu.org>

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 1009 in the body.
You can then email your comments to 1009 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1009; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to David Reitter <david.reitter <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: David Reitter <david.reitter <at> gmail.com>
To: emacs-pretest-bug <at> gnu.org
Subject: Carbon: posix-file-name-to-mac
Date: Sat, 20 Sep 2008 08:33:22 -0400
[Message part 1 (text/plain, inline)]
(posix-file-name-to-mac "~emacs/asd")
(posix-file-name-to-mac "/tmp/")

will crash a 22 branch Carbon Emacs.

A fix is below - it disables ~emacs and /tmp expansion when getpwnam  
or get_temp_dir_name return NULL, which they seem to do.
(OS X has /tmp, so I'm not sure if the code isn't leftover from MacOS  
and stopped working at some point.)

- D





Index: mac.c
===================================================================
RCS file: /sources/emacs/emacs/src/Attic/mac.c,v
retrieving revision 1.77.2.10
diff -c -r1.77.2.10 mac.c
*** mac.c	29 Aug 2008 08:18:07 -0000	1.77.2.10
--- mac.c	20 Sep 2008 12:29:24 -0000
***************
*** 214,237 ****
    if (strncmp (p, "~emacs/", 7) == 0)
      {
        struct passwd *pw = getpwnam ("emacs");
!       p += 7;
!       if (strlen (pw->pw_dir) + strlen (p) > MAXPATHLEN)
! 	return 0;
!       strcpy (expanded_pathname, pw->pw_dir);
!       strcat (expanded_pathname, p);
!       p = expanded_pathname;
!         /* now p points to the pathname with emacs dir prefix */
      }
    else if (strncmp (p, "/tmp/", 5) == 0)
      {
        char *t = get_temp_dir_name ();
!       p += 5;
!       if (strlen (t) + strlen (p) > MAXPATHLEN)
! 	return 0;
!       strcpy (expanded_pathname, t);
!       strcat (expanded_pathname, p);
!       p = expanded_pathname;
!         /* now p points to the pathname with emacs dir prefix */
      }
    else if (*p != '/')  /* relative pathname */
      strcat (mfn, ":");
--- 215,244 ----
    if (strncmp (p, "~emacs/", 7) == 0)
      {
        struct passwd *pw = getpwnam ("emacs");
!       if (pw != NULL)
! 	{
! 	  p += 7;
! 	  if (strlen (pw->pw_dir) + strlen (p) > MAXPATHLEN)
! 	    return 0;
! 	  strcpy (expanded_pathname, pw->pw_dir);
! 	  strcat (expanded_pathname, p);
! 	  p = expanded_pathname;
! 	  /* now p points to the pathname with emacs dir prefix */
! 	}
      }
    else if (strncmp (p, "/tmp/", 5) == 0)
      {
        char *t = get_temp_dir_name ();
!       if (t != NULL)
! 	{
! 	  p += 5;
! 	  if (strlen (t) + strlen (p) > MAXPATHLEN)
! 	    return 0;
! 	  strcpy (expanded_pathname, t);
! 	  strcat (expanded_pathname, p);
! 	  p = expanded_pathname;
! 	  /* now p points to the pathname with emacs dir prefix */
! 	}
      }
    else if (*p != '/')  /* relative pathname */
      strcat (mfn, ":");

[smime.p7s (application/pkcs7-signature, attachment)]

bug reassigned from package `emacs' to `emacs22'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Sat, 20 Sep 2008 20:20:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, don <at> donarmstrong.com:
bug#1009; Package emacs22. Full text and rfc822 format available.

Acknowledgement sent to YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>:
Extra info received and forwarded to list. Copy sent to don <at> donarmstrong.com. Full text and rfc822 format available.

Message #12 received at 1009 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: David Reitter <david.reitter <at> gmail.com>, 1009 <at> debbugs.gnu.org
Subject: Re: bug#1009: Carbon: posix-file-name-to-mac
Date: Mon, 22 Sep 2008 10:25:12 +0900
>>>>> On Sat, 20 Sep 2008 08:33:22 -0400, David Reitter <david.reitter <at> gmail.com> said:

> (posix-file-name-to-mac "~emacs/asd")
> (posix-file-name-to-mac "/tmp/")

> will crash a 22 branch Carbon Emacs.

> A fix is below - it disables ~emacs and /tmp expansion when getpwnam
> or get_temp_dir_name return NULL, which they seem to do.  (OS X has
> /tmp, so I'm not sure if the code isn't leftover from MacOS and
> stopped working at some point.)

Thanks.  Maybe posix-file-name-to-mac and mac-file-name-to-posix
should have been made Mac OS Classic only.  Actually, they have
already been removed from my local tree, because they are using some
functions that are not available on 64-bit environment.  Do you have
some use cases of them on Mac OS X?

I'm not sure if changes to the EMACS_22_BASE branch is still
allowed.  Please apply your patch if so.

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Thu, 10 Mar 2011 06:48:01 GMT) Full text and rfc822 format available.

Notification sent to David Reitter <david.reitter <at> gmail.com>:
bug acknowledged by developer. (Thu, 10 Mar 2011 06:48:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: 1009-done <at> debbugs.gnu.org
Subject: Re: bug#1009: Carbon: posix-file-name-to-mac
Date: Thu, 10 Mar 2011 01:47:15 -0500
Thanks for the report. Emacs 22 is very old and has not been supported
for some time. The latest version is 23.3. Please open new reports for
any issues you have with the new version.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 07 Apr 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 133 days ago.

Previous Next


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