Date: Sun, 8 Dec 1996 02:42:40 +0100 (MET) From: Robert Eckardt <roberte@mep.ruhr-uni-bochum.de> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/2170: fetch in 2.1.5R doesn't keep interrupted files and sets wrong mirror date Message-ID: <199612080142.CAA27684@ghost.mep.ruhr-uni-bochum.de> Resent-Message-ID: <199612080150.RAA20495@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 2170 >Category: bin >Synopsis: fetch in 2.1.5R doesn't keep interrupted files and sets wrong mirror date >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Dec 7 17:50:01 PST 1996 >Last-Modified: >Originator: Robert Eckardt >Organization: >Release: FreeBSD 2.1.5-RELEASE i386 >Environment: 2.1.5-R as of WC-CD >Description: I missed the ability in fetch to keep the transfered file, when the transfer was interrupted. However, e.g. for .txt or .pdf files it makes sense to have a look at the file. For ftp one could use -r or -m but nothing for http. Thus, added an option -k. Man updated. Found a bug in -m: After successful transfer time was *not* set to that of original file, on interruption only when not -m was specified. Fixed. >How-To-Repeat: see description >Fix: Diff to 2.1.5-R source appended below. Changed rm() to cleanup() -- seems more appropriate. ( Not that it would help very much: 2:25 ghost: /home/re 0% fetch -k http://www.intel.com/design/pro/manuals/242690_1.pdf Receiving 242690_1.pdf (4463572 bytes): 12%fetch: Timeout 2:31 ghost: /home/re 1% ll 242690_1.pdf -rw-rw-r-- 1 roberte work 571088 8 Dez 02:31 242690_1.pdf [..] Error (1024): PDF version 1.2 -- xpdf supports version 1.1 (continuing anyway) Error (0): Couldn't read xref table ) diff -ru1 usr/src/usr.bin/fetch.old/fetch.1 usr/src/usr.bin/fetch/fetch.1 --- usr/src/usr.bin/fetch.old/fetch.1 Thu Jul 4 13:04:10 1996 +++ usr/src/usr.bin/fetch/fetch.1 Sat Dec 7 01:32:16 1996 @@ -68,2 +68,4 @@ for transfer. +.It Fl k +Keep. Doesn't remove file when transfer was interrupted. .It Fl q diff -ru1 usr/src/usr.bin/fetch.old/main.c usr/src/usr.bin/fetch/main.c --- usr/src/usr.bin/fetch.old/main.c Thu Jul 4 12:25:31 1996 +++ usr/src/usr.bin/fetch/main.c Sun Dec 8 00:24:48 1996 @@ -66,2 +66,3 @@ int restart = 0; +int keep = 0; time_t modtime; @@ -70,3 +71,3 @@ -void usage (), die (), rm (), t_out (), ftpget (), httpget (), +void usage (), die (), cleanup (), t_out (), ftpget (), httpget (), display (int, int), parse (char *), output_file_name(), @@ -79,3 +80,3 @@ { - fprintf (stderr, "usage: %s [-D:HINPMV:Lqpr] [-o outputfile] <-f file -h host [-c dir]| URL>\n", progname); + fprintf (stderr, "usage: %s [-D:HINPMV:Lkqpr] [-o outputfile] <-f file -h host [-c dir]| URL>\n", progname); exit (1); @@ -87,3 +88,3 @@ int e = errno; - rm (); + cleanup (); if (errno) @@ -96,3 +97,3 @@ void -rm () +cleanup () { @@ -102,5 +103,5 @@ if (file != stdout) { - if (!restart && !mirror) + if (!restart && !mirror && !keep) remove (outputfile); - else if (!mirror) { + else if (mirror) { tv[0].tv_usec = tv[1].tv_usec = 0; @@ -122,3 +123,3 @@ - while ((c = getopt (argc, argv, "D:HINPMV:Lqc:f:h:o:pmr")) != EOF) { + while ((c = getopt (argc, argv, "D:HINPMV:Lqc:f:h:ko:pmr")) != EOF) { switch (c) { @@ -142,2 +143,6 @@ + case 'k': + keep = 1; + break; + case 'o': @@ -173,3 +178,2 @@ } - if (mirror && restart) @@ -195,3 +199,3 @@ fprintf (stderr, "\n%s: Timeout\n", progname); - rm (); + cleanup (); exit (1); @@ -297,3 +301,4 @@ fclose(fp); - fclose(file); + keep = 1; + cleanup (); display (size, -1); @@ -456,3 +461,3 @@ } - rm (); + cleanup (); exit (1); @@ -469,2 +474,3 @@ restart = 0; + mirror = 0; @@ -498,3 +504,3 @@ fprintf (stderr, "%s: Timeout\n", progname); - rm (); + cleanup (); exit (1); @@ -543,3 +549,3 @@ fprintf (stderr, "%s fetching failed, header so far:\n%s\n", file_to_get, s); - rm (); + cleanup (); exit (1); @@ -575,3 +581,3 @@ fprintf (stderr, "Can't decode the header!\n"); - rm (); + cleanup (); exit (1); >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612080142.CAA27684>