Subject: bin/6710: restore(8) user-friendly changes
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bgrayson@ece.utexas.edu>
List: netbsd-bugs
Date: 01/02/1999 01:13:55
>Number:         6710
>Category:       bin
>Synopsis:       Some restore user-friendly changes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan  1 23:20:01 1999
>Last-Modified:
>Originator:     Brian Grayson
>Organization:
	Parallel and Distributed Systems
	Electrical and Computer Engineering
	The University of Texas at Austin
>Release:        Dec 31 1998
>Environment:

>Description:
	Interactive restores:
	1.  If one does "ls foo" where foo doesn't exist in the 
	    current archive, it prints a "helpful" out-of-memory
	    message.
	2.  I and others don't like the default message when
	    doing a restore and it prompts for the volume number.
	    To a naive user, tape 0 would be the first, for
	    example.  The message could be nicer.
	3.  If there is a mismatch between what the user types
	    for the volume and the header, the message could be
	    clearer.
>How-To-Repeat:
>Fix:
--- interactive.c.dist	Sat Jan  2 00:58:31 1999
+++ interactive.c	Sat Jan  2 00:51:09 1999
@@ -316,6 +316,7 @@
 	char *cp;
 	static char input[BUFSIZ];
 	char output[BUFSIZ];
+	int globretval;
 #	define rawname input	/* save space by reusing input buffer */
 
 	/*
@@ -377,8 +378,16 @@
 		(void) strcat(output, rawname);
 		canon(output, name);
 	}
-	if (glob(name, GLOB_ALTDIRFUNC, NULL, &ap->glob) < 0)
-		fprintf(stderr, "%s: out of memory\n", ap->cmd);
+	if ((globretval = glob(name, GLOB_ALTDIRFUNC, NULL, &ap->glob)) < 0) {
+		fprintf(stderr, "%s: %s: ", ap->cmd, name);
+	  	if (globretval == GLOB_NOSPACE)
+			fprintf(stderr, "out of memory\n");
+		else if (globretval == GLOB_NOMATCH)
+			fprintf(stderr, "no filename match.\n");
+		else if (globretval == GLOB_ABORTED)
+			fprintf(stderr, "glob() aborted.\n");
+		else fprintf(stderr, "unknown error!\n");
+	}
 	if (ap->glob.gl_pathc == 0)
 		return;
 	ap->freeglob = 1;

--- tape.c.dist	Sat Jan  2 00:58:22 1999
+++ tape.c	Sat Jan  2 01:03:39 1999
@@ -327,6 +327,8 @@
 			    " file(s) are on you should start\n",
 			    "with the last volume and work",
 			    " towards the first.\n");
+			fprintf(stderr, "(Use 1 for the first "
+			    "volume/tape, etc.)\n");
 		} else {
 			fprintf(stderr, "You have read volumes");
 			strcpy(buf, ": ");
@@ -393,7 +395,9 @@
 		goto again;
 	}
 	if (tmpbuf.c_volume != volno) {
-		fprintf(stderr, "Wrong volume (%d)\n", tmpbuf.c_volume);
+	  	fprintf(stderr, "Volume mismatch:  tape header "
+				"claims it is volume %d, not %d\n",
+				tmpbuf.c_volume, volno);
 		volno = 0;
 		goto again;
 	}
>Audit-Trail:
>Unformatted: