attached patch fixes the pvfs2-ls issue after
replacing strrchr with strchr in sys-lookup.sm.
Sorry for the breakage..:(
thanks,
Murali

On Jan 4, 2008 11:34 AM, Rob Ross <[EMAIL PROTECTED]> wrote:
> should we bump up MAX_NUM_PATHS while we're at it? -- rob
>
>
> On Jan 4, 2008, at 1:06 PM, Murali Vilayannur wrote:
>
> > yep.. thats right :)
> > I think it should be safe to change the strrchr to strchr since it
> > seems to fix both the cases..
> > thanks,
> > Murali
> >
> > On Jan 4, 2008 9:09 AM, Phil Carns <[EMAIL PROTECTED]> wrote:
> >>
> >>>> In the case where you keep the logic that is currently in head
> >>>> but just
> >>>> change strrchr() to strchr(), what breaks in from the previously
> >>>> reported
> >>>> bug?
> >>>>
> >>>> I tried making that change and it looks like both cases work
> >>>> fine, but I
> >>>> may be missing something.
> >>>>
> >>>> Maybe it has something to do with the number of metadata
> >>>> servers?  I am
> >>>> currently trying this with just one server.
> >>>
> >>>
> >>> I tried it again to remind myself.  No segv, but the ls produces the
> >>> wrong answer:
> >>>
> >>> am30$ pvfs2-ls /pvfs/dir1/{0..9} | wc
> >>> Ignoring path /pvfs/dir1/8
> >>> Ignoring path /pvfs/dir1/9
> >>>   4009    4001   15179
> >>>
> >>> Should be 5000 files, and not say "Ignoring path".
> >>>
> >>> My setup is CVS head with 1 md+io server, and 1 client, tcp, plus
> >>> removing
> >>> exactly one 'r' in sys-lookup.sm.
> >>>
> >>
> >> I think this answer is actually right, or at least as right as
> >> pvfs2-ls
> >> will allow :)  pvfs2-ls.c is generating that "Ignoring..." message
> >> because it only allows you to list up to MAX_NUM_PATHS (which is
> >> set to
> >> 8) paths in a single command line invocation.
> >>
> >> -Phil
> >>
> >> _______________________________________________
> >> Pvfs2-developers mailing list
> >> [email protected]
> >> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
> >>
> > _______________________________________________
> > Pvfs2-developers mailing list
> > [email protected]
> > http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
> >
>
>
Index: src/apps/admin/pvfs2-ls.c
===================================================================
RCS file: /anoncvs/pvfs2/src/apps/admin/pvfs2-ls.c,v
retrieving revision 1.69
diff -u -r1.69 pvfs2-ls.c
--- src/apps/admin/pvfs2-ls.c	2 Feb 2007 02:08:55 -0000	1.69
+++ src/apps/admin/pvfs2-ls.c	4 Jan 2008 20:29:09 -0000
@@ -31,12 +31,6 @@
  */
 #define MAX_NUM_DIRENTS    32
 
-/*
-  arbitrarily restrict the number of paths
-  that this ls version can take as arguments
-*/
-#define MAX_NUM_PATHS       8
-
 /* optional parameters, filled in by parse_args() */
 struct options
 {
@@ -51,7 +45,7 @@
     int list_no_owner;
     int list_inode;
     int list_use_si_units;
-    char *start[MAX_NUM_PATHS];
+    char **start;
     int num_starts;
 };
 
@@ -683,19 +677,17 @@
 		exit(EXIT_FAILURE);
 	}
     }
+    tmp_opts->start = (char **) calloc(1, (argc-optind+1) * sizeof(char *));
+    if (tmp_opts->start == NULL) {
+       exit(EXIT_FAILURE);
+    }
 
     for(i = optind; i < argc; i++)
     {
-        if (tmp_opts->num_starts < MAX_NUM_PATHS)
-        {
-            tmp_opts->start[i-optind] = argv[i];
-            tmp_opts->num_starts++;
-        }
-        else
-        {
-            fprintf(stderr,"Ignoring path %s\n",argv[i]);
-        }
+         tmp_opts->start[i-optind] = argv[i];
+         tmp_opts->num_starts++;
     }
+    assert(tmp_opts->num_starts < (argc - optind + 1));
     return tmp_opts;
 }
 
@@ -738,8 +730,8 @@
 int main(int argc, char **argv)
 {
     int ret = -1, i = 0;
-    char pvfs_path[MAX_NUM_PATHS][PVFS_NAME_MAX];
-    PVFS_fs_id fs_id_array[MAX_NUM_PATHS] = {0};
+    char **pvfs_path;
+    PVFS_fs_id *fs_id_array = NULL;
     const PVFS_util_tab* tab;
     struct options* user_opts = NULL;
     char current_dir[PVFS_NAME_MAX] = {0};
@@ -761,12 +753,7 @@
         return(-1);
     }
 
-    for(i = 0; i < MAX_NUM_PATHS; i++)
-    {
-        memset(pvfs_path[i],0,PVFS_NAME_MAX);
-    }
-
-    ret = PVFS_sys_initialize(GOSSIP_NO_DEBUG);
+        ret = PVFS_sys_initialize(GOSSIP_NO_DEBUG);
     if (ret < 0)
     {
 	PVFS_perror("PVFS_sys_initialize", ret);
@@ -799,6 +786,28 @@
 	user_opts->num_starts = 1;
     }
 
+    pvfs_path = (char **) calloc(1, user_opts->num_starts * sizeof(char *));
+    if (!pvfs_path)
+    {
+       fprintf(stderr, "Could not alloc memory\n");
+       return -1;
+    }
+    for(i = 0; i < user_opts->num_starts; i++)
+    {
+       pvfs_path[i] = (char *) calloc(1, PVFS_NAME_MAX);
+       if (pvfs_path[i] == NULL) 
+       {
+         fprintf(stderr, "Could not alloc memory\n");
+         return -1;
+       }
+    }
+    fs_id_array = (PVFS_fs_id *) calloc(1, user_opts->num_starts * sizeof(*fs_id_array));
+    if (fs_id_array == NULL)
+    {
+      fprintf(stderr, "Could not alloc memory\n");
+      return -1;
+    }
+
     for(i = 0; i < user_opts->num_starts; i++)
     {
 	ret = PVFS_util_resolve(user_opts->start[i],
@@ -830,6 +839,14 @@
             printf("\n");
         }
     }
+    for (i = 0; i < user_opts->num_starts; i++) 
+    {
+      free(pvfs_path[i]);
+    }
+    free(user_opts->start);
+    free(pvfs_path);
+    free(fs_id_array);
+    free(user_opts);
 
     PVFS_sys_finalize();
 
_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to