Bug 2150529

Summary: evince shows weird error, when trying to open a file with a colon in the name
Product: [Fedora] Fedora Reporter: Albert Flügel <af>
Component: evinceAssignee: Marek Kašík <mkasik>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 37CC: feborges, gnome-sig, mclasen, mkasik, rstrode, sandmann
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-25 18:00:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed patch for glib2, where actually the problem is
none
Spec file to build glib2 with the attached patch as release -3
none
Proposed patch to properly cleanup /tmp after a failed "remote" load
none
proposed patch to omit the check of a "label" on a bare file name
none
Spec file to build evince with the 2 proposed patches for evince as release -2 none

Description Albert Flügel 2022-12-03 18:34:55 UTC
Description of problem:


Version-Release number of selected component (if applicable):
evince-42.4-1.fc36.x86_64


How reproducible:
start evince with a bare filename, that is not a path and contains a colon

Steps to Reproduce:
1. run evince some:test.pdf

Actual results:
evince opens a window showing the following messages:
Unable to open document “file:///tmp/evince-5891/document.51VZ50-test.pdf”.
The specified location is not supported

No idea, how evince constructs this filename or what it assumes ....
Are we on windows or what ?

Expected results:
Evince shows the contents of the PDF file.


Additional info:
There is no indication in the man page, that evince expects a URL as argument.

As it seems, bugzilla does not allow anymore to change the (fedora) version, this is a new bug for https://bugzilla.redhat.com/show_bug.cgi?id=1981111

Comment 1 Marek Kašík 2022-12-13 15:55:44 UTC
It seems that the way to fix this should be to mention this behaviour in the man page (see https://gitlab.gnome.org/GNOME/glib/-/issues/1623). I'll wait for reaction on this proposal in https://gitlab.gnome.org/GNOME/glib/-/issues/549.

Comment 2 Albert Flügel 2022-12-18 12:27:27 UTC
I can hardly believe this. When a program does nonsense, it is written to the documentation: This program does nonsense, but you are warned and it is documented. Happy new year.

Comment 3 Albert Flügel 2022-12-28 12:44:50 UTC
Created attachment 1934705 [details]
Proposed patch for glib2, where actually the problem is

In gio/gfile.c , function new_for_cmdline_arg the given filename is checked for an absolute path, then a (weak) criterion is applied to check, if it is a URI. This criterion also may match normal filenames. Thus i added a check, if the given name is specifying an existing regular file and if this is the case, it is handled as that and the URI check is ignored, actually skipped.

Comment 4 Albert Flügel 2022-12-28 12:45:51 UTC
Created attachment 1934706 [details]
Spec file to build glib2 with the attached patch as release -3

Comment 5 Albert Flügel 2022-12-28 13:03:27 UTC
Actually there are more questionable implementation details:
In shell/main.c of evince's own sources we find the function
get_label_from_filename, called from load_files. It checks for
the hash character in the given name, followed by a possible
"label". This makes no sense for filenames, that might as well
contain a hash (or "pound"). It might apply for real URIs, but
first here also it should be checked, if the given argument
refers to an existing regular file.

All this URI handling (what - surprisingly for me - really
works for http-like URLs - btw how does evince deal with
invalid certificates etcetcetc) is in my opinion questionable.
Why should a document viewer download files or in general deal
with URIs at all ? When navigating in the WWW, the browser
downloads the file and starts the helper application pointing
it to the downloaded temporary file. And the browser also does
the cleanup, more regarding this see below.
Aside of this general consideration the URI handling in evince
is erroneous in a wider degree. It is e.g. not possible to start
evince with an argument like file://myfile.pdf (though internally
a filename argument is converted to this form). When i do this,
i get the same weird error message like shown above. Thus i do
not consider the URI handling of evince mature in any aspect.

Regarding the context of the weird error message: It indicates
an indeed existing (empty) file in a temporary directory, that
is not removed after terminating evince. Starting evince several
times with invalid files leads to more and more trash in /tmp .
So there is more room for bug fixing. So be warned: When i find
the time, i'll suggest more patches.

Comment 6 Albert Flügel 2022-12-29 12:29:28 UTC
Created attachment 1934864 [details]
Proposed patch to properly cleanup /tmp after a failed "remote" load

ev_window_clear_local_uri should be called, not priv->local_uri handled "manually" in a different way

Comment 7 Albert Flügel 2022-12-29 12:30:43 UTC
Created attachment 1934865 [details]
proposed patch to omit the check of a "label" on a bare file name

Comment 8 Albert Flügel 2022-12-29 12:31:46 UTC
Created attachment 1934866 [details]
Spec file to build evince with the 2 proposed patches for evince as release -2

Comment 9 Ben Cotton 2023-04-25 18:14:29 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 10 Ludek Smid 2023-05-25 18:00:25 UTC
Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16.

Fedora Linux 36 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 11 Albert Flügel 2023-05-28 09:53:03 UTC
issue is still happily alive on Fedora 37.