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 document to a directory without write permission silently fails #4325

Open
jamshark70 opened this issue Feb 23, 2019 · 1 comment
Open
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE

Comments

@jamshark70
Copy link
Contributor

Environment

  • SuperCollider version: a0d61ea
  • Operating system: Ubuntu Studio

Steps to reproduce

  1. Type anything into a code document.
  2. Save into a directory where you do not have write permission. (In Linux, I used /usr/test.scd.) It will look like the document saved without error.
  3. Check the file: File.exists("/usr/test.scd") -- returns false.

Observed by another user in Windows. I confirmed that it's the same in Linux.

Expected vs. actual behavior

  • Expected: Common practice for file saving is to report errors to the user, in a pop-up box.

  • Actual: The user gets no feedback that saving failed -- and will likely assume that the file was saved, leading to loss of code when the user finds otherwise.

@jamshark70 jamshark70 added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE labels Feb 23, 2019
@nhthn nhthn added the severe label Feb 23, 2019
@nhthn nhthn added this to the 3.10.3 milestone Feb 23, 2019
@nhthn
Copy link
Contributor

nhthn commented Feb 23, 2019

not good. looks like in DocumentManager::doSaveAs, we do detect if file writing failed, but the only feedback is a debug message printed to stderr:

QFile file(path);
if(!file.open(QIODevice::WriteOnly)) {
    qWarning() << "DocumentManager: the file" << path << "could not be opened for writing.";
    return false;
}

DocumentManager::doSaveAs and returns a boolean that indicates whether saving was successful. so does MainWindow::save. however, the methods MainWindow::saveDocument and MainWindow::saveDocumentAs do not provide any user feedback if saving failed. MainWindow::save does detect for a few problematic file-saving cases like the cases where a file itself is not writable, but it only asks for permission, never forgiveness -- so any failure that we didn't anticipate is silently ignored. luckily the fix seems simple. not so simple is refactoring the saving code so that it's not all 90% awkwardly stuffed in MainWindow::save.

@mossheim mossheim removed the severe label Feb 23, 2019
@nhthn nhthn assigned nhthn and unassigned nhthn Feb 23, 2019
@nhthn nhthn removed this from the 3.10.3 milestone Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE
Projects
None yet
Development

No branches or pull requests

3 participants