#1760 Data lost while saving file on full flash disk

Bug
closed-fixed
scite (90)
5
2015-09-15
2015-09-05
jry2
No

I can reproduce this problem with Windows 7 and several flash disks formated to FAT32. Scintilla doesn't report it is not possible to save file because there is no more available space so it looks like everything is OK and file was saved. Notepad.exe works fine in the same situation, user is warned with message box: there is not enough space to save file.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2015-09-05

    This may occur when saving in the background on a separate thread. If you turn off background saving with background.save.size you should see a message.

     
  • jry2

    jry2 - 2015-09-06

    File size is 128KB, with background.save.size=1000000 in SciTEUser.properties I can still reproduce described problem.

    Note: I'm testing official Windows build of SciTE Version 3.6.0.

     
    Last edit: jry2 2015-09-06
  • Neil Hodgson

    Neil Hodgson - 2015-09-08

    Tried this out and I am seeing messages both for foreground and background saving with a slightly different message ..."Save under a different name" for the foreground case.
    Foreground
    Background

     
  • jry2

    jry2 - 2015-09-08

    Thank you for fast reply. We did several other tests (Windows 7, FAT and NTFS formatted flash disk), different computers. We can confirm the error message is displayed when saved file is "large enough". For example when available disk free space is 16KB and we save file exceeding this free space twice, we get error message.

    To reproduce described problem you need to exceed available free space just by a few bytes (exactly it looks like cluster size, in our case 4096 bytes). Could you please try this scenario?

     
    • Neil Hodgson

      Neil Hodgson - 2015-09-08

      My attempts are with a FAT drive and files that are either slightly over or should have just fittted still showed the error message. Disk exhaustion may cause interesting failure states as file metadata is updated.

      The fclose call isn't being checked as its hiddden inside the encoding converter. You could trace the code through and see if the fclose is indicating failure in your situation and, if that is the case, another check could be added.

       
  • jry2

    jry2 - 2015-09-08

    OK, here are results. Function void Utf8_16_Write::fclose(), line ::fclose(m_pFile) is returnig -1 in described case. Value of errno is 28 (No space left on device). Return value of all fclose() should be checked for write operations, there could be unsaved buffers. See http://stackoverflow.com/questions/1954273/fclose-return-value-check for more details. It would be a good idea to look at other untested fclose() in Scite too.

     
  • jry2

    jry2 - 2015-09-08

    Confirmed, File > Export commands are also quiet while writing on full flash disk. Also File > Save Session command.

     
  • Neil Hodgson

    Neil Hodgson - 2015-09-09
    • labels: --> scite
    • assigned_to: Neil Hodgson
     
  • jry2

    jry2 - 2015-09-09

    Thank you for fast fix. There is one small glitch: when I choose Save command first time, error message is displayed (Could not save file 'F:\fill.txt'. Save under a different name?). I choose No. File looks unsaved accroding to Scite window title (asterisk). I choose command Save again this time error message doesn't show.

    Edit: When I activate another application and return back to Scite (in described unsaved state), following message is displayed: The file 'F:\fill.txt' has been modified. Should it be reloaded?

     
    Last edit: jry2 2015-09-09
    • Neil Hodgson

      Neil Hodgson - 2015-09-09

      When automatic saving is triggered and the file can not be successfully saved there may be a continuously redisplayed modal warning message box which prevents other actions by the user. So there's some logic to prevent multiple occurrences of the warning message.

      While it may be possible to do something better, its complex and I won't be working on it.

      To see the automatic reload message you must have chosen the load.on.activate option. This checks if the file's on-disk timestamp is different to the in-memory file and offers to reload if they differ.

       
  • jry2

    jry2 - 2015-09-09

    I'm saving using File > Save command, automatic save is not involved. Shouldn't it display error message about save failure?

     
    • Neil Hodgson

      Neil Hodgson - 2015-09-09

      Its common code.

       
  • jry2

    jry2 - 2015-09-09

    Would it be complicated to introduce variable to distinguish source of save event (automatic vs user command) and display or quiet error message accordingly?

    If it is problem, we can close this issue (semi-fixed, because error message is displayed once).

     
    • Neil Hodgson

      Neil Hodgson - 2015-09-09

      It would be more complicated since there are already multiple variables describing various saving states. You can work on this if you want to (start with SciTEBase::Save) but its probably much more complex than you expect.

       
      • jry2

        jry2 - 2015-09-09

        I believe :) Please close this issue.

         
  • Neil Hodgson

    Neil Hodgson - 2015-09-09
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2015-09-09

    The bug report will be closed when the fix is in a release.

     
  • Neil Hodgson

    Neil Hodgson - 2015-09-15
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks