Opened 11 years ago

Last modified 7 years ago

#10229 needs_work defect

Deleting attached files causes major problems

Reported by: flawrence Owned by: was
Priority: major Milestone: sage-6.4
Component: user interface Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by ltw)

Create a file, attach it in a Sage session, then delete/move the file. Sage does not like this - and every command results in OSError: [Errno 2] No such file or directory: '/path/to/attached/file.py. It won't even let you detach the file.

At the moment before each command is executed, Sage checks to see if any attached files have been modified. Presumably instead it should except this error, remove the file from the list of attached files, and inform the user.

Discovered by rossk when reviewing #378.

Apply trac_10229-2.patch

Attachments (2)

trac_10229.patch (1.0 KB) - added by mboratko 10 years ago.
Suppress exception message for moved or deleted attachments
trac_10229-2.patch (4.1 KB) - added by ltw 10 years ago.
fixed modified_attached_files()

Download all attachments as: .zip

Change History (13)

comment:1 Changed 10 years ago by mboratko

  • Status changed from new to needs_info

I wish I could include a patch here, but my sage install is having an unrelated issue right now, but this is an easy fix so it may be worth mentioning.

For sage/misc/preparser.py, wrap lines 1790 to 1794 in a try block, and use

{{except OSError, e:

if e.errno==2:

pass

}}

This will at least make it continue working. What would be our desired response to a moved/deleted file? I think it would make sense to detach it, since otherwise it will just keep attempting to go through this. Do we want to display a message to the user as well?

Sorry for not posting a patch, I will try to when I fix my sage install.

Changed 10 years ago by mboratko

Suppress exception message for moved or deleted attachments

comment:2 Changed 10 years ago by mboratko

  • Status changed from needs_info to needs_review

comment:3 Changed 10 years ago by ltw

  • Description modified (diff)

Here is a new patch that detaches inaccessible files and issues warnings. Doctests for the re-written function modified_attached_files have been overhauled as well. Please review!

comment:4 Changed 10 years ago by ltw

  • Status changed from needs_review to needs_work

Oops, looks like the patchbot isn't happy. Changing this to "needs work" until I (or someone else) has time to investigate.

comment:5 Changed 10 years ago by ltw

  • Status changed from needs_work to needs_review

Apply trac_10229-2.patch

Changed 10 years ago by ltw

fixed modified_attached_files()

comment:6 Changed 10 years ago by ltw

Apply trac_10229-2.patch

comment:7 Changed 10 years ago by johanbosman

  • Status changed from needs_review to needs_work

It looks like something introduced in sage-5.0.beta8 interferes with this as the following test fails:

sage -t  "devel/sage-main/sage/misc/preparser.py"

comment:8 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:9 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:10 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:11 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.