[patch #6093] skip skipall



Follow-up Comment #1, patch #6093 (project mc):

i dont feel the patch is very readable, but adding comments to every added
'if' would explode the source.

so i will tell the basic concept:

FileOpContext gets a new public member 'skip_all' for usage in all possible
quests. it is initalized with 0 on every action.

file.c is altered to support a skipall in the error dialog. it takes the enum
value 2 and assigns 3 to FILE_SKIP.
there are 5 ways in file.c to handle the error_dialog:
1. success mc_{chmod|mknod} breaks the loop
 the following code is executed on success.
 skip uses break to leave the loop
 retry continues
 other statuses return.
 extra break when skipall is set
  so the error dialog wont show up and the other code is executed.
 extra break if skip is selected
  the code continues without the knowledge that anything went wrong - you
maybe want to skip each problem by hand.
 FILE_SKIPALL is used to set the FileOpContext and should break as well.

2. success mc_{open,read,fstat,write} breaks the loop
 the following code is executed on success.
 skip uses break to leave the loop
 retry continues
 other statuses 'goto ret' - big block that decides the return_status.
 therefore skip_all goes to ret.
 FILE_SKIP goto ret
 FILE_SKIPALL sets the FileOpContext
3. success mc_{close,chwon,chmod breaks the loop
 error was: anything but retry breaks
 is FILE_SKIPALL sets the FileOpContext
 FILE_SKIP is added for convenience
 break unless retry
 !!return_status setting differs
4. failed mc_unlink
 was: everything but retry returns from function
 is: abort returns from function
 retry continues
 is FILE_SKIPALL sets the FileOpContext
 FILE_SKIP is added for convenience
 break to update progress

5. failed mc_rmdir
 recursive_erase with weird return condition
 (false if not continue)
 simplified the recursion:
  root while is aborted with FILE_ABORT
  rmdir while
   abort returns
   retry continues
   is FILE_SKIPALL sets the FileOpContext
   FILE_SKIP is added for convenience
   break to return FILE_CONT

please review the latest patch because this central change maybe messes up
files. i tested it with some complicated files:
a=0; while [ 1 ]; do a=$(($a+1)); sudo touch $a; sudo chmod $a $a; done
but maybe there are more complex situations that are not considered here.

because i uploaded the patch before documenting it i detected possible flaws
while writing. (tor was accidently enabled)
please comment the logic. ill test this some weeks then merge my experience
with your comments
  
thanks

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?6093>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]