bug-ddrescue
[Top][All Lists]
Advanced

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

Re: [Bug-ddrescue] 2 Suggestions (bi-directional retry and user interrup


From: Florian Sedivy
Subject: Re: [Bug-ddrescue] 2 Suggestions (bi-directional retry and user interruption exit code)
Date: Thu, 13 Feb 2014 21:08:18 +0100

Antonio Diaz Diaz wrote:
> Florian Sedivy wrote:
>> I have two suggestions. First is a very simple change of the exit status 
>> after user interruption. Currently this is 0, which makes it 
>> indistinguishable from a finished run. In the context of a script and/ or 
>> loop it is very useful to catch a user interruption in order to exit the 
>> loop or script. 
> 
> Ddrescue returns 0 when interrupted because I considered it an "user-finished 
> run", not an error. But if a nonzero value is useful, I have no objection to 
> it. Only that -1 does not seem an appropiate value, as the return value is 
> usually an unsigned 8-bit number.
> 
To be honest, I don't know, where the return value actually comes from. The 
comments on the start of Rescuebook functions are stating "// Return values: 1 
I/O error, 0 OK, -1 interrupted, -2 logfile error" so thats what I blindly 
believed. The line I found neutralizes anything negative to zero, so deleting 
that line would just pass through whatever comes along.

Before I applied that patch I had a hard time getting out of a scripted 
retry-loop …

>> The other suggestion is about retry mode. I wish ddrescue could 
>> automatically alternate the reading direction for each pass when retrying 2 
>> or more times.
> 
> Good idea. But no need of using negative numbers for it. I think a suffix 
> letter is less confusing and allows for infinite alternation (-r-1i for 
> example). From the 3 obvious candidates (a, i, r), I prefer 'i' (from invert) 
> because 'a' is an hexadecimal digit and 'r' can be understood as reverse mode.
> 
I'd like s for serpentine, but that already means seconds. I guess you would 
like to continue handling that number in getnum(), but then somebody could try 
to specify 1024 retries writing -r1Ki which makes the 'i' ambiguous. With all 
the possible exponents and factors an alternation designator could be in any 
position from tail[0] to tail[2], so it would have to be unique among all of 
them. 'a' seems to be a good candidate, I also like 'c' for 'changing' or 'z' 
for 'zigzag' and because it  looks like what its does. (Capital 'Z' is 
Zetabytes but I don't think there would be a lot of confusion.) If a and c 
could be mistaken for hex digits by strtoll(), then not a lot is left. 

Assuming for a moment its 'z', then '-rz' should actually be enough for 
infinite alternation, but then again I don't know what the arg parser and 
strtoll() think about that.

>> Also I would have liked to insert a 5 second pause between passes, but don't 
>> know how to accomplish that in a platform independent way and without 
>> messing up the read statistics. 
> 
> Implementing a pause between passes is possible. For example it can be 
> specified as a time interval after the number of retries and optional 
> "inverting" letter. "-r20i,5s" could then make 20 alternating passes (10 
> forward, 10 backward) with a 5 second pause between passes.

I would really like to see that addition, but maybe rather as an independent 
option. Then it could also be used to pause between the other passes. Should it 
also be applied between the additional copy passes when the minimum rate is 
multiplied by 10? Yes, I think so, because the number of those passes should 
not scale linear with disk size. 

Such a Pause could be useful for fetching copies of the log file at milestones 
automatically. If the pause is bigger than my fetching interval, I can be sure 
to catch the status between passes. That could sometimes replace using -n and 
-N. 
Another case might be drives which are known to park heads when idle for a 
certain time (like WD), giving the next pass a fresher start. 

Maybe if -O AND Pause are given, every pause should be used to reopen the input 
file even without error?

Always a pleasure!
Florian


reply via email to

[Prev in Thread] Current Thread [Next in Thread]