Opened 7 years ago

Closed 7 years ago

#14149 closed defect (duplicate)

Creation of temporary files with %attach

Reported by: aschilling Owned by: was
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: user interface Keywords:
Cc: ppurka, tmonteil, hthomas, okazymyrov Merged in:
Authors: Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #14523 Stopgaps:

Description

Using sage-5.7.beta4 and sage-5.7.rc0, when attaching a .sage file, sage creates spurious files in the current directory. For example

sage: %attach blah.sage

creates blah.sageYPVh in the current directory.

Change History (20)

comment:1 Changed 7 years ago by kcrisman

See also #14169.

comment:2 Changed 7 years ago by kcrisman

  • Component changed from PLEASE CHANGE to user interface
  • Owner changed from tbd to was
  • Priority changed from blocker to critical

comment:3 Changed 7 years ago by sdenton

Bump.

It seems like it should be possible to create these temporary files in ~/.sage or something similar. Where is the code for %attach kept? I could possibly start poking around.

comment:4 Changed 7 years ago by ppurka

  • Cc ppurka added

comment:5 Changed 7 years ago by tmonteil

  • Cc tmonteil added

comment:6 Changed 7 years ago by hthomas

  • Cc hthomas added

comment:7 Changed 7 years ago by okazymyrov

  • Cc okazymyrov added

comment:8 Changed 7 years ago by vbraun

  • Authors set to Volker Braun
  • Milestone changed from sage-5.10 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

Fixed in #14523

comment:9 Changed 7 years ago by hthomas

@Volker: Could you explain where the code was that was producing these funny file names? I'm happy that it's fixed in #14523 (thank you!) but I don't see where it gets fixed. Sorry if the question seems like a waste of time -- I spent a fair while trying to figure out where this was happening, and I couldn't find it. Thanks!

comment:10 follow-up: Changed 7 years ago by vbraun

The attach debug mode is off by default now (see load_attach_mode?).

comment:11 in reply to: ↑ 10 ; follow-up: Changed 7 years ago by mstreng

Replying to vbraun:

The attach debug mode is off by default now (see load_attach_mode?).

I completely disagree with this fix. See this discussion and #11812.

comment:12 in reply to: ↑ 11 Changed 7 years ago by mstreng

  • Milestone changed from sage-duplicate/invalid/wontfix to sage-5.10
  • Status changed from needs_review to needs_info

Replying to mstreng:

I completely disagree with this fix.

In fact, I would just switch "debug mode" back on in my startup file, but I would still want to get rid of the temporary files, so I would not call this a fix at all.

How about doing all of the following?

  • put temporary files in one subfolder (to keep the main folder as clean as possible)
  • remove or overwrite old temporary files when reloading attached files (to keep the folder with temporary files as clean as possible)
  • remove temporary files when exiting sage (obviously)

That only leaves one temporary file for each .sage file. It is there only during the Sage session. It remains afterwards only when Sage exits incorrectly, and it is in a subdirectory, so can be removed easily.

comment:13 follow-up: Changed 7 years ago by vbraun

If that is the desired outcome then it would have been nice to doctest it.

Littering subdirectories with files in them into the file system is just as bad as spewing random temp files into cwd. Temp files should go into the sage temp directory.

Still, the correct fix is to make execution of in-memory code produce correct tracebacks.

comment:14 in reply to: ↑ 13 Changed 7 years ago by mstreng

Replying to vbraun:

If that is the desired outcome then it would have been nice to doctest it.

I tried to doctest tracebacks, but could not find a way (see #11812).

Littering subdirectories with files in them into the file system is just as bad as spewing random temp files into cwd. Temp files should go into the sage temp directory.

Originally (before #7514 and again at #11812), temp directories *were* used for the preparsed .py files. The location changed later. I don't know when or why; maybe at #13579 because of security problems?

Still, the correct fix is to make execution of in-memory code produce correct tracebacks.

Yes, that would be best. Much better than my solution above, and much better than what was done at #11812. But how? I would like to see the name of the .sage file, and multi-line code snippets including line numbers.

comment:15 Changed 7 years ago by vbraun

  • Status changed from needs_info to needs_review

I've added a doctest for the desired behavior in #14523 (traceback showing source)

comment:16 Changed 7 years ago by vbraun

Anybody who doesn't like temporary files littering the fs feel like reviewing this ticket?

comment:17 Changed 7 years ago by jhpalmieri

There are no attachments. What exactly are we supposed to review?

comment:18 Changed 7 years ago by vbraun

  • Milestone changed from sage-5.10 to sage-duplicate/invalid/wontfix

Oops, posted this in the wrong ticket. I meant #14523. This ticket should be closed as duplicate, I think.

comment:19 Changed 7 years ago by tscrim

  • Authors Volker Braun deleted
  • Dependencies set to #14523
  • Reviewers set to Volker Braun
  • Status changed from needs_review to positive_review

#14523 does fix creating the temp files.

comment:20 Changed 7 years ago by jdemeyer

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.