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

Re: "Choose debian archive" box confusing



Martin Schulze wrote:
> Martin Schulze wrote:
> > Message-ID: <Pine.SOL.4.21.0007111738390.16730-100000@draco.cus.cam.ac.uk>
> > MIME-Version: 1.0
> > Content-Type: TEXT/PLAIN; charset=US-ASCII
> > Sender: Ben Harris <bjh21@cus.cam.ac.uk>
> > Delivered-To: submit@bugs.debian.org
> > 
> > Package: boot-floppies
> > Version: 2.2.15
> > 
> > When installing the base system from NFS, I first get asked for a server
> > and mount point, and then for a directory within that mount that holds the
> > Debian archive, with the default being "/instmnt".  My immediate response
> > was to replace this with "/debian", since that was the correct directory
> > name in the mounted filesystem.  When I did this, I found that pressing
> > return had no effect.  I had to use the shell on tty2 to discover that I
> > should have typed "/instmnt/debian".
> > 
> > Either the box should automatically prepend "/instmnt" to the supplied
> > path, or it should explain what /instmnt is.  Error messages when an
> > invalid path is supplied would be nice, too.
> 
> Do we agree that dbootstrap should silently add /instmnt/ since the
> message doesn't imply to prefix that directory and the user does not
> need to know about the mountpoint used.

I've fixed Bug#67082 and wonder if I may commit the code.  I've
decided to really fix it and get back the old behaviour instead of
just editing the message text (which would affect all translators to
fix their text as well).

What I've done technically:

 . enterDirBox() and choose_dir() got one more parameter, telling them
   to limit the display and searches to one directory, called prefix,
   initialized with CM_MOUNTPOINT_DIR aka /instmnt.

 . choose_dir() got some magic to map / to prefix and to traverse the
   directory accordingly

 . choose_archive_dir() got some magic as well to prefix the directory
   with CM_MOUNTPOINT_DIR aka /instmnt but don't display it and don't
   confuse the user with it.

 . choose_archive_dir() defaults to "" instead of /instmnt as well

I wonder if I shall commit the code or not.  Waiting for confirmation.

The patch is attached below and copied to this location as well:
http://www.infodrom.ffis.de/Infodrom/patches/boot-floppies/patch-2.2.16.choose_dir.gz

Index: debian/changelog
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/debian/changelog,v
retrieving revision 1.319
diff -u -r1.319 changelog
--- debian/changelog	2000/08/20 07:50:27	1.319
+++ debian/changelog	2000/08/20 07:51:37
@@ -52,6 +52,9 @@
       (closes: Bug#68659)
     - basedisk.sh: Added /dev/sg* to list of created devices in the base
       system (closes: Bug#67378)
+    - Corrected behavior when user has to type in the path relative to
+      /instmnt, he won't be able to leave that dir anymore and don't has
+      to type in /instmnt anymore (closes: Bug#67082)
   * Akira YOSHIYAMA:
     - add 'termwrap' script to the base system; this is invoked by init
       and allows us to set i18n env var settings for base-config and other
Index: utilities/dbootstrap/boxes.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/boxes.c,v
retrieving revision 1.41
diff -u -r1.41 boxes.c
--- utilities/dbootstrap/boxes.c	2000/08/19 16:19:00	1.41
+++ utilities/dbootstrap/boxes.c	2000/08/20 07:51:41
@@ -23,7 +23,7 @@
 #define NEWT_KEY_ESC    0x1b
 #endif
 
-    static int choose_dir (const char *, const char *, char *, size_t);
+    static int choose_dir (const char *, const char *, const char *, char *, size_t);
 #ifdef USE_LANGUAGE_CHOOSER
     static const struct language_item *boxChooseLanguageHelper (const struct language_list *);
 #endif
@@ -733,7 +733,7 @@
 }
 
 int
-enterDirBox (const char *title, const char *prompt, const char *dir, char *buf, size_t bufsize)
+enterDirBox (const char *title, const char *prompt, const char *prefix, const char *dir, char *buf, size_t bufsize)
 {
     int result = DLG_ERROR;
     newtComponent form, text, entry, choose, obutton, cbutton;
@@ -783,7 +783,7 @@
             case NEWT_EXIT_COMPONENT:
                 if (exit_code.u.co == choose)
                 {
-                    int tempo = choose_dir (title, etext, buf, bufsize);
+                    int tempo = choose_dir (title, prefix, etext, buf, bufsize);
 
                     if (tempo == DLG_OKAY)
                     {
@@ -850,14 +850,17 @@
 }
 
 static int
-choose_dir (const char *title, const char *dir, char *buf, size_t bufsize)
+choose_dir (const char *title, const char *prefix, const char *dir, char *buf, size_t bufsize)
 {
     char *tempo = malloc (PATH_MAX);
+    char mydir[PATH_MAX];
     int result;
+    char *cp;
 
     result = DLG_ERROR;
+    snprintf (mydir, sizeof (mydir), "%s%s", prefix, dir);
 
-    if (normalize_dir (dir, tempo, PATH_MAX) != NULL && tempo[0] == '/')
+    if (normalize_dir (mydir, tempo, PATH_MAX) != NULL && tempo[0] == '/')
     {
         int done = 0;
 
@@ -887,7 +890,9 @@
 
                     newtListboxAddEntry (list, "/", root);
 
-                    for (++index, spaces = 1, p = tempo + 1 ; (q = strchr (p, '/')) != NULL ; ++index, ++spaces, p = q + 1)
+                    for (++index, spaces = 0, p = tempo + 1 + strlen (prefix) ;
+			 (q = strchr (p, '/')) != NULL ;
+			 ++index, ++spaces, p = q + 1)
                     {
                         size_t l = q - p;
 
@@ -1043,6 +1048,8 @@
 
             if (node != NULL)
                 strcpy (tempo, node->value);
+	    if (!strcmp (tempo, "/"))
+	      sprintf (tempo, "%s", prefix);
 
             while (root != NULL)
             {
@@ -1059,7 +1066,10 @@
 
         } while (!done);
 
-        strcpy (buf, tempo);
+	cp = tempo;
+	cp += strlen (prefix);
+
+        strcpy (buf, cp);
     }
 
     free (tempo);
Index: utilities/dbootstrap/boxes.h
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/boxes.h,v
retrieving revision 1.16
diff -u -r1.16 boxes.h
--- utilities/dbootstrap/boxes.h	2000/08/13 13:18:37	1.16
+++ utilities/dbootstrap/boxes.h	2000/08/20 07:51:42
@@ -45,7 +45,7 @@
 int yesNoBox(const char *text, const char *title);
 char *inputBox(const char *text, const char *title, const char *proto);
 
-int enterDirBox (const char *, const char *, const char *, char *, size_t);
+int enterDirBox (const char *, const char *, const char *, const char *, char *, size_t);
 
 void pushHelpLine (const char *, int);
 void popHelpLine (void);
Index: utilities/dbootstrap/choose_medium.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/choose_medium.c,v
retrieving revision 1.89
diff -u -r1.89 choose_medium.c
--- utilities/dbootstrap/choose_medium.c	2000/08/19 16:19:00	1.89
+++ utilities/dbootstrap/choose_medium.c	2000/08/20 07:51:48
@@ -205,6 +205,7 @@
 static int choose_archive_dir(char *text)
 {
     char buffer[PATH_MAX+1];
+    char buffer2[PATH_MAX+1];
     char *mountpoint, *descr = "", *def;
     static char *preventry = NULL;
     unsigned int checked_archive;
@@ -233,17 +234,17 @@
     }
     /* keep user entry between calls to choose_archive_dir */
     if (!preventry)
-	preventry = strdup(mountpoint);
+	preventry = strdup("");
     for (checked_archive = 0 ;; checked_archive++) {
 	if (!checked_archive && is_cdrom_image()) {
 	    /* try the default for cdroms first */
 	    if (is_cdrom_image() == 1)
-		snprintf(buffer, sizeof(buffer), CM_MOUNTPOINT_DIR);
+		buffer2[0] = '\0';
 	    else /* is_cdrom_image() == 2 */
-		strcpy(buffer, "/");
+		strcpy(buffer2, "/");
 	} else {
 	    status = enterDirBox(_("Choose Debian archive path"),
-				 text, preventry, buffer, PATH_MAX);
+				 text, CM_MOUNTPOINT_DIR, preventry, buffer2, PATH_MAX);
 	    if (status == DLG_CANCEL)
 		return DLG_CANCEL;
 	    else if (status != DLG_OKAY)
@@ -251,12 +252,13 @@
 	}
 	checked_archive++;
 	free(preventry);
-	preventry = strdup (buffer);
+	preventry = strdup (buffer2);
+	snprintf (buffer, sizeof (buffer), "%s%s", CM_MOUNTPOINT_DIR, buffer2);
 	if (NAME_ISDIR(buffer, &statbuf))
 	    break;
 	else if (checked_archive == 1 && is_cdrom_image()) { /* first time here, and the last */
 	    free(preventry);
-	    preventry = strdup(mountpoint); /* start over as normal */
+	    preventry = strdup(""); /* start over as normal */
 	}
     }
     mountpoint = strdup(buffer);
@@ -441,7 +443,7 @@
 		     _("Please enter the name of the directory that contains the Archive files.\nThe installation medium is mounted below %s/ ."),
 		     mountpoint);
 	    ;
-	    status = enterDirBox (_("Enter the Archive directory"), prtbuf, mountpoint, buffer, PATH_MAX);
+	    status = enterDirBox (_("Enter the Archive directory"), prtbuf, CM_MOUNTPOINT_DIR, mountpoint, buffer, PATH_MAX);
 	    if (status == DLG_CANCEL)
 		return DLG_CANCEL;
 	    else if (status != DLG_OKAY) {

Regards,

	Joey

-- 
There are lies, statistics and benchmarks.
Oldenburger LinuxTag 2000                 http://oldenburger.linuxtage.de/
Please always Cc to me when replying to me on the lists.



Reply to: