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

saving a tikzpicture to a local folder is now broken #33944

Closed
seblabbe opened this issue Jun 1, 2022 · 9 comments
Closed

saving a tikzpicture to a local folder is now broken #33944

seblabbe opened this issue Jun 1, 2022 · 9 comments

Comments

@seblabbe
Copy link
Contributor

seblabbe commented Jun 1, 2022

Now that temporary files are created in the /tmp folder (after #33797), the following is now broken in 9.7.beta1:

sage: from sage.misc.latex_standalone import Standalone
sage: s = Standalone('Hello World')
sage: s.pdf('a.pdf')
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-3-61662d74848f> in <module>
----> 1 s.pdf('a.pdf')

~/GitBox/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/misc/latex_standalone.py in pdf(self, filename, view, program)
    729         if filename:
    730             filename = os.path.abspath(filename)
--> 731             os.rename(temp_filename_pdf, filename)
    732             return filename
    733 

OSError: [Errno 18] Invalid cross-device link: '/tmp/tmpwfvogvku/tikz_15rndaqh.pdf' -> '/home/.../a.pdf'

This went unnoticed because everywhere in the doctests the files are created in the temporary folder.

Component: graphics

Author: Sébastien Labbé

Branch/Commit: c4e8178

Reviewer: Michael Orlitzky

Issue created by migration from https://trac.sagemath.org/ticket/33944

@seblabbe seblabbe added this to the sage-9.7 milestone Jun 1, 2022
@seblabbe
Copy link
Contributor Author

seblabbe commented Jun 1, 2022

comment:1

A solution seems to be to use shutil.move instead.

@seblabbe
Copy link
Contributor Author

seblabbe commented Jun 1, 2022

New commits:

c4e817833944: using shutil.move instead of os.rename

@seblabbe
Copy link
Contributor Author

seblabbe commented Jun 1, 2022

Branch: u/slabbe/33944

@seblabbe
Copy link
Contributor Author

seblabbe commented Jun 1, 2022

Author: Sébastien Labbé

@seblabbe
Copy link
Contributor Author

seblabbe commented Jun 1, 2022

Commit: c4e8178

@seblabbe

This comment has been minimized.

@orlitzky
Copy link
Contributor

orlitzky commented Jun 1, 2022

Reviewer: Michael Orlitzky

@orlitzky
Copy link
Contributor

orlitzky commented Jun 1, 2022

comment:4

I think this would have been broken already when saving to a filesystem other than the one that SAGE_TMP lives on. The fix looks correct, thanks.

@vbraun
Copy link
Member

vbraun commented Jun 12, 2022

Changed branch from u/slabbe/33944 to c4e8178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants