Menu

#498 mh-execute-commands fails when default-directory no longer exists

Unassigned
closed-fixed
None
5
2022-07-31
2022-06-19
No

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.

1 Attachments

Related

Tickets: #498

Discussion

  • Mike Kupfer

    Mike Kupfer - 2022-07-01
    • status: unread --> open
     
    • Bill Wohler

      Bill Wohler - 2022-07-03

      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:

      • status: unread --> open
      • Comment:

      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.


      Sent from sourceforge.net because mh-e-devel@lists.sourceforge.net is subscribed to
      https://sourceforge.net/p/mh-e/bugs/

      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.


      Alternatives:



      mh-e-devel mailing list
      mh-e-devel@lists.sourceforge.net
      https://lists.sourceforge.net/lists/listinfo/mh-e-devel

      --
      Bill Wohler wohler@newt.com aka Bill.Wohler@nasa.gov
      http://www.newt.com/wohler/, GnuPG ID:610BD9AD

       

      Related

      Tickets: #498

  • Mike Kupfer

    Mike Kupfer - 2022-07-01

    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.

     
  • Mike Kupfer

    Mike Kupfer - 2022-07-03

    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.

     
    • Bill Wohler

      Bill Wohler - 2022-07-03

      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:

      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.


      Sent from sourceforge.net because mh-e-devel@lists.sourceforge.net is subscribed to
      https://sourceforge.net/p/mh-e/bugs/

      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.


      Alternatives:



      mh-e-devel mailing list
      mh-e-devel@lists.sourceforge.net
      https://lists.sourceforge.net/lists/listinfo/mh-e-devel

      --
      Bill Wohler wohler@newt.com aka Bill.Wohler@nasa.gov
      http://www.newt.com/wohler/, GnuPG ID:610BD9AD

       

      Related

      Tickets: #498

  • Mike Kupfer

    Mike Kupfer - 2022-07-06
    • assigned_to: Mike Kupfer
     
  • Mike Kupfer

    Mike Kupfer - 2022-07-10

    I 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.

     
  • Mike Kupfer

    Mike Kupfer - 2022-07-10

    The workaround for this bug is to kill the buffer *MH-E Log*

     
  • Mike Kupfer

    Mike Kupfer - 2022-07-24
    • status: open --> closed-fixed
     
  • Mike Kupfer

    Mike Kupfer - 2022-07-24

    Fixed in Emacs 29.1 (bb0af6489a).

     
  • Henrique Martins

    Got the patch from the emacs source. Haven't tested it yet.
    Thanks for fixing it.

     

Log in to post a comment.