all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 56443@debbugs.gnu.org, sje30@cam.ac.uk
Subject: bug#56443: 28.1; Mac segmentation fault with ffap
Date: Fri, 08 Jul 2022 11:54:04 +0200	[thread overview]
Message-ID: <m11quw0w1v.fsf@yahoo.es> (raw)
In-Reply-To: <83sfnc40yi.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 08 Jul 2022 08:39:49 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>
> That's not NULL, that's nil (which is represented as zero).
>
> But I don't understand how could that happen, because
> Ffile_name_case_insensitive_p checks the argument for validity:
>
>   DEFUN ("file-name-case-insensitive-p", Ffile_name_case_insensitive_p,
> 	 Sfile_name_case_insensitive_p, 1, 1, 0,
> 	 doc: /* Return t if file FILENAME is on a case-insensitive filesystem.
>   Return nil if FILENAME does not exist or is not on a case-insensitive
>   filesystem, or if there was trouble determining whether the filesystem
>   is case-insensitive.  */)
>     (Lisp_Object filename)
>   {
>     Lisp_Object handler;
>
>     CHECK_STRING (filename);  <<<<<<<<<<<<<<<<<<<<<<<<<<<<
>     filename = Fexpand_file_name (filename, Qnil);
>
> So it seems like expand-file-name returned nil in this case?
>
> Can someone step through the code, including stepping into
> Fexpand_file_name, and see  how we get that nil in this case?
>
> (I tried to reproduce on my system, which is not a Mac, but I don't
> see any nil filenames in that case.)

Apparently it comes from the "parent" variable, which is the result of
the file_name_directory call:

Process 61514 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x000000010064fefc emacs`Ffile_name_case_insensitive_p(filename=0x000000011534dc44) at fileio.c:2608:18
   2605		 (impossible?).  */
   2606	      if (!NILP (Fstring_equal (parent, filename)))
   2607		return Qnil;
-> 2608	      filename = parent;
   2609	    }
   2610	}
   2611
Target 0: (emacs) stopped.
(lldb) fr v parent
(Lisp_Object) parent = NULL

Is the following expression the correct way to manually interpret the
Lisp_Object as a Lisp_String?  (where $ptr is the memory address of
"filename" in this scenario):

(char *) ((struct Lisp_String *)$ptr)->u.s.data

That prints an empty string in LLDB.

BTW, I don't really understand the semantics of
file-name-case-insensitive-p.  The docstring says that it returns nil if
the file is not found, but these calls return t on my system:

(file-name-case-insensitive-p "")
(file-name-case-insensitive-p "FileThatDoesNotExist")

Does that make sense?





  reply	other threads:[~2022-07-08  9:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07 17:18 bug#56443: 28.1; Mac segmentation fault with ffap Stephen Eglen
2022-07-07 20:36 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-08  5:39   ` Eli Zaretskii
2022-07-08  9:54     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-07-08 10:02       ` Stephen Eglen
2022-07-08 10:47         ` Eli Zaretskii
2022-07-08  9:35 ` Mattias Engdegård
2022-07-08 10:45   ` Eli Zaretskii
2022-07-08 13:14     ` Mattias Engdegård
2022-07-08 16:12       ` Stephen Eglen
2022-07-08 16:15         ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m11quw0w1v.fsf@yahoo.es \
    --to=bug-gnu-emacs@gnu.org \
    --cc=56443@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=mardani29@yahoo.es \
    --cc=sje30@cam.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.