On Saturday December 08, 2007 at 09:18:08 (PM) Micah Cowan wrote: > So, perhaps its time to come back to the question of differentiated exit > codes from Wget. This may be a 1.12 question, or perhaps a 1.13 > question, but at any rate, with 1.11 ready to go out the day, we perhaps > have a little more time to discuss it in depth. > > I think the easiest question to ask is how Wget should handle failures > when only one file has been specified, and recursive-descent isn't > specified. Deciding how Wget should handle multiple arguments, or > recursiveness, or both together, is somewhat less straightforward. > > One thing I do feel strongly, is that if Wget has successfully done its > job, and an error condition has not occurred, Wget should return zero.
I agree. However, we are assuming that wget has indeed downloaded a file correctly. > In particular, if Wget chooses not to download a file because the local > timestamp is still current, or because its size corresponds to that of > the remote file, these should result in an exit status of zero. I disagree. If wget has not downloaded a file, exiting with zero could lead the end user to believe that it had. > I agree that differentiating between these conditions could be very useful > from a scripting standpoint, but in Unix (and most of the rest of the world, > for that matter), anything that's not 0 is interpreted as an error. I disagree again. If wget did not download a file, no matter what the reason, then it should not exit with zero. I have written several scripts that utilize wget to download files. Because wget fails to issue a useful code upon completion, I am forced to use hacks to find out what actually transpired. Curl utilizes certain error codes, # 73 for instance, that are quite useful. > There is a fair amount of room for delineation between various error > statuses; for better or worse, there is no such room for success > statuses, and it won't be productive to try to work around it by using a > few codes from the error space as "other" success conditions. I believe that the problem is in defining the word 'success'. Properly indicating what transpired by issuing a factually correct exit code is essential. In any case, it would make my job of writing scripts that use wget immensely easier and less prone to breakage. Jus my 2ยข. -- Gerard