Bug 1857869 - Alpine cannot find the tmp files when opening an html attachment.
Summary: Alpine cannot find the tmp files when opening an html attachment.
Keywords:
Status: NEW
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: alpine
Version: epel7
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Paul Wouters
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-07-16 17:15 UTC by Tom Diehl
Modified: 2021-04-26 12:09 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
Screen shot of the alpine error (127.17 KB, image/png)
2020-07-16 17:15 UTC, Tom Diehl
no flags Details

Description Tom Diehl 2020-07-16 17:15:32 UTC
Created attachment 1701437 [details]
Screen shot of the alpine error

Description of problem:

When opening an html attachment, firefox launches as it should but it cannot find the tmp file it needs to display the attachment.

Version-Release number of selected component (if applicable):

alpine-2.23-2.el7.x86_64

How reproducible:

Always.

Steps to Reproduce:
1. Open alpine
2. Open a message with an html attachment
3. Press the v key to see the attachments and select the Text/HTML attachment.
4. Press enter twice and wait for the browser to open.

Actual results:

The following error is displayed:
"File not found

Firefox can’t find the file at /tmp/img--70374.htm.

    Check the file name for capitalization or other typing errors.
    Check to see if the file was moved, renamed or deleted."

Expected results:

The attachment gets displayed in the browser.

Additional info:

If I downgrade alpine to alpine-2.21-4.el7.x86_64 everything works as expected.

I tried watching /tmp for the tmp file to get created but I never see it. If it is getting created it is deleted before I can see it.

Screen shot of the error is attached.

Comment 1 Eduardo Chappa 2020-07-30 23:41:15 UTC
Tom,

There was a change in the code that could make this happen. In essence the issue is that alpine removes the temporary file too early because the app returns control to the operating system before it open the file. In order to avoid this, Alpine included a 5 seconds delay, but people did not like that either. Too long.

In recognizing that both issues cannot be solved in the same way, there was a compromise. The 5 seconds delay that is used to open, and wait for, before is deleted will NOT be used for applications that use "needsterminal", so if your entry in the mailcap has a "needsterminal" in it, you might see the issue you are reporting.

-- 
Eduardo

Comment 2 Tom Diehl 2020-07-31 14:01:30 UTC
Hi Eduardo,

Thanks for the info.

My mailcap is very simple. It is as distributed with the OS and only has the following in it:

audio/*; /usr/bin/xdg-open %s

image/*; /usr/bin/xdg-open %s

application/msword; /usr/bin/xdg-open %s
application/pdf; /usr/bin/xdg-open %s
application/postscript ; /usr/bin/xdg-open %s

text/html; /usr/bin/xdg-open %s ; copiousoutput

As you can see there are not any "needsterminal" parameters listed in it.

I do have the following in my pinerc:

URL-Viewers                         = _TEST("test -n '${DISPLAY}'")_  /usr/bin/google-chrome                                                                                                                                                                  
                                      "/usr/bin/google-chrome _URL_"                                                                                                                                                                                          
                                      "/usr/bin/links _URL_"
Do you have any suggestions as to how I can work around this issue?
In case it is useful both machines I tested this on are fully updated Centos 7 systems.

Regards,

Tom

Comment 3 Eduardo Chappa 2020-07-31 17:11:04 UTC
Thank you Dear Tim for the additional information.

The issue you are seeing is caused by the "copiousoutput" parameter in the entry in /etc/mailcap. This causes Alpine to set up, internally, the needsterminal flag, which is what finally determines the removal of the temporaty file.

There should be two ways to avoid this issue.

1) Close your browser before you open an attachment. At least with firefox, that is enough. I suspect the same will be with chrome.

2) If 1) is unreasonable in your case, create your own ~/.mailcap file and copy the entry from /etc/mailcap, bu this time remove
the "; copiousoutput" part. Alpine will use your ~/.mailcap entry if it finds it before it finds the one set up in the system.

These configuration values are used because you are trying to open an attachment based on its type.

There is a new mechanism in Alpine to open html messages, which is the "eXternal" command. This will use your URL-viewers configuration, rather than your mailcap configuration. If you want to open the HTML part, while reading the message, press "V" to see the list of attachments, place the cursor over the TEXT/HTML attachment that you want to open, and press "X" instead of "return" on it. This will send the message and internal images to a temporary file, and this is not subject to this 5 seconds rule. The copy of the message is open in your home directory, not in /tmp, and it lives for 10 minutes before it is auto-erased. I think there might be some issues in version 2.23 2ith this command, if you find any, upgrade to the latest version in the repository, and that will work better. If you find any problems with the version in the repository, please let me know so I can look into them.

Does any of these workarounds work for you?

-- 
Eduardo

Comment 4 Adam Benjamin 2020-09-02 16:36:18 UTC
That .mailcap workaround worked perfectly for me.  Thanks for identifying the underlying issue.  (The "copiousoutput" directive.)

Comment 5 Tom Diehl 2020-09-03 20:49:22 UTC
Hi,

sorry for the delay responding to this. Removing the copiousoutput restores previous behavior. Using the URL-viewers configuration, rather than the mailcap configuration also kind of works.
By that I mean it displays the html attachment but it does not show any images. I only get a link to them.

Is it easy to change the 5 second timer or is it a compiled in value?

Thanks for the help.

Comment 6 Eduardo Chappa 2020-09-04 02:28:06 UTC
(In reply to Tom Diehl from comment #5)
> Hi,
> 
> sorry for the delay responding to this. Removing the copiousoutput restores
> previous behavior. Using the URL-viewers configuration, rather than the
> mailcap configuration also kind of works.
> By that I mean it displays the html attachment but it does not show any
> images. I only get a link to them.
> 
> Is it easy to change the 5 second timer or is it a compiled in value?

This is a compiled-in value. However, the external command can be used to load images.

Alpine includes the option

[X] External Command Loads Inline Images Only

which makes Alpine only load inline images, so if you want to load external images, you would
have to disable that option.

There was a bug in this command that PC-Alpine crash, but not my linux version. In any case,
the bug is solved in the current version in the repository.

I hope this helps.

-- 
Eduardo

Comment 7 Fedora Admin user for bugzilla script actions 2021-04-26 12:09:43 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.


Note You need to log in before you can comment on or make changes to this bug.