Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compressed files can't be displayed #42

Closed
hpreusse opened this issue Jan 31, 2019 · 8 comments
Closed

Compressed files can't be displayed #42

hpreusse opened this issue Jan 31, 2019 · 8 comments

Comments

@hpreusse
Copy link

https://bugs.debian.org/591781

A rather long standing issue, when using texdoc to display compressed files in GNOME/XFCE . texdoc opens the viewer window, but the to be displayed (temporary) file is already gone and can't be opened. The original submitter runs Debian testing (w/ texdoc 3.0) and XFCE and still sees the issue.

Please be so kind to have a look at the issue. Thanks!

@wtsnjp
Copy link
Member

wtsnjp commented Jan 31, 2019

Thanks for reporting that. We will try to find a solution.

@norbusan is it possible for you to check the reproducibility of this?

@norbusan
Copy link
Member

@wtsnjp Hi, yes, this is the still the case, and in fact always was the case with texdoc. I had a patch back then, long time ago, to deal with compressed documents, but that is so outdated that it was probably removed some years ago.

As an example here on Debian we do not compress .pdf files, but .ps files are compressed.

$ texdoc bookhands
29 results.  Display them all? (y/N) y
...
 5 /usr/share/texlive/texmf-dist/doc/fonts/bookhands/uncial/allfont.ps.gz
...
Enter number of file to view, RET to view 1, anything else to skip: 5
$
** (evince:12288): WARNING **: 00:46:35.296: set_filenames: Error when getting information for file “/tmp/texdoc.OUlBu1/allfont.ps”: No such file or directory

Due to the async working of xdg-open (or texdoc?) the temporary file already has disappeared due to the cleanup of texdoc before the viewer is actually started. This is actually documented in the texdoc.cnf:

# If you want to enable support for zipped documentation (see below),
# you may want to adapt viewer_* so that it starts a subshell:
#
# viewer_pdf = (xpdf %s) &
#
# Otherwise, the & will have no effect since the viewing command is followed by
# some cleanup-commands for temporary files. For the same reason, %s must be the
# last thing on your command line: (xpdf %s -option) will not work.
#
# WARNING: for zip support your viewer needs to be blocking, i.e. it must not
# return immediately: otherwise the temporary file will be deleted too early.

The problem is that Debian uses xdg-open (in fact:

viewer_pdf = (xdg-open %s) &
viewer_ps  = (xdg-open %s) &
viewer_dvi = (xdg-open %s) &
viewer_html = (xdg-open %s) &
viewer_txt = (xdg-open %s) &

) which is a cross-DE tool to open files depending on the desktop environment and user wishes. But it does return immediately, and thus the above warning hits in.

I am not sure whether there is something we can do on the texdoc side to fix this, xdg-open should have a -wait option or so, but alas, there is none.

@e-kwsm
Copy link
Contributor

e-kwsm commented Jan 31, 2019

How about sleep enough before cleanup so that xdg-open (evince etc) launches?

diff --git a/script/view.tlu b/script/view.tlu
index cc5027f43e53..a4d97b1b01f1 100644
--- a/script/view.tlu
+++ b/script/view.tlu
@@ -55,3 +55,3 @@ function view_file(filename)
 
-        viewer_replacement = tmpfile .. '; ' .. config.rm_file .. ' ' ..
+        viewer_replacement = tmpfile .. '; sleep 10; ' .. config.rm_file .. ' ' ..
             tmpfile .. '; ' .. config.rm_dir .. ' ' .. tmpdir

Actually I cannot try this ad hoc solution because gzipped entries do not apper in my environment (texdoc ea51f9e & Debian 9.5).

@norbusan
Copy link
Member

norbusan commented Feb 1, 2019

Sounds like a good idea. I'll try it in case I find a free second from my daughter during the long haul flight ;-)

@norbusan
Copy link
Member

norbusan commented Feb 1, 2019

That works indeed, maybe 10sec is a bit long, but anyway ... nice idea.

@wtsnjp what do you think? Should we include this one, or should I patch it into the Debian packages?

@wtsnjp
Copy link
Member

wtsnjp commented Feb 2, 2019

Yes, sleeping for a few seconds is exactly what I was thinking. My question is how many secounds (maybe 1 or 2?) should we take, so if you can kindly test a bit on Debian, please let me know the number. I will shortly patch the code. Thanks.

@norbusan
Copy link
Member

norbusan commented Feb 2, 2019

On my laptop 1s and 2s both were fine. So I guess I would be ok to use 2s to help older laptops.

@wtsnjp
Copy link
Member

wtsnjp commented Feb 2, 2019

Thanks a lot for that report!

@wtsnjp wtsnjp closed this as completed in 6e8d68b Feb 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants