all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name
       [not found] ` <20190708223953.3172920BD5@vcs0.savannah.gnu.org>
@ 2019-07-08 23:13   ` Stefan Monnier
  2019-07-09  2:35     ` Eli Zaretskii
  2019-07-09 22:34     ` Richard Stallman
  0 siblings, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2019-07-08 23:13 UTC (permalink / raw)
  To: Ken Brown; +Cc: emacs-devel

>     * src/fileio.c (Fexpand_file_name): Don't directly use the current
>     buffer's default-directory if it is relative.  Instead replace it
>     by its expansion relative to invocation-directory.  (Bug#36502)

I don't think invocation-directory is a better choice than any
other directory.  A relative `default-directory` value is an error.
We should signal that error rather than try and paper over it.


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name
  2019-07-08 23:13   ` [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name Stefan Monnier
@ 2019-07-09  2:35     ` Eli Zaretskii
  2019-07-09  2:40       ` Daniel Sutton
  2019-07-09  3:46       ` Stefan Monnier
  2019-07-09 22:34     ` Richard Stallman
  1 sibling, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2019-07-09  2:35 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: kbrown, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Mon, 08 Jul 2019 19:13:52 -0400
> Cc: emacs-devel@gnu.org
> 
> >     * src/fileio.c (Fexpand_file_name): Don't directly use the current
> >     buffer's default-directory if it is relative.  Instead replace it
> >     by its expansion relative to invocation-directory.  (Bug#36502)
> 
> I don't think invocation-directory is a better choice than any
> other directory.  A relative `default-directory` value is an error.
> We should signal that error rather than try and paper over it.

In the bug discussion I explained why I thought this alternative was
better.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name
  2019-07-09  2:35     ` Eli Zaretskii
@ 2019-07-09  2:40       ` Daniel Sutton
  2019-07-09  3:46       ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Daniel Sutton @ 2019-07-09  2:40 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 82 bytes --]

#36502 (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36502) if you are
inclined.

[-- Attachment #2: Type: text/html, Size: 169 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name
  2019-07-09  2:35     ` Eli Zaretskii
  2019-07-09  2:40       ` Daniel Sutton
@ 2019-07-09  3:46       ` Stefan Monnier
  2019-07-09 11:56         ` Ken Brown
  2019-07-09 14:50         ` Eli Zaretskii
  1 sibling, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2019-07-09  3:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: kbrown, emacs-devel

> In the bug discussion I explained why I thought this alternative was
> better.

I didn't see it there.  You mentioned that you preferred to avoid the
inf-loop, but that doesn't mean you prefer for expand-file-name to use
an arbitrary (hopefully) absolute file name as default
default directory over signaling an error.

In the OP's description of the problem, clearly the relative
default-directory is in error, so trying to fix this case by changing
one of Emacs core functions instead of just fixing that minor error
seems odd: most likely the minor error will have to be fixed anyway
because it will bump into other errors elsewhere or because it needs to
work with Emacs<27.

Signaling a clear error here would have helped the programmer find the
real problem and fix it quickly, whereas the patch we installed caters
to broken code, encouraging bad practices.

Don't get me wrong: this is a minor issue, and I don't think it matters
very much, but I'm rather surprised by the patch.


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name
  2019-07-09  3:46       ` Stefan Monnier
@ 2019-07-09 11:56         ` Ken Brown
  2019-07-09 14:50         ` Eli Zaretskii
  1 sibling, 0 replies; 9+ messages in thread
From: Ken Brown @ 2019-07-09 11:56 UTC (permalink / raw)
  To: Stefan Monnier, Eli Zaretskii; +Cc: Daniel Sutton, emacs-devel@gnu.org

On 7/8/2019 11:46 PM, Stefan Monnier wrote:
> Signaling a clear error here would have helped the programmer find the
> real problem and fix it quickly, whereas the patch we installed caters
> to broken code, encouraging bad practices.

FWIW, expand-file-name (before the patch) already allowed the user to specify a 
default directory that is not even a string.  This has been the case since 1997:

commit 82330e7fc0025b7eab669c19e6f4977aebe8cb13
Author: Richard M. Stallman <rms@gnu.org>
Date:   Fri Sep 5 01:21:43 1997 +0000

     (Fexpand_file_name): If default dir isn't string, use `/'.


Ken

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name
  2019-07-09  3:46       ` Stefan Monnier
  2019-07-09 11:56         ` Ken Brown
@ 2019-07-09 14:50         ` Eli Zaretskii
  2019-07-09 15:25           ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2019-07-09 14:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: kbrown, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: kbrown@cornell.edu,  emacs-devel@gnu.org
> Date: Mon, 08 Jul 2019 23:46:06 -0400
> 
> > In the bug discussion I explained why I thought this alternative was
> > better.
> 
> I didn't see it there.

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36502#46

> You mentioned that you preferred to avoid the inf-loop, but that
> doesn't mean you prefer for expand-file-name to use an arbitrary
> (hopefully) absolute file name as default default directory over
> signaling an error.

It isn't entirely arbitrary.  A relative file name can be interpreted
by taking some directory as cwd.  Is there a better candidate for that
than invocation-directory?  We cannot use "." and we cannot use nil in
this case, for obvious reasons.

> Signaling a clear error here would have helped the programmer find the
> real problem and fix it quickly, whereas the patch we installed caters
> to broken code, encouraging bad practices.

I think expand-file-name should try to avoid signaling an error as
much as possible, because it is called by many primitives and core
functions.  If we signal an error, we risk getting the users into a
situation where they cannot even shut down Emacs, let alone do
something less trivial.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name
  2019-07-09 14:50         ` Eli Zaretskii
@ 2019-07-09 15:25           ` Stefan Monnier
  2019-07-09 16:07             ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2019-07-09 15:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: kbrown, emacs-devel

> It isn't entirely arbitrary.

I'd have gone with "/", but I also consider that as arbitrary: I don't
think there can be a non-arbitrary choice here, other than signaling
an error because we don't have any information that can give us a hint
about what was the intended absolute directory.

> I think expand-file-name should try to avoid signaling an error as
> much as possible, because it is called by many primitives and core
> functions.  If we signal an error, we risk getting the users into a
> situation where they cannot even shut down Emacs, let alone do
> something less trivial.

A relative default-directory is something extremely rare, so if some
operations like C-x C-c fail in that case I wouldn't mind.


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name
  2019-07-09 15:25           ` Stefan Monnier
@ 2019-07-09 16:07             ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2019-07-09 16:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: kbrown, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: kbrown@cornell.edu,  emacs-devel@gnu.org
> Date: Tue, 09 Jul 2019 11:25:50 -0400
> 
> > It isn't entirely arbitrary.
> 
> I'd have gone with "/", but I also consider that as arbitrary: I don't
> think there can be a non-arbitrary choice here, other than signaling
> an error because we don't have any information that can give us a hint
> about what was the intended absolute directory.

I see nothing wrong with a somewhat arbitrary interpretation of such a
default-directory value.

> > I think expand-file-name should try to avoid signaling an error as
> > much as possible, because it is called by many primitives and core
> > functions.  If we signal an error, we risk getting the users into a
> > situation where they cannot even shut down Emacs, let alone do
> > something less trivial.
> 
> A relative default-directory is something extremely rare, so if some
> operations like C-x C-c fail in that case I wouldn't mind.

I agree that it is rare, but trapping the user even rarely is
something I'd like to avoid as much as reasonably possible.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name
  2019-07-08 23:13   ` [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name Stefan Monnier
  2019-07-09  2:35     ` Eli Zaretskii
@ 2019-07-09 22:34     ` Richard Stallman
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Stallman @ 2019-07-09 22:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: kbrown, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  >   A relative `default-directory` value is an error.
  > We should signal that error rather than try and paper over it.

That would be logical, but maybe it could also cause a situation where
you can't access any file.  If you're a wizard, you could get out by
setting that variable -- but nonwizards wouldn't know how to get out
of this.


-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-07-09 22:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190708223951.10291.7621@vcs0.savannah.gnu.org>
     [not found] ` <20190708223953.3172920BD5@vcs0.savannah.gnu.org>
2019-07-08 23:13   ` [Emacs-diffs] master 0528a7c: Ensure that expand-file-name returns an absolute file name Stefan Monnier
2019-07-09  2:35     ` Eli Zaretskii
2019-07-09  2:40       ` Daniel Sutton
2019-07-09  3:46       ` Stefan Monnier
2019-07-09 11:56         ` Ken Brown
2019-07-09 14:50         ` Eli Zaretskii
2019-07-09 15:25           ` Stefan Monnier
2019-07-09 16:07             ` Eli Zaretskii
2019-07-09 22:34     ` Richard Stallman

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.