Mh-execute-commands will fail if the default-directory, previously set by use of mh-mime-save-parts, no longer exists. Error in the use of call-process, as it wants to run in default-directory. Backtrace attached.
Looking at the manual for with-existing-directory, the macro looks at
default-directory rather than taking a directory as an argument. It
doesn't say what it does if default-directory doesn't exist.
Note that when saving attachments, it's a feature that the chosen
directory is used the next time, so I'm not sure you'd want to switch
directories back after the method.
If with-existing-directory isn't helpful, I guess we should check for
the existence of default-directory and cd to $HOME if it doesn't exist.
I see that #'mh-mime-save-parts cd's into the directory, which would set default-directory, but it doesn't
cd back after saving the MIME parts. I suspect it should use with-existing-directory, rather than cd.
[bugs:#498] mh-execute-commands fails when default-directory no longer exists
Status: open
Milestone: Unassigned
Created: Sun Jun 19, 2022 01:28 PM UTC by Henrique Martins
Last Updated: Sun Jun 19, 2022 01:28 PM UTC
Owner: nobody
Attachments:
backtrace (729 Bytes; application/octet-stream)
Mh-execute-commands will fail if the default-directory, previously set by use of mh-mime-save-parts, no
longer exists. Error in the use of call-process, as it wants to run in default-directory. Backtrace attached.
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/mh-e/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from
the mailing list.
I see that #'mh-mime-save-parts cd's into the directory, which would set default-directory, but it doesn't cd back after saving the MIME parts. I suspect it should use with-existing-directory, rather than cd.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah, I totally misread the docstring for "with-existing-directory", so forget that idea.
Note that when saving attachments, it's a feature that the chosen
directory is used the next time, so I'm not sure you'd want to switch
directories back after the method.
mh-mime-save-parts saves the chosen directory in mh-mime-save-parts-directory, which will get used to generate the prompt the next time. That part's fine. It's the cd into the target directory, which sets default-directory for the buffer and then leaves default-directory set, that's the problem. So I think mh-mime-save-parts should save the value of default-directory before doing the cd, and then restore default-directory to the old value before returning.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah, I totally misread the docstring for "with-existing-directory", so forget that idea.
Note that when saving attachments, it's a feature that the chosen
directory is used the next time, so I'm not sure you'd want to switch
directories back after the method.
mh-mime-save-parts saves the chosen directory in mh-mime-save-parts-directory, which will get used to
generate the prompt the next time. That part's fine. It's the cd into the target directory, which sets
default-directory for the buffer and then leaves default-directory set, that's the problem. So I think
mh-mime-save-parts should save the value of default-directory before doing the cd, and then restore
default-directory to the old value before returning.
[bugs:#498] mh-execute-commands fails when default-directory no longer exists
Status: open
Milestone: Unassigned
Created: Sun Jun 19, 2022 01:28 PM UTC by Henrique Martins
Last Updated: Fri Jul 01, 2022 10:01 PM UTC
Owner: nobody
Attachments:
backtrace (729 Bytes; application/octet-stream)
Mh-execute-commands will fail if the default-directory, previously set by use of mh-mime-save-parts, no
longer exists. Error in the use of call-process, as it wants to run in default-directory. Backtrace attached.
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/mh-e/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from
the mailing list.
Looking at the manual for with-existing-directory, the macro looks at
default-directory rather than taking a directory as an argument. It
doesn't say what it does if default-directory doesn't exist.
Note that when saving attachments, it's a feature that the chosen
directory is used the next time, so I'm not sure you'd want to switch
directories back after the method.
If with-existing-directory isn't helpful, I guess we should check for
the existence of default-directory and cd to $HOME if it doesn't exist.
Mike Kupfer via mh-e-devel mh-e-devel@lists.sourceforge.net wrote:
--
Bill Wohler wohler@newt.com aka Bill.Wohler@nasa.gov
http://www.newt.com/wohler/, GnuPG ID:610BD9AD
Related
Tickets:
#498I see that #'mh-mime-save-parts cd's into the directory, which would set default-directory, but it doesn't cd back after saving the MIME parts. I suspect it should use with-existing-directory, rather than cd.
Yeah, I totally misread the docstring for "with-existing-directory", so forget that idea.
mh-mime-save-parts saves the chosen directory in mh-mime-save-parts-directory, which will get used to generate the prompt the next time. That part's fine. It's the cd into the target directory, which sets default-directory for the buffer and then leaves default-directory set, that's the problem. So I think mh-mime-save-parts should save the value of default-directory before doing the cd, and then restore default-directory to the old value before returning.
Sounds good.
Hmmm, I wonder if we have other sleeping cd calls in our code...
Mike Kupfer via mh-e-devel mh-e-devel@lists.sourceforge.net wrote:
--
Bill Wohler wohler@newt.com aka Bill.Wohler@nasa.gov
http://www.newt.com/wohler/, GnuPG ID:610BD9AD
Related
Tickets:
#498I checked for other instances in MH-E of this problem (default-directory getting munged by a cd) and didn't see any.
I've got a preliminary patch for this issue that I'll try to get out for review next weekend.
While I was testing, I noticed a problem with the prompt for mh-mime-save-parts. I've got a fix for that which I'll post for review at the same time.
The workaround for this bug is to kill the buffer *MH-E Log*
Fixed in Emacs 29.1 (bb0af6489a).
Got the patch from the emacs source. Haven't tested it yet.
Thanks for fixing it.