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: Scott D
Subject: Re: [Bug-ddrescue] 2 Suggestions (bi-directional retry and user interruption exit code)
Date: Fri, 14 Feb 2014 08:43:31 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

Hmmm, maybe we don't need a separate exit code if ddrescue was terminated. Found some really useful information at http://www.cons.org/cracauer/sigint.html. Try out the following bash script, editing for your proper ddrescue command:
#!/bin/bash
trap 'echo ddrescue was terminated by the user; exit' 2
ddrescue -f /dev/sdc /dev/null -s 1G
echo ddrescue exited normally
exit

Scott

On 2/13/2014 5:34 PM, Scott Dwyer wrote:

On 2/13/2014 3:08 PM, Florian Sedivy wrote:
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 …

Interesting. Not sure if I have tried to see what is returned from a bash script, but the following C code from ddru_ntfsbitmap works to tell if ddrescue was terminated:

  char command[512];
sprintf (command, "ddrescue %s -i%lld -o%lld -s%lld %s \'%s\' \'%s\'", ddrescue_options, input_offset, output_offset, data_size, source_disk, destination_file, log_file);

  return_value = system (command);
  if (return_value > 255)
    return_value = return_value / 256;

  if (return_value == 2)
     {
       fprintf (stderr, "\nddresuce was terminated by the user\n");
       exit(return_value);
     }
I too would like to see a specific exit code for being terminated by the user, even though what I have seems to work for me. Although I would need to know when you do it, as I have to make sure it doesn't break my code.

While we are on the subject of modifying exit codes, I would REALLY like a separate exit code for an unfinished recovery. Maybe as an option, but would do the same thing as the --done-status in ddrescuelog. Would save me time from having to call ddrescuelog after ddrescue.

Scott

_______________________________________________
Bug-ddrescue mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-ddrescue





reply via email to

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