On Tue, Apr 10, 2001 at 01:48:13PM -0500, John R. Jackson wrote:
>
> I'm not sure why you asked about /etc/mtab. While it has the right
> value, we don't look at it in Amanda (which might be the real problem).
> We look at /proc/mounts (which has the wrong /dev value) and MNTTAB,
> which is /etc/fstab (which **really** has the wrong /dev value :-).
I misread the code.
> Maybe we need to look in a third place?
>
> Did you maybe go ahead and create /dev/root and /dev/rroot and that's
> why it works for you?
I have /dev/hda1 in /etc/fstab.
> >... we can't check permission on amname_to_dirname(), we
> >should check permission of the device.
>
> I agree we should try to properly pre-diagnose a permissions problem
> dump will have. I just don't see it happening unless we (hard code)
> add /etc/mtab to the list of places to try and look (in addition to the
> other changes you and Alexandre have made to p2).
Try this patch, It look at MOUNTED before MNTTAB.
Jean-Louis
--
Jean-Louis Martineau email: [EMAIL PROTECTED]
Departement IRO, Universite de Montreal
C.P. 6128, Succ. CENTRE-VILLE Tel: (514) 343-6111 ext. 3529
Montreal, Canada, H3C 3J7 Fax: (514) 343-5834
--- client-src/getfsent.h.orig Mon Apr 9 19:26:48 2001
+++ client-src/getfsent.h Mon Apr 9 19:20:46 2001
@@ -54,7 +54,7 @@
void close_fstab P((void));
int get_fstab_nextentry P((generic_fsent_t *fsent));
-int search_fstab P((char *name, generic_fsent_t *fsent));
+int search_fstab P((char *name, generic_fsent_t *fsent, int check_dev));
int is_local_fstype P((generic_fsent_t *fsent));
char *amname_to_devname P((char *str));
--- client-src/getfsent.c.orig Mon Apr 9 19:26:42 2001
+++ client-src/getfsent.c Tue Apr 10 16:01:28 2001
@@ -144,24 +144,29 @@
#include <mntent.h>
static FILE *fstabf1 = NULL; /* /proc/mounts */
-static FILE *fstabf2 = NULL; /* MNTTAB */
+static FILE *fstabf2 = NULL; /* MOUNTED */
+static FILE *fstabf3 = NULL; /* MNTTAB */
int open_fstab()
{
close_fstab();
#if defined(HAVE_SETMNTENT)
fstabf1 = setmntent("/proc/mounts", "r");
- fstabf2 = setmntent(MNTTAB, "r");
+# if defined(MOUNTED)
+ fstabf2 = setmntent(MOUNTED, "r");
+# endif
+ fstabf3 = setmntent(MNTTAB, "r");
#else
- fstabf2 = fopen(MNTTAB, "r");
+ fstabf3 = fopen(MNTTAB, "r");
#endif
- return (fstabf1 != NULL || fstabf2 != NULL);
+ return (fstabf1 != NULL || fstabf2 != NULL || fstabf3 != NULL);
}
void close_fstab()
{
afclose(fstabf1);
afclose(fstabf2);
+ afclose(fstabf3);
}
int get_fstab_nextentry(fsent)
@@ -181,6 +186,12 @@
afclose(fstabf2);
}
}
+ if(!sys_fsent && fstabf3) {
+ sys_fsent = getmntent(fstabf3);
+ if(!sys_fsent) {
+ afclose(fstabf3);
+ }
+ }
if(!sys_fsent) {
return 0;
}
@@ -427,9 +438,10 @@
return 0;
}
-int search_fstab(name, fsent)
+int search_fstab(name, fsent, check_dev)
char *name;
generic_fsent_t *fsent;
+ int check_dev;
{
struct stat stats[3];
char *fullname = NULL;
@@ -476,8 +488,8 @@
if(fsent->fsname != NULL) {
sfs = stat(fsent->fsname, &fsstat);
sfsr = stat((rdev = dev2rdev(fsent->fsname)), &fsrstat);
- /* We don't want to `continue;' even if both sfs and sfsr are
- -1, because, if we get here, at least smnt is not -1. */
+ if(check_dev == 1 && sfs == -1 && sfsr == -1)
+ continue;
}
if((fsent->mntdir != NULL &&
@@ -520,8 +532,9 @@
{
generic_fsent_t fsent;
- if(search_fstab(str, &fsent))
- if (fsent.fsname != NULL)
+ if(search_fstab(str, &fsent, 1) && fsent.fsname != NULL)
+ str = fsent.fsname;
+ else if(search_fstab(str, &fsent, 0) && fsent.fsname != NULL)
str = fsent.fsname;
return dev2rdev(str);
@@ -532,8 +545,9 @@
{
generic_fsent_t fsent;
- if(search_fstab(str, &fsent))
- if (fsent.mntdir != NULL)
+ if(search_fstab(str, &fsent, 1) && fsent.mntdir != NULL)
+ str = fsent.mntdir;
+ else if(search_fstab(str, &fsent, 0) && fsent.mntdir != NULL)
str = fsent.mntdir;
return stralloc(str);
@@ -544,7 +558,7 @@
{
generic_fsent_t fsent;
- if (!search_fstab(str, &fsent))
+ if (!search_fstab(str, &fsent, 1) && !search_fstab(str, &fsent, 0))
return stralloc("");
return stralloc(fsent.fstype);
@@ -603,7 +617,7 @@
close_fstab();
name = newstralloc(name, "/usr");
- if(search_fstab(name, &fsent)) {
+ if(search_fstab(name, &fsent, 1) || search_fstab(name, &fsent, 0)) {
printf("Found %s mount for %s:\n",
is_local_fstype(&fsent)? "local" : "remote", name);
print_entry(&fsent);
@@ -612,7 +626,7 @@
printf("Mount for %s not found\n", name);
name = newstralloc(name, "/");
- if(search_fstab(name, &fsent)) {
+ if(search_fstab(name, &fsent, 1) || search_fstab(name, &fsent, 0)) {
printf("Found %s mount for %s:\n",
is_local_fstype(&fsent)? "local" : "remote", name);
print_entry(&fsent);