public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
* GNU GNATS 4.0 beta2 released
@ 2002-12-02 15:08 Andrew J. Gray
  2002-12-02 15:11 ` compiling gnats 4.0 beta 2 Steve Friedman
  2002-12-03 19:52 ` patch to display new PR number for new submissions Mel Hatzis
  0 siblings, 2 replies; 22+ messages in thread
From: Andrew J. Gray @ 2002-12-02 15:08 UTC (permalink / raw)
  To: help-gnats, info-gnats

The second beta version of GNU GNATS 4.0 has been released.  The
distribution file gnats-3.999.2.tar.gz is available via anonymous FTP
from

   ftp://ftp.gnu.org/gnu/gnats/

GNU GNATS is a set of tools for tracking bugs reported by users to a
central site.  It allows problem report management and communication
with users through various means, including e-mail, Web and a network
daemon.  GNATS stores all the information about problem reports in its
databases, consisting of plain text files and it provides tools for
querying, editing and maintaining these databases.

GNU GNATS 4 is almost a full rewrite compared with GNATS 3.  New
features since the last official release, 3.113.1, include:

- Vastly improved customization, allowing sites to customize many
  aspects of GNATS behavior, especially to define custom fields of any
  supported type.

- Improved network daemon: It now allows direct problem report
  submission, it can verify the contents of problem reports before they
  are submitted and it provides more database setup information to the
  remote tools.

- Much more powerful database queries.

- Password encryption.

Changes since the first beta release include:

- Many bug-fixes.

- The manual is now fully compliant with GNATS 4.

- Gnatsweb 3.99.4 (4.0 beta 4) is included.

You can get more information about GNU GNATS on its home page at
http://www.gnu.org/software/gnats/ .

Andrew J. Gray


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* compiling gnats 4.0 beta 2
  2002-12-02 15:08 GNU GNATS 4.0 beta2 released Andrew J. Gray
@ 2002-12-02 15:11 ` Steve Friedman
  2002-12-04  2:36   ` Andrew J. Gray
  2002-12-03 19:52 ` patch to display new PR number for new submissions Mel Hatzis
  1 sibling, 1 reply; 22+ messages in thread
From: Steve Friedman @ 2002-12-02 15:11 UTC (permalink / raw)
  To: Andrew J. Gray; +Cc: help-gnats


What version compiler and makeinfo was the beta built with as it seems
that my toolset has problems with the code. I compiled with gcc 2.96-81
and texinfo-4.0-20 on a redhat 7.1 system and received the following 
errors:

- md5.c: numerous warnings that the function-like macros "FG", "FH", and 
"FI" must be used with arguments in traditional C

- floatformat.c: In file included from /usr/include/math.h:350,
                 from floatformat.c:21:
/usr/include/bits/mathinline.h: In function `__sgn1l':
/usr/include/bits/mathinline.h:469: warning: traditional C rejects automatic aggregate initialization

- starting at gnats.texi:2034 (with an "Unknown command `verbatim') 
numerous syntax errors until makeinfo just gave up on the input.

Steve Friedman
ADSI, Inc.





_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* patch to display new PR number for new submissions
  2002-12-02 15:08 GNU GNATS 4.0 beta2 released Andrew J. Gray
  2002-12-02 15:11 ` compiling gnats 4.0 beta 2 Steve Friedman
@ 2002-12-03 19:52 ` Mel Hatzis
  2002-12-04  3:02   ` Andrew J. Gray
                     ` (2 more replies)
  1 sibling, 3 replies; 22+ messages in thread
From: Mel Hatzis @ 2002-12-03 19:52 UTC (permalink / raw)
  To: help-gnats

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

Now that 4.0 beta2 is out the door please review
(and hopefully accept) the following patch which
allows send-pr and "pr-edit --submit" to display
newly created PR numbers.

The patch basically provides an optional '--show-prnum'
sub-option to 'pr-edit --submit' which tells
pr-edit to display the PR number associated with
the submitted PR.

This has proven really useful in our environment,
especially for reporting associated with automated
PR creation. We've been running with this patch
for several months so it's fairly well tested.

--
Mel Hatzis
Juniper Networks, Inc.

[-- Attachment #2: display_newprnum.patch --]
[-- Type: text/plain, Size: 17275 bytes --]

Index: gnats/client.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/client.c,v
retrieving revision 1.46
diff -b -u -p -r1.46 client.c
--- gnats/client.c	25 Nov 2002 13:58:33 -0000	1.46
+++ gnats/client.c	2 Dec 2002 22:20:43 -0000
@@ -270,11 +270,12 @@ read_server (FILE *outfp)
 /* Return the code of the response from the server, or 0 if there wasn't
    any. */
 int
-get_reply (FILE *outfp)
+get_reply (FILE *outfp, char **buf, int *bufsz)
 {
   Reply *r;
   int done = 0;
   int retval = 0;
+  int buf_len, txt_len;
 
   /* Make sure anything we've written has gone to them.  */
   if (fflush (serv_write) == EOF || ferror (serv_write))
@@ -299,6 +300,19 @@ get_reply (FILE *outfp)
 		       program_name, r->state, r->text);
 	    }
 
+	  if (buf != NULL && *buf != NULL && bufsz != NULL && *bufsz > 0)
+	    {
+              (*buf)[*bufsz-1] = '\0'; /* ensure NUL termination */
+              buf_len = strlen (*buf);
+              txt_len = strlen (r->text);
+              if ((buf_len + txt_len) >= *bufsz)
+                {
+                  *bufsz += txt_len * 2;
+                  *buf = xrealloc (*buf, *bufsz);
+                }
+              strncat (*buf, r->text, txt_len);
+	    }
+
 	  switch (r->state)
 	    {
 	    case CODE_GREETING:
@@ -568,7 +582,7 @@ clientConnect (ErrorDesc *err, const cha
   serv_write = file;
 
   /* Get the hello.  */
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 
 #ifdef HAVE_KERBEROS
   {
@@ -699,7 +713,7 @@ clientConnect (ErrorDesc *err, const cha
        response if authorization succeeds, or an error if it fails.
        (Not everyone listed in the Kerberos database is necessarily
        permitted to retrieve information from GNATS.)  */
-    get_reply (stdout);
+    get_reply (stdout, NULL, NULL);
 
   krb_exit:
     /* Zero out the Kerberos scratch area, since it includes
@@ -755,7 +769,7 @@ client_chdb (const char *newRoot)
       fprintf (stderr, "%s: writing `CHDB %s'\n", program_name, newRoot);
     }
   fprintf (serv_write, "CHDB %s\r\n", newRoot);
-  get_reply (stdout);			/* this will exit on error */
+  get_reply (stdout, NULL, NULL);	/* this will exit on error */
 }
 
 static void
@@ -768,7 +782,7 @@ client_user (const char *user, const cha
 	       user, passwd);
     }
   fprintf (serv_write, "USER %s %s\r\n", user, passwd);
-  get_reply(stdout);			/* this will exit on error */
+  get_reply(stdout, NULL, NULL);	/* this will exit on error */
 }
 
 /* Scan the environment and the global database configuration file for the 
@@ -1095,7 +1109,7 @@ sendRemoteListQuery (ListTypes whichList
       fprintf (serv_write, "LIST %s\r\n", listName);
       if (outfile != NULL)
 	{
-	  get_reply (outfile);
+	  get_reply (outfile, NULL, NULL);
 	}
     }
 }
@@ -1108,7 +1122,7 @@ sendQueryFormat (const char *name)
       fprintf (stderr, "%s: writing `QFMT %s'\n", program_name, name);
     }
   fprintf (serv_write, "QFMT %s\r\n", name);
-  get_reply (NULL);
+  get_reply (NULL, NULL, NULL);
 }
 
 void
@@ -1127,7 +1141,7 @@ sendRemoteQuery (const char *queryString
 		   queryString);
 	}
       fprintf (serv_write, "EXPR %s\r\n", queryString);
-      get_reply (NULL);
+      get_reply (NULL, NULL, NULL);
     }
 
   sendQueryFormat (query_format_name);
@@ -1159,7 +1173,7 @@ sendRemoteQuery (const char *queryString
 
   if (outfile != NULL)
     {
-      get_reply (outfile);
+      get_reply (outfile, NULL, NULL);
     }
 }
 
@@ -1172,7 +1186,7 @@ clientGetAdmField (FILE *outfile, const 
       admSubfield = "";
     }
   fprintf (serv_write, "ADMV %s %s %s\r\n", admField, admKey, admSubfield);
-  get_reply (outfile);
+  get_reply (outfile, NULL, NULL);
 }
 
 /* Read PR PRNUM from the GNATS server, and return it.  */
@@ -1183,12 +1197,12 @@ clientReadPR (const char *prNum)
 
   prBeingRead = allocPR (NULL);
   fprintf (serv_write, "RSET\r\n");
-  get_reply (NULL);
+  get_reply (NULL, NULL, NULL);
   fprintf (serv_write, "QFMT full\r\n");
-  get_reply (NULL);
+  get_reply (NULL, NULL, NULL);
   fprintf (serv_write, "QUER %s\r\n", prNum);
   initReadPR (prBeingRead);
-  get_reply (NULL);
+  get_reply (NULL, NULL, NULL);
   res = prBeingRead;
   prBeingRead = NULL;
   return res;
@@ -1201,10 +1215,10 @@ clientGetPRList (const char *expr)
   StringList *res = NULL;
 
   fprintf (serv_write, "RSET\r\n");
-  get_reply (NULL);
+  get_reply (NULL, NULL, NULL);
   sendRemoteQuery (expr, NULL, "Number", NULL);
   prList = &res;
-  get_reply (NULL);
+  get_reply (NULL, NULL, NULL);
   return res;
 }
 
@@ -1212,7 +1226,53 @@ void
 netSetEditEmailAddr (const char *addr)
 {
   fprintf (serv_write, "EDITADDR %s\r\n", addr);
-  get_reply (NULL);
+  get_reply (NULL, NULL, NULL);
+}
+
+static int
+netSendSubmitCmd (FILE *file)
+{
+  int new_pr_num = 0;
+  int msgsz = 128; /* size of message from gnatsd...contains the new pr num */
+  char *line, *reply_text, *p1, *p2;
+  const char *cmd = "SUBM";
+
+  if (debug)
+    {
+      fprintf (stderr, "%s: writing `%s'\n", program_name, cmd);
+    }
+  fprintf (serv_write, "%s\r\n", cmd);
+  get_reply (stdout, NULL, NULL);
+  
+  while ((line = read_line (file, NULL)) != NULL)
+    {
+      write_multitext (serv_write, line, "\r\n");
+      free (line);
+    }
+  fprintf (serv_write, ".\r\n");
+
+  /* read the new PR number from the server response... */
+  reply_text = xmalloc (msgsz);
+  memset (reply_text, '\0', msgsz);
+
+  /* if get_reply finds errors it writes messages and doesn't return */
+  get_reply (stdout, &reply_text, &msgsz);
+
+  if (reply_text != NULL)
+    {
+      /* strip out the new PR number from the server response */
+      p1 = strstr(reply_text, "PR ");
+      p2 = strstr(reply_text, " added");
+      if (p1 != NULL && p2 != NULL)
+        {
+          p2 = '\0';
+          new_pr_num = atoi(p1+3);
+        }
+
+      free(reply_text);
+    }
+
+  return new_pr_num;
 }
 
 static void
@@ -1224,7 +1284,7 @@ netSendPRCmd (const char *cmd, FILE *fil
       fprintf (stderr, "%s: writing `%s'\n", program_name, cmd);
     }
   fprintf (serv_write, "%s\r\n", cmd);
-  get_reply (stdout); /* XXX */
+  get_reply (stdout, NULL, NULL); /* XXX */
   
   while ((line = read_line (file, NULL)) != NULL)
     {
@@ -1233,7 +1293,7 @@ netSendPRCmd (const char *cmd, FILE *fil
     }
   fprintf (serv_write, ".\r\n");
   /* if get_reply finds errors it writes messages and doesn't return */
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 }
 
 void
@@ -1262,7 +1322,7 @@ netEditField (FILE *fp, const char *prnu
   fprintf (serv_write, "%s %s %s\r\n", cmd, prnum, fieldname);
 
   do {
-    reply = get_reply (stdout);
+    reply = get_reply (stdout, NULL, NULL);
     switch (reply)
       {
         case CODE_SEND_TEXT:
@@ -1297,10 +1357,10 @@ netEditField (FILE *fp, const char *prnu
   } while (reply != CODE_OK);
 }
 
-void
+int
 netSubmitNewPR (FILE *file)
 {
-  netSendPRCmd ("SUBM", file);
+  return netSendSubmitCmd (file);
 }
 
 void
@@ -1322,7 +1382,7 @@ netLockDB (void)
       fprintf (stderr, "%s: writing `LKDB'\n", program_name);
     }
   fprintf (serv_write, "LKDB\r\n");
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 }
 
 void
@@ -1333,7 +1393,7 @@ netUnlockDB (void)
       fprintf (stderr, "%s: writing `UNDB'\n", program_name);
     }
   fprintf (serv_write, "UNDB\r\n");
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 }
 
 void
@@ -1347,7 +1407,7 @@ netLockPR (const char *prNum, const char
     {
       fprintf (serv_write, "LOCK %s %s\r\n", prNum, username);
     }
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 }
 
 void
@@ -1358,7 +1418,7 @@ netUnlockPR (const char *prNum)
       fprintf (stderr, "%s: writing `UNLK %s'\n", program_name, prNum);
     }
   fprintf (serv_write, "UNLK %s\r\n", prNum);
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 }
 
 void
@@ -1370,33 +1430,33 @@ netDeletePR (const char *prNum, const ch
       fprintf (stderr, "%s: writing `DELETE %s'\n", program_name, prNum);
     }
   fprintf (serv_write, "DELETE %s\r\n", prNum);
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 }
 
 void
 netFieldFlags (const char *fieldname)
 {
   fprintf (serv_write, "FIELDFLAGS %s\r\n", fieldname);
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 }
 
 void
 netValidValues (const char *fieldname)
 {
   fprintf (serv_write, "FVLD %s\r\n", fieldname);
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 }
 
 void
 netFieldDescription (const char *fieldname)
 {
   fprintf (serv_write, "FDSC %s\r\n", fieldname);
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 }
 
 void
 netFieldType (const char *fieldname)
 {
   fprintf (serv_write, "FTYP %s\r\n", fieldname);
-  get_reply (stdout);
+  get_reply (stdout, NULL, NULL);
 }
Index: gnats/cmds.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/cmds.c,v
retrieving revision 1.70
diff -b -u -p -r1.70 cmds.c
--- gnats/cmds.c	14 Oct 2002 11:42:25 -0000	1.70
+++ gnats/cmds.c	2 Dec 2002 22:20:44 -0000
@@ -478,6 +478,7 @@ GNATS_subm (int ac, char **av ATTRIBUTE_
   char *tempfile;
   FILE *fp;
   ErrorDesc err;
+  int new_pr_num;
 
   if (ac != 0)
     {
@@ -507,9 +508,9 @@ GNATS_subm (int ac, char **av ATTRIBUTE_
     {
       if (daemon_lock_gnats (FALSE) == 0)
 	{
-	  if (submit_pr (currentDatabase, fp, &err) != 0)
+	  if ((new_pr_num = submit_pr (currentDatabase, fp, &err)) != 0)
 	    {
-	      printf ("%d PR added.\r\n", CODE_OK);
+	      printf ("%d PR %d added.\r\n", CODE_OK, new_pr_num);
 	      fflush (stdout);
 	    }
 	  else
Index: gnats/file-pr.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/file-pr.c,v
retrieving revision 1.51
diff -b -u -p -r1.51 file-pr.c
--- gnats/file-pr.c	1 Nov 2002 11:37:51 -0000	1.51
+++ gnats/file-pr.c	2 Dec 2002 22:20:44 -0000
@@ -930,11 +930,13 @@ getBugNumber (const DatabaseInfo databas
   return bug_number;
 }
 
-/* Submit the PR whose contents are referred to by FP.  */
+/* Submit the PR whose contents are referred to by FP.
+ * Return the new PR number if it's a new PR, or return the PR number of
+ * the PR which was appended to if it's an existing PR. */
 int
 submit_pr (const DatabaseInfo database, FILE *fp, ErrorDesc *err)
 {
-  int result;
+  int result, retval;
   PR *pr = allocPR (database);
 
   result = (read_header (pr, fp) >= 0);
@@ -956,10 +958,8 @@ submit_pr (const DatabaseInfo database, 
 	    }
 	  else
 	    {
-	      if (append_report (fp, pr, prID, err) != 0)
-		{
-		  result = 0;
-		}
+	      retval = append_report (fp, pr, prID, err);
+	      result = (retval == 0) ? atoi (prID) : 0;
 	      free_pr (pr);
 	    }
 	  free (prID);
@@ -967,10 +967,8 @@ submit_pr (const DatabaseInfo database, 
       else
 	{
 	  read_pr (pr, fp, 0);
-	  if (createNewPRFile (pr, createCategoryDirs (database), err) < 0)
-	    {
-	      result = 0;
-	    }
+	  retval = createNewPRFile (pr, createCategoryDirs (database), err);
+	  result = (retval < 0) ? 0 : retval;
 	}
     }
   else
Index: gnats/gnats.h
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/gnats.h,v
retrieving revision 1.52
diff -b -u -p -r1.52 gnats.h
--- gnats/gnats.h	31 Oct 2002 23:43:28 -0000	1.52
+++ gnats/gnats.h	2 Dec 2002 22:20:44 -0000
@@ -250,7 +250,7 @@ extern struct tm *get_response_time (con
 				     unsigned int responseTimeInDays);
 
 /* in client.c */
-extern int get_reply (FILE *);
+extern int get_reply (FILE *, char **buf, int *bufsz);
 extern void client_exit (void);
 extern void safe_exit (void);
 extern void client_chdb (const char *database);
@@ -292,7 +292,7 @@ extern void netEditField (FILE *fieldDat
 			  const char *editUserEmailAddr, int appendToField,
 			  char *reason);
 
-extern void netSubmitNewPR (FILE *file);
+extern int netSubmitNewPR (FILE *file);
 extern void netModifyPR (FILE *file, const char *prNum,
 			 const char *editUserEmailAddr);
 extern void netLockDB (void);
Index: gnats/pr-edit.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/pr-edit.c,v
retrieving revision 1.37
diff -b -u -p -r1.37 pr-edit.c
--- gnats/pr-edit.c	1 Nov 2002 09:02:23 -0000	1.37
+++ gnats/pr-edit.c	2 Dec 2002 22:20:44 -0000
@@ -43,6 +43,7 @@ enum {
 } edit_options;
 
 #define DELETE_PR_OPT 256
+#define SHOW_PRNUM_OPT 257
 
 struct option long_options[] =
 {
@@ -61,6 +62,7 @@ struct option long_options[] =
   {"filename", 1, NULL, 'f'},
   {"version", 0, NULL, 'V'},
   {"delete-pr", 0, NULL, DELETE_PR_OPT},
+  {"show-prnum", 0, NULL, SHOW_PRNUM_OPT},
   {"help", 0, NULL, 'h'},
   {"user", 1, NULL, 'v'},
   {"passwd", 1, NULL, 'w'},
@@ -83,9 +85,10 @@ Modify database.\n\
   -L --lockdb              lock the whole database\n\
   -U --unlockdb            unlock the database\n\
   -c --check               check input for editting, don't change PR\n\
-  -C --check-initial       check input for submition, don't submit new PR\n\
+  -C --check-initial       check input for submission, don't submit new PR\n\
   -s --submit              submit new PR\n",
   "\
+     --show-prnum          display the newly created PR number (for --submit)\n\
   -a --append=FIELDNAME    append input to FIELDNAME\n\
   -r --replace=FIELDNAME   replace FIELDNAME with input\n\
      --delete-pr           delete PR from the database completely\n\
@@ -145,9 +148,10 @@ read_file (FILE *inp)
 static void
 handleNetworkEdit (int edit_options, FILE *fpin, char *prnum, char *username,
 		   char *editEmailAddr, char *processid, char *fieldname,
-		   char *reason)
+		   char *reason, int show_prnum)
 {
   int exitcode = 0;
+  int new_pr_num = 0;
 
   switch (edit_options)
     {
@@ -165,7 +169,11 @@ handleNetworkEdit (int edit_options, FIL
       break;
     case SUBMIT:
       {
-	netSubmitNewPR (fpin);
+	new_pr_num = netSubmitNewPR (fpin);
+        if (show_prnum && new_pr_num)
+          {
+            fprintf(stdout, "submitted PR %d\n", new_pr_num);
+          }
 	break;
       }
     case CHECK:
@@ -216,6 +224,7 @@ main (int argc, char **argv)
   int networkmode = 0;
   char *editUserEmailAddr = NULL;
   char *reason = NULL;
+  int show_prnum = 0;
 
   program_name = basename (argv[0]);
   edit_options = MODIFY;
@@ -233,6 +242,10 @@ main (int argc, char **argv)
 	  debug = 1;
 	  break;
 
+	case SHOW_PRNUM_OPT:
+	  show_prnum = 1;
+	  break;
+
 	case 'f':
 	  fp = fopen (optarg, "r");
 	  /* If they gave a bogus argument, then exit right away; we don't
@@ -398,7 +411,7 @@ main (int argc, char **argv)
 	  exit (3);
 	}
       handleNetworkEdit (edit_options, fp, prnum, username, editUserEmailAddr,
-			 processid, fieldname, reason);
+			 processid, fieldname, reason, show_prnum);
     }
 
   database = init_gnats (program_name, nameOfDatabase, &err);
@@ -467,6 +480,10 @@ main (int argc, char **argv)
 	case SUBMIT:
 	  {
 	    result = submit_pr (database, fp, &err);
+            if (show_prnum && result)
+              {
+                fprintf (stdout, "submitted PR %d\n", result);
+              }
 	    break;
 	  }
 	case APPEND:
Index: send-pr/send-pr.sh
===================================================================
RCS file: /cvsroot/gnats/gnats/send-pr/send-pr.sh,v
retrieving revision 1.23
diff -b -u -p -r1.23 send-pr.sh
--- send-pr/send-pr.sh	29 Oct 2002 09:58:15 -0000	1.23
+++ send-pr/send-pr.sh	2 Dec 2002 22:20:44 -0000
@@ -536,8 +536,9 @@ do
     echo "$COMMAND: problem report mailed"
     xs=0; exit
   else
-    if $LIBEXECDIR/pr-edit --submit < $REF; then
-      echo "$COMMAND: problem report filed"
+    if cmd_msg=`$LIBEXECDIR/pr-edit --submit --show-prnum < $REF` ; then
+      pr_num=`expr //"$cmd_msg" : '.* \(.*\)'` # strip out the PR number
+      echo "$COMMAND: problem report $pr_num filed"
       xs=0; exit
     else
       echo "$COMMAND: the problem report is not sent."
Index: p-admin.texi
===================================================================
RCS file: /cvsroot/gnats/gnats/doc/p-admin.texi,v
retrieving revision 1.34
diff -b -u -p -r1.34 p-admin.texi
--- p-admin.texi        27 Nov 2002 22:04:38 -0000      1.34
+++ p-admin.texi        2 Dec 2002 23:04:12 -0000
@@ -2083,7 +2083,7 @@ The usage for @code{pr-edit} is:
 @smallexample
 pr-edit   [ -l @var{username} | --lock=@var{username} ] [ -u | --unlockdb ]
           [ -L | --lockdb ] [ -U | --unlockdb ] [ -c | --check ]
-          [ -C | --check-initial ] [ -s | --submit ]
+          [ -C | --check-initial ] [ -s | --submit [ --show-prnum ] ]
           [ -a @var{field} | --append field=@var{field} ]
           [ -r @var{field} | --replace=@var{field} ] [ --delete-pr ]
           [ -R @var{reason} | --reason=@var{reason} ]
@@ -2150,6 +2150,10 @@ for content; if the PR is valid as an in
 the database. A zero exit code is returned if the submission was
 successful.  Otherwise, the reason(s) for the PR being rejected are
 printed to stdout, and a non-zero exit code is returned.
+
+@item --show-prnum
+This option is used with the @code{--submit} option to display the PR
+number associated with the submitted PR.
 @end table

 @noindent The following options require a PR number to be given.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: compiling gnats 4.0 beta 2
  2002-12-02 15:11 ` compiling gnats 4.0 beta 2 Steve Friedman
@ 2002-12-04  2:36   ` Andrew J. Gray
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew J. Gray @ 2002-12-04  2:36 UTC (permalink / raw)
  To: steve; +Cc: help-gnats

> What version compiler and makeinfo was the beta built with as it seems
> that my toolset has problems with the code. I compiled with gcc 2.96-81
> and texinfo-4.0-20 on a redhat 7.1 system and received the following 
> errors:

I am running RedHat 7.1 with gcc 2.96-81 but with texinfo 4.2-5.
Changes to the documentation since beta1 require texinfo 4.2 or later.

> - md5.c: numerous warnings that the function-like macros "FG", "FH", and 
> "FI" must be used with arguments in traditional C
> 
> - floatformat.c: In file included from /usr/include/math.h:350,
>                  from floatformat.c:21:
> /usr/include/bits/mathinline.h: In function `__sgn1l':
> /usr/include/bits/mathinline.h:469: warning: traditional C rejects automatic aggregate initialization

I see these warnings also. I will look into them. I don't think that
they indicate bugs in GNATS.

> - starting at gnats.texi:2034 (with an "Unknown command `verbatim') 
> numerous syntax errors until makeinfo just gave up on the input.

These errors do not occur with Texinfo 4.2.

Andrew Gray


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2002-12-03 19:52 ` patch to display new PR number for new submissions Mel Hatzis
@ 2002-12-04  3:02   ` Andrew J. Gray
  2002-12-08  7:58   ` Andrew J. Gray
  2003-08-30 11:58   ` Andrew J. Gray
  2 siblings, 0 replies; 22+ messages in thread
From: Andrew J. Gray @ 2002-12-04  3:02 UTC (permalink / raw)
  To: hatzis; +Cc: help-gnats

> Now that 4.0 beta2 is out the door please review
> (and hopefully accept) the following patch which
> allows send-pr and "pr-edit --submit" to display
> newly created PR numbers.

Thanks for that patch. I will review it.

-- 
Andrew J. Gray


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2002-12-03 19:52 ` patch to display new PR number for new submissions Mel Hatzis
  2002-12-04  3:02   ` Andrew J. Gray
@ 2002-12-08  7:58   ` Andrew J. Gray
  2002-12-08 12:27     ` Yngve Svendsen
                       ` (2 more replies)
  2003-08-30 11:58   ` Andrew J. Gray
  2 siblings, 3 replies; 22+ messages in thread
From: Andrew J. Gray @ 2002-12-08  7:58 UTC (permalink / raw)
  To: hatzis; +Cc: help-gnats

> Now that 4.0 beta2 is out the door please review
> (and hopefully accept) the following patch which
> allows send-pr and "pr-edit --submit" to display
> newly created PR numbers.

Thanks for submitting that patch, I have had a look at it.

I have a concern that the changes it makes to the gnatsd command
protocol break the assumption that clients should not attempt to parse
the message strings on response lines from the server.

As I understand it the current protocol for submitting PRs goes
something like:

-> SUBM
<- 211 Ok.
-> <PR contents>
-> <PR contents>
-> .
<- 210 PR Added.

(-> is from the client, <- is from the server)
With your changes the response from the server would be, for example:

<- 210 PR 68 Added.

I was thinking that it would be more consistent to have the server
return:

<- 351-The added PR number is:
<- 350 68

What do you think? Can you see problems with implementing the "return
PR number to submitter" functionality in the way I am suggesting?

I try to code modifications to your patch along these lines.

-- 
Andrew J. Gray


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2002-12-08  7:58   ` Andrew J. Gray
@ 2002-12-08 12:27     ` Yngve Svendsen
  2002-12-08 23:11       ` Patching the manual Lars Henriksen
  2002-12-12  6:29       ` patch to display new PR number for new submissions Andrew J. Gray
  2002-12-08 23:11     ` Mel Hatzis
  2002-12-09 10:54     ` dirk bergstrom
  2 siblings, 2 replies; 22+ messages in thread
From: Yngve Svendsen @ 2002-12-08 12:27 UTC (permalink / raw)
  To: Andrew J. Gray, hatzis; +Cc: help-gnats

At 17:25 08.12.2002 +1100, Andrew J. Gray wrote:
><- 351-The added PR number is:
><- 350 68
>
>What do you think? Can you see problems with implementing the "return
>PR number to submitter" functionality in the way I am suggesting?
>
>I try to code modifications to your patch along these lines.

I think that looks good. Do remember to update the manual in all 
appropriate places, though (we must never, ever end up in the same 
situation we had 18 months ago, where the manual was next to unusable since 
it had not been updated in sync with 4.0 development)

- Yngve 



_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Patching the manual
  2002-12-08 12:27     ` Yngve Svendsen
@ 2002-12-08 23:11       ` Lars Henriksen
  2002-12-12  3:58         ` Yngve Svendsen
  2002-12-12  6:29       ` patch to display new PR number for new submissions Andrew J. Gray
  1 sibling, 1 reply; 22+ messages in thread
From: Lars Henriksen @ 2002-12-08 23:11 UTC (permalink / raw)
  To: Yngve Svendsen; +Cc: hatzis, Andrew J. Gray, help-gnats

On Sun, Dec 08, 2002 at 12:58:30PM +0100, Yngve Svendsen wrote:
> 
> I think that looks good. Do remember to update the manual in all 
> appropriate places, though (we must never, ever end up in the same 
> situation we had 18 months ago, where the manual was next to unusable since 
> it had not been updated in sync with 4.0 development)

Speaking of which ...

GNATS Subject matching is poorly documented and since a year back also 
incompletely. Moreover, the behaviour is not the one agreed upon a year
back.

I recently submitted a patch WITH documentation changes, but no one
seems to take notice.

Lars


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2002-12-08  7:58   ` Andrew J. Gray
  2002-12-08 12:27     ` Yngve Svendsen
@ 2002-12-08 23:11     ` Mel Hatzis
  2003-02-02  9:32       ` Andrew J. Gray
  2002-12-09 10:54     ` dirk bergstrom
  2 siblings, 1 reply; 22+ messages in thread
From: Mel Hatzis @ 2002-12-08 23:11 UTC (permalink / raw)
  To: Andrew J. Gray; +Cc: help-gnats

On 12/07/2002 10:25 PM, Andrew J. Gray submitted:

>>Now that 4.0 beta2 is out the door please review
>>(and hopefully accept) the following patch which
>>allows send-pr and "pr-edit --submit" to display
>>newly created PR numbers.
>>    
>>
>
>Thanks for submitting that patch, I have had a look at it.
>
>I have a concern that the changes it makes to the gnatsd command
>protocol break the assumption that clients should not attempt to parse
>the message strings on response lines from the server.
>
>As I understand it the current protocol for submitting PRs goes
>something like:
>
>-> SUBM
><- 211 Ok.
>-> <PR contents>
>-> <PR contents>
>-> .
><- 210 PR Added.
>
>(-> is from the client, <- is from the server)
>With your changes the response from the server would be, for example:
>
><- 210 PR 68 Added.
>
>I was thinking that it would be more consistent to have the server
>return:
>
><- 351-The added PR number is:
><- 350 68
>
>What do you think? Can you see problems with implementing the "return
>PR number to submitter" functionality in the way I am suggesting?
>  
>
I see no problems with your suggested approach.

>I try to code modifications to your patch along these lines.
>
>  
>
OK great....thanks for looking at the patch.

--
Mel Hatzis




_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2002-12-08  7:58   ` Andrew J. Gray
  2002-12-08 12:27     ` Yngve Svendsen
  2002-12-08 23:11     ` Mel Hatzis
@ 2002-12-09 10:54     ` dirk bergstrom
  2002-12-14 14:26       ` Andrew J. Gray
  2 siblings, 1 reply; 22+ messages in thread
From: dirk bergstrom @ 2002-12-09 10:54 UTC (permalink / raw)
  To: Andrew J. Gray; +Cc: hatzis, help-gnats

Andrew J. Gray expounded at length upon:
> I have a concern that the changes it makes to the gnatsd command
> protocol break the assumption that clients should not attempt to parse
> the message strings on response lines from the server
> I was thinking that it would be more consistent to have the server
> return:
> 351-The added PR number is:
> 350 68

hmmm.  very good point.  i think that's a heck of a lot easier to program
to.  if i may make a suggestion, it might be clearer as:

210-PR submission accepted.
351-The new PR was assigned number:
350 68

that way you get a clear 210 (OK) response, and the PR number as
additional information.

furthermore, if you're going to make the change to SUBM, i think it would
be good to consider the response to the CHDB command.  currently gnats
replies with the access level, but it must be parsed out of the string:

200 snowy.juniper.net GNATS server 4.0-beta2 ready.
chdb default dbergstr foo
210-Now accessing GNATS database 'default'
210 User access level set to 'edit'

this might be better as:

200 snowy.juniper.net GNATS server 4.0-beta2 ready.
chdb default dbergstr foo
210-Now accessing GNATS database:
350-default
351-User access level set to:
350 edit

or something like that...

i bring this up because i've just written a java gnats client, and had to
go out of my way to parse both replies...

-- 
Dirk Bergstrom               dirk@juniper.net
_____________________________________________
Juniper Networks Inc.,          Computer Geek
Tel: 408.745.3182           Fax: 408.745.8905



_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Patching the manual
  2002-12-08 23:11       ` Patching the manual Lars Henriksen
@ 2002-12-12  3:58         ` Yngve Svendsen
  0 siblings, 0 replies; 22+ messages in thread
From: Yngve Svendsen @ 2002-12-12  3:58 UTC (permalink / raw)
  To: Lars Henriksen; +Cc: hatzis, Andrew J. Gray, help-gnats

At 16:56 08.12.2002 +0100, Lars Henriksen wrote:
>Speaking of which ...
>
>GNATS Subject matching is poorly documented and since a year back also
>incompletely. Moreover, the behaviour is not the one agreed upon a year
>back.
>
>I recently submitted a patch WITH documentation changes, but no one
>seems to take notice.


 From the very cursory look I've managed to take, it looks good. I hope to 
get it applied this week (busy, busy, busy)

- Yngve 



_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2002-12-08 12:27     ` Yngve Svendsen
  2002-12-08 23:11       ` Patching the manual Lars Henriksen
@ 2002-12-12  6:29       ` Andrew J. Gray
  1 sibling, 0 replies; 22+ messages in thread
From: Andrew J. Gray @ 2002-12-12  6:29 UTC (permalink / raw)
  To: yngve.svendsen; +Cc: hatzis, help-gnats

> I think that looks good. Do remember to update the manual in all 
> appropriate places, though (we must never, ever end up in the same 

Thanks for the reminder, I will make sure I update the manual.

-- 
Andrew J. Gray


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2002-12-09 10:54     ` dirk bergstrom
@ 2002-12-14 14:26       ` Andrew J. Gray
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew J. Gray @ 2002-12-14 14:26 UTC (permalink / raw)
  To: dirk; +Cc: hatzis, help-gnats

> > I was thinking that it would be more consistent to have the server
> > return:
> > 351-The added PR number is:
> > 350 68

> to.  if i may make a suggestion, it might be clearer as:
> 
> 210-PR submission accepted.
> 351-The new PR was assigned number:
> 350 68
> 
> that way you get a clear 210 (OK) response, and the PR number as
> additional information.

Thanks for that suggestion.  However, I am still inclined towards
dropping the 210 and only sending the 351 and 350 if the PR is created
successfully.  To me the 351 and 350 make it clear enough to a person
trying to understand the protocol that the PR submission was
successful.  I think for people implementing clients having a simpler,
shorter expected response should be easier.  Also the current
documentation for codes 200-299 says "No subsequent data will be
transmitted with the response".

Does anyone else have an opion on this?

> furthermore, if you're going to make the change to SUBM, i think it would
> be good to consider the response to the CHDB command.  currently gnats
> replies with the access level, but it must be parsed out of the string:
> 
> 200 snowy.juniper.net GNATS server 4.0-beta2 ready.
> chdb default dbergstr foo
> 210-Now accessing GNATS database 'default'
> 210 User access level set to 'edit'
> 
> this might be better as:
> 
> 200 snowy.juniper.net GNATS server 4.0-beta2 ready.
> chdb default dbergstr foo
> 210-Now accessing GNATS database:
> 350-default
> 351-User access level set to:
> 350 edit
> 
> or something like that...

Thanks for pointing that case out.  I'm not sure that the database
changed to is information clients need to parse, as I understand the
semantics of the CHDB command if it is successful it must have changed
to the database specified by the client.  I'm also inclined to stick
to the "rule" of not following 210s with data, giving something like:

chdb default dbergstr foo
351-Now accessing GNATS database 'default'
351-User access level set to:
350 edit

I will look at coding this case also.  I will need to look at what
impact these changes would have on current clients before committing
them.

-- 
Andrew J. Gray


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2002-12-08 23:11     ` Mel Hatzis
@ 2003-02-02  9:32       ` Andrew J. Gray
  2003-02-03 20:46         ` Mel Hatzis
  0 siblings, 1 reply; 22+ messages in thread
From: Andrew J. Gray @ 2003-02-02  9:32 UTC (permalink / raw)
  To: hatzis; +Cc: help-gnats

> >>Now that 4.0 beta2 is out the door please review
> >>(and hopefully accept) the following patch which
> >>allows send-pr and "pr-edit --submit" to display
> >>newly created PR numbers.
> 
> >I try to code modifications to your patch along these lines.

I have coded modifications to your patch along the lines I
suggested. The modified patch is at the end of this message. Please
have a look at it and let me know (a) if it meets the requirements you
were addressing with the original patch, and (b) if there are any
problems with it.

Since this change is an enhancement and modifies the gnatsd command
protocol I am thinking it should not be included in GNATS 4.0 final,
but put on a 4.1 branch. What do people think?
-- 
Andrew J. Gray

Index: doc/gnats.texi
===================================================================
RCS file: /cvsroot/gnats/gnats/doc/gnats.texi,v
retrieving revision 1.40
diff -u -p -r1.40 gnats.texi
--- doc/gnats.texi	25 Nov 2002 08:48:44 -0000	1.40
+++ doc/gnats.texi	2 Feb 2003 08:31:04 -0000
@@ -1386,8 +1386,9 @@ lock is cleared.
 @code{211 (CODE_SEND_PR)}
 @*The client should now transmit the new PR text using the normal
 quoting mechanism.  After the PR has been sent, the server will respond
-with either a @code{200 (CODE_OK)} response indicating that the new PR
-has been created (and mail sent to the appropriate persons), or one or
+with either @code{351 (CODE_INFORMATION_FILLER)} and
+@code{350 (CODE_INFORMATION)} responses indicating that the new PR
+has been created and supplying the number assigned to it, or one or
 more error codes listing problems with the new PR text.
 
 @item CHDB @var{database}
Index: doc/p-admin.texi
===================================================================
RCS file: /cvsroot/gnats/gnats/doc/p-admin.texi,v
retrieving revision 1.34
diff -u -p -r1.34 p-admin.texi
--- doc/p-admin.texi	27 Nov 2002 22:04:38 -0000	1.34
+++ doc/p-admin.texi	2 Feb 2003 08:31:18 -0000
@@ -2083,7 +2083,7 @@ The usage for @code{pr-edit} is:
 @smallexample
 pr-edit   [ -l @var{username} | --lock=@var{username} ] [ -u | --unlockdb ]
           [ -L | --lockdb ] [ -U | --unlockdb ] [ -c | --check ]
-          [ -C | --check-initial ] [ -s | --submit ]
+          [ -C | --check-initial ] [ -s | --submit [ --show-prnum ] ]
           [ -a @var{field} | --append field=@var{field} ]
           [ -r @var{field} | --replace=@var{field} ] [ --delete-pr ]
           [ -R @var{reason} | --reason=@var{reason} ]
@@ -2147,9 +2147,13 @@ rather than proposed edits of existing P
 @itemx --submit
 Used to submit a new PR to the database.  The PR is read in and verified
 for content; if the PR is valid as an initial PR, it is then added to
-the database. A zero exit code is returned if the submission was
-successful.  Otherwise, the reason(s) for the PR being rejected are
-printed to stdout, and a non-zero exit code is returned.
+the database.  If the submission a zero exit code is returned.  Otherwise, the
+reason(s) for the PR being rejected are
+printed, and a non-zero exit code is returned.
+
+@item --show-prnum
+This option is used with the @code{--submit} option to display the PR
+number associated with the submitted PR.
 @end table
 
 @noindent The following options require a PR number to be given.
Index: gnats/client.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/client.c,v
retrieving revision 1.46
diff -u -p -r1.46 client.c
--- gnats/client.c	25 Nov 2002 13:58:33 -0000	1.46
+++ gnats/client.c	2 Feb 2003 08:31:23 -0000
@@ -334,7 +334,8 @@ get_reply (FILE *outfp)
 	      break;
 
 	    case CODE_INFORMATION:
-	      fprintf (outfp, "%s\n", r->text);
+	      if (outfp != NULL)
+		fprintf (outfp, "%s\n", r->text);
 	      break;
 
 	    case CODE_NONEXISTENT_PR:
@@ -1216,7 +1217,7 @@ netSetEditEmailAddr (const char *addr)
 }
 
 static void
-netSendPRCmd (const char *cmd, FILE *file)
+netSendPRCmd (const char *cmd, FILE *file, int show_information)
 {
   char *line;
   if (debug)
@@ -1233,13 +1234,13 @@ netSendPRCmd (const char *cmd, FILE *fil
     }
   fprintf (serv_write, ".\r\n");
   /* if get_reply finds errors it writes messages and doesn't return */
-  get_reply (stdout);
+  get_reply (show_information ? stdout : NULL);
 }
 
 void
 netCheckPR (FILE *file, int initial)
 {
-  netSendPRCmd (initial ? "CHEK INIT" : "CHEK", file);
+  netSendPRCmd (initial ? "CHEK INIT" : "CHEK", file, 1);
 }
 
 void
@@ -1298,9 +1299,9 @@ netEditField (FILE *fp, const char *prnu
 }
 
 void
-netSubmitNewPR (FILE *file)
+netSubmitNewPR (FILE *file, int show_prnum)
 {
-  netSendPRCmd ("SUBM", file);
+  netSendPRCmd ("SUBM", file, show_prnum);
 }
 
 void
@@ -1310,7 +1311,7 @@ netModifyPR (FILE *file, const char *prN
 
   netSetEditEmailAddr (editEmailAddr);
   asprintf (&buf, "EDIT %s", prNum);
-  netSendPRCmd (buf, file);
+  netSendPRCmd (buf, file, 1);
   free (buf);
 }
 
Index: gnats/cmds.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/cmds.c,v
retrieving revision 1.70
diff -u -p -r1.70 cmds.c
--- gnats/cmds.c	14 Oct 2002 11:42:25 -0000	1.70
+++ gnats/cmds.c	2 Feb 2003 08:31:29 -0000
@@ -478,6 +478,7 @@ GNATS_subm (int ac, char **av ATTRIBUTE_
   char *tempfile;
   FILE *fp;
   ErrorDesc err;
+  int new_pr_num;
 
   if (ac != 0)
     {
@@ -507,9 +508,11 @@ GNATS_subm (int ac, char **av ATTRIBUTE_
     {
       if (daemon_lock_gnats (FALSE) == 0)
 	{
-	  if (submit_pr (currentDatabase, fp, &err) != 0)
+	  if ((new_pr_num = submit_pr (currentDatabase, fp, &err)) != 0)
 	    {
-	      printf ("%d PR added.\r\n", CODE_OK);
+	      printf ("%d-The added PR number is:\r\n",
+		      CODE_INFORMATION_FILLER);
+	      printf ("%d %d\r\n", CODE_INFORMATION, new_pr_num);
 	      fflush (stdout);
 	    }
 	  else
Index: gnats/file-pr.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/file-pr.c,v
retrieving revision 1.51
diff -u -p -r1.51 file-pr.c
--- gnats/file-pr.c	1 Nov 2002 11:37:51 -0000	1.51
+++ gnats/file-pr.c	2 Feb 2003 08:31:32 -0000
@@ -930,11 +930,13 @@ getBugNumber (const DatabaseInfo databas
   return bug_number;
 }
 
-/* Submit the PR whose contents are referred to by FP.  */
+/* Submit the PR whose contents are referred to by FP.
+ * Return the new PR number if it's a new PR, or return the PR number of
+ * the PR which was appended to if it's an existing PR. */
 int
 submit_pr (const DatabaseInfo database, FILE *fp, ErrorDesc *err)
 {
-  int result;
+  int result, retval;
   PR *pr = allocPR (database);
 
   result = (read_header (pr, fp) >= 0);
@@ -956,10 +958,8 @@ submit_pr (const DatabaseInfo database, 
 	    }
 	  else
 	    {
-	      if (append_report (fp, pr, prID, err) != 0)
-		{
-		  result = 0;
-		}
+	      retval = append_report (fp, pr, prID, err);
+	      result = (retval == 0) ? atoi (prID) : 0;
 	      free_pr (pr);
 	    }
 	  free (prID);
@@ -967,10 +967,8 @@ submit_pr (const DatabaseInfo database, 
       else
 	{
 	  read_pr (pr, fp, 0);
-	  if (createNewPRFile (pr, createCategoryDirs (database), err) < 0)
-	    {
-	      result = 0;
-	    }
+	  retval = createNewPRFile (pr, createCategoryDirs (database), err);
+	  result = (retval < 0) ? 0 : retval;
 	}
     }
   else
Index: gnats/gnats.h
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/gnats.h,v
retrieving revision 1.52
diff -u -p -r1.52 gnats.h
--- gnats/gnats.h	31 Oct 2002 23:43:28 -0000	1.52
+++ gnats/gnats.h	2 Feb 2003 08:31:33 -0000
@@ -292,7 +292,7 @@ extern void netEditField (FILE *fieldDat
 			  const char *editUserEmailAddr, int appendToField,
 			  char *reason);
 
-extern void netSubmitNewPR (FILE *file);
+extern void netSubmitNewPR (FILE *file, int show_prnum);
 extern void netModifyPR (FILE *file, const char *prNum,
 			 const char *editUserEmailAddr);
 extern void netLockDB (void);
Index: gnats/pr-edit.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/pr-edit.c,v
retrieving revision 1.37
diff -u -p -r1.37 pr-edit.c
--- gnats/pr-edit.c	1 Nov 2002 09:02:23 -0000	1.37
+++ gnats/pr-edit.c	2 Feb 2003 08:31:36 -0000
@@ -43,6 +43,7 @@ enum {
 } edit_options;
 
 #define DELETE_PR_OPT 256
+#define SHOW_PRNUM_OPT 257
 
 struct option long_options[] =
 {
@@ -61,6 +62,7 @@ struct option long_options[] =
   {"filename", 1, NULL, 'f'},
   {"version", 0, NULL, 'V'},
   {"delete-pr", 0, NULL, DELETE_PR_OPT},
+  {"show-prnum", 0, NULL, SHOW_PRNUM_OPT},
   {"help", 0, NULL, 'h'},
   {"user", 1, NULL, 'v'},
   {"passwd", 1, NULL, 'w'},
@@ -83,9 +85,10 @@ Modify database.\n\
   -L --lockdb              lock the whole database\n\
   -U --unlockdb            unlock the database\n\
   -c --check               check input for editting, don't change PR\n\
-  -C --check-initial       check input for submition, don't submit new PR\n\
+  -C --check-initial       check input for submission, don't submit new PR\n\
   -s --submit              submit new PR\n",
   "\
+     --show-prnum          display the newly created PR number (for --submit)\n\
   -a --append=FIELDNAME    append input to FIELDNAME\n\
   -r --replace=FIELDNAME   replace FIELDNAME with input\n\
      --delete-pr           delete PR from the database completely\n\
@@ -145,7 +148,7 @@ read_file (FILE *inp)
 static void
 handleNetworkEdit (int edit_options, FILE *fpin, char *prnum, char *username,
 		   char *editEmailAddr, char *processid, char *fieldname,
-		   char *reason)
+		   char *reason, int show_prnum)
 {
   int exitcode = 0;
 
@@ -165,7 +168,7 @@ handleNetworkEdit (int edit_options, FIL
       break;
     case SUBMIT:
       {
-	netSubmitNewPR (fpin);
+	netSubmitNewPR (fpin, show_prnum);
 	break;
       }
     case CHECK:
@@ -216,6 +219,7 @@ main (int argc, char **argv)
   int networkmode = 0;
   char *editUserEmailAddr = NULL;
   char *reason = NULL;
+  int show_prnum = 0;
 
   program_name = basename (argv[0]);
   edit_options = MODIFY;
@@ -233,6 +237,10 @@ main (int argc, char **argv)
 	  debug = 1;
 	  break;
 
+	case SHOW_PRNUM_OPT:
+	  show_prnum = 1;
+	  break;
+
 	case 'f':
 	  fp = fopen (optarg, "r");
 	  /* If they gave a bogus argument, then exit right away; we don't
@@ -398,7 +406,7 @@ main (int argc, char **argv)
 	  exit (3);
 	}
       handleNetworkEdit (edit_options, fp, prnum, username, editUserEmailAddr,
-			 processid, fieldname, reason);
+			 processid, fieldname, reason, show_prnum);
     }
 
   database = init_gnats (program_name, nameOfDatabase, &err);
@@ -467,6 +475,10 @@ main (int argc, char **argv)
 	case SUBMIT:
 	  {
 	    result = submit_pr (database, fp, &err);
+            if (show_prnum && result)
+              {
+                fprintf (stdout, "%d\n", result);
+              }
 	    break;
 	  }
 	case APPEND:
Index: send-pr/send-pr.sh
===================================================================
RCS file: /cvsroot/gnats/gnats/send-pr/send-pr.sh,v
retrieving revision 1.23
diff -u -p -r1.23 send-pr.sh
--- send-pr/send-pr.sh	29 Oct 2002 09:58:15 -0000	1.23
+++ send-pr/send-pr.sh	2 Feb 2003 08:31:40 -0000
@@ -536,8 +536,8 @@ do
     echo "$COMMAND: problem report mailed"
     xs=0; exit
   else
-    if $LIBEXECDIR/pr-edit --submit < $REF; then
-      echo "$COMMAND: problem report filed"
+    if pr_num=`$LIBEXECDIR/pr-edit --submit --show-prnum < $REF` ; then
+      echo "$COMMAND: problem report $pr_num filed"
       xs=0; exit
     else
       echo "$COMMAND: the problem report is not sent."


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2003-02-02  9:32       ` Andrew J. Gray
@ 2003-02-03 20:46         ` Mel Hatzis
  2003-02-03 20:51           ` Yngve Svendsen
  2003-02-09  7:48           ` Andrew J. Gray
  0 siblings, 2 replies; 22+ messages in thread
From: Mel Hatzis @ 2003-02-03 20:46 UTC (permalink / raw)
  To: Andrew J. Gray; +Cc: help-gnats

On 02/02/2003 12:32 AM, Andrew J. Gray wrote:
>>>>Now that 4.0 beta2 is out the door please review
>>>>(and hopefully accept) the following patch which
>>>>allows send-pr and "pr-edit --submit" to display
>>>>newly created PR numbers.
>>>
>>>I try to code modifications to your patch along these lines.
>>
> 
> I have coded modifications to your patch along the lines I
> suggested. The modified patch is at the end of this message. Please
> have a look at it and let me know (a) if it meets the requirements you
> were addressing with the original patch, and (b) if there are any
> problems with it.

Generally, the patch looks good...it's a cleaner approach to the
one I submitted.

One small concern with the patch though...in get_reply you've made
a change allowing for outfp to be NULL...

   > RCS file: /cvsroot/gnats/gnats/gnats/client.c,v
 > retrieving revision 1.46
 > diff -u -p -r1.46 client.c
 > --- gnats/client.c    25 Nov 2002 13:58:33 -0000    1.46
 > +++ gnats/client.c    2 Feb 2003 08:31:23 -0000
 > @@ -334,7 +334,8 @@ get_reply (FILE *outfp)
 >            break;
 >
 >          case CODE_INFORMATION:
 > -          fprintf (outfp, "%s\n", r->text);
 > +          if (outfp != NULL)
 > +        fprintf (outfp, "%s\n", r->text);
 >            break;
 >
 >          case CODE_NONEXISTENT_PR:
 > @@ -1216,7 +1217,7 @@ netSetEditEmailAddr (const char *addr)
 >  }


However, immediately above this code, there's another reference to
'outfp' which is unprotected....

               else
                 {
                   read_server (outfp);
                 }

I suggest that you put some checks for NULL around this too.

The only other comment I have is that there's a small typo in the docs:

 > -the database. A zero exit code is returned if the submission was
 > -successful.  Otherwise, the reason(s) for the PR being rejected are
 > -printed to stdout, and a non-zero exit code is returned.
 > +the database.  If the submission a zero exit code is returned.
                                  ^^^^^^
I think you're missing 'is successful' in the above sentence.

 > Otherwise, the
 > +reason(s) for the PR being rejected are
 > +printed, and a non-zero exit code is returned.
 > +
 > +@item --show-prnum


> 
> Since this change is an enhancement and modifies the gnatsd command
> protocol I am thinking it should not be included in GNATS 4.0 final,
> but put on a 4.1 branch. What do people think?

I'm in favour of rolling out 4.0 pretty soon....if you think putting
this patch on a 4.1 branch would help this endevour, I'd suggest
you do just that.

--
Mel Hatzis



_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2003-02-03 20:46         ` Mel Hatzis
@ 2003-02-03 20:51           ` Yngve Svendsen
  2003-02-03 21:17             ` Mel Hatzis
  2003-02-09  7:48           ` Andrew J. Gray
  1 sibling, 1 reply; 22+ messages in thread
From: Yngve Svendsen @ 2003-02-03 20:51 UTC (permalink / raw)
  To: hatzis, Andrew J. Gray; +Cc: help-gnats

At 12:42 03.02.2003 -0800, Mel Hatzis wrote:
>I'm in favour of rolling out 4.0 pretty soon....if you think putting
>this patch on a 4.1 branch would help this endevour, I'd suggest
>you do just that.

I agree strongly. I have a few small but potentially high-risk changes for 
Gnatsweb queued up that I don't want to apply to 4.0, so I'd like version 
4.0 of both GNATS and Gnatsweb to be out of the door before I branch for 
version 4.1 of Gnatsweb.

Yngve Svendsen
Gnatsweb maintainer 



_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2003-02-03 20:51           ` Yngve Svendsen
@ 2003-02-03 21:17             ` Mel Hatzis
  2003-02-03 22:10               ` Yngve Svendsen
  2003-02-09  8:28               ` Andrew J. Gray
  0 siblings, 2 replies; 22+ messages in thread
From: Mel Hatzis @ 2003-02-03 21:17 UTC (permalink / raw)
  To: Yngve Svendsen; +Cc: help-gnats, Andrew J. Gray

On 02/03/2003 12:49 PM, Yngve Svendsen wrote:
> At 12:42 03.02.2003 -0800, Mel Hatzis wrote:
> 
>> I'm in favour of rolling out 4.0 pretty soon....if you think putting
>> this patch on a 4.1 branch would help this endevour, I'd suggest
>> you do just that.
> 
> 
> I agree strongly. I have a few small but potentially high-risk changes 
> for Gnatsweb queued up that I don't want to apply to 4.0, so I'd like 
> version 4.0 of both GNATS and Gnatsweb to be out of the door before I 
> branch for version 4.1 of Gnatsweb.
> 
> Yngve Svendsen
> Gnatsweb maintainer

While we're on the topic of a 4.1 branch, I'd like to know if there's
any interest in supporting alternative backend datastores for Gnats.

I've been working on this for a couple of months now, and have made
some progress....the work has involved creating a datastore API
based on the current 'flat-file' code, moving the index into the
flat-file datastore and some configure related modifications to
support building Gnats against different datastore options. I've
also added an option to run Gnats in long-running-daemon mode,
to support things like database connection pools.

If there's interest, I'll submit the changes I have thus far for
review, and perhaps they can be rolled into the 4.1 development
effort. I've done a great deal of testing of the 'flat-file'
datastore implementation, based entirely on the existing Gnats code,
and it holds up well.

--
Mel Hatzis



_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2003-02-03 21:17             ` Mel Hatzis
@ 2003-02-03 22:10               ` Yngve Svendsen
  2003-02-09  8:28               ` Andrew J. Gray
  1 sibling, 0 replies; 22+ messages in thread
From: Yngve Svendsen @ 2003-02-03 22:10 UTC (permalink / raw)
  To: hatzis; +Cc: help-gnats, Andrew J. Gray

At 13:14 03.02.2003 -0800, Mel Hatzis wrote:
>While we're on the topic of a 4.1 branch, I'd like to know if there's
>any interest in supporting alternative backend datastores for Gnats.
>
>I've been working on this for a couple of months now, and have made
>some progress....the work has involved creating a datastore API
>based on the current 'flat-file' code, moving the index into the
>flat-file datastore and some configure related modifications to
>support building Gnats against different datastore options. I've
>also added an option to run Gnats in long-running-daemon mode,
>to support things like database connection pools.
>
>If there's interest, I'll submit the changes I have thus far for
>review, and perhaps they can be rolled into the 4.1 development
>effort. I've done a great deal of testing of the 'flat-file'
>datastore implementation, based entirely on the existing Gnats code,
>and it holds up well.

Yes, yes, yes! The ability to use alternative datastores would be an 
extremely welcome new feature. There was some talk about it about a year 
and a half ago, but the whole thing died quietly.

- Yngve 



_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2003-02-03 20:46         ` Mel Hatzis
  2003-02-03 20:51           ` Yngve Svendsen
@ 2003-02-09  7:48           ` Andrew J. Gray
  2003-04-29 20:24             ` Yngve Svendsen
  1 sibling, 1 reply; 22+ messages in thread
From: Andrew J. Gray @ 2003-02-09  7:48 UTC (permalink / raw)
  To: hatzis; +Cc: help-gnats

Thanks for your comments on my modifications.

> One small concern with the patch though...in get_reply you've made
> a change allowing for outfp to be NULL...

Actually, outfp was already allowed to be NULL in some cases,
get_reply is called passing NULL for outfp in a number of places in
client.c.  It appears that the client code avoids referencing outfp
when it is NULL by relying on the server code to send the expected
responses.

> However, immediately above this code, there's another reference to
> 'outfp' which is unprotected....
> 
>                else
>                  {
>                    read_server (outfp);
>                  }
> 
> I suggest that you put some checks for NULL around this too.

Thanks, that is a good idea.

>  > -the database. A zero exit code is returned if the submission was
>  > -successful.  Otherwise, the reason(s) for the PR being rejected are
>  > -printed to stdout, and a non-zero exit code is returned.
>  > +the database.  If the submission a zero exit code is returned.
>                                   ^^^^^^
> I think you're missing 'is successful' in the above sentence.

Yes, thanks for picking up that error.

A new patch with changes to fix these issues is at the end of this
message.

> > Since this change is an enhancement and modifies the gnatsd command
> > protocol I am thinking it should not be included in GNATS 4.0 final,
> > but put on a 4.1 branch. What do people think?
> 
> I'm in favour of rolling out 4.0 pretty soon....if you think putting
> this patch on a 4.1 branch would help this endevour, I'd suggest
> you do just that.

OK, I will hold this patch for when we create a 4.1 branch.

-- 
Andrew J. Gray

Index: doc/gnats.texi
===================================================================
RCS file: /cvsroot/gnats/gnats/doc/gnats.texi,v
retrieving revision 1.40
diff -u -p -r1.40 gnats.texi
--- doc/gnats.texi	25 Nov 2002 08:48:44 -0000	1.40
+++ doc/gnats.texi	9 Feb 2003 02:42:51 -0000
@@ -1386,8 +1386,9 @@ lock is cleared.
 @code{211 (CODE_SEND_PR)}
 @*The client should now transmit the new PR text using the normal
 quoting mechanism.  After the PR has been sent, the server will respond
-with either a @code{200 (CODE_OK)} response indicating that the new PR
-has been created (and mail sent to the appropriate persons), or one or
+with either @code{351 (CODE_INFORMATION_FILLER)} and
+@code{350 (CODE_INFORMATION)} responses indicating that the new PR
+has been created and supplying the number assigned to it, or one or
 more error codes listing problems with the new PR text.
 
 @item CHDB @var{database}
Index: doc/p-admin.texi
===================================================================
RCS file: /cvsroot/gnats/gnats/doc/p-admin.texi,v
retrieving revision 1.34
diff -u -p -r1.34 p-admin.texi
--- doc/p-admin.texi	27 Nov 2002 22:04:38 -0000	1.34
+++ doc/p-admin.texi	9 Feb 2003 02:43:06 -0000
@@ -2083,7 +2083,7 @@ The usage for @code{pr-edit} is:
 @smallexample
 pr-edit   [ -l @var{username} | --lock=@var{username} ] [ -u | --unlockdb ]
           [ -L | --lockdb ] [ -U | --unlockdb ] [ -c | --check ]
-          [ -C | --check-initial ] [ -s | --submit ]
+          [ -C | --check-initial ] [ -s | --submit [ --show-prnum ] ]
           [ -a @var{field} | --append field=@var{field} ]
           [ -r @var{field} | --replace=@var{field} ] [ --delete-pr ]
           [ -R @var{reason} | --reason=@var{reason} ]
@@ -2147,9 +2147,13 @@ rather than proposed edits of existing P
 @itemx --submit
 Used to submit a new PR to the database.  The PR is read in and verified
 for content; if the PR is valid as an initial PR, it is then added to
-the database. A zero exit code is returned if the submission was
-successful.  Otherwise, the reason(s) for the PR being rejected are
-printed to stdout, and a non-zero exit code is returned.
+the database.  If the submission is successful a zero exit code is
+returned.  Otherwise, the reason(s) for the PR being rejected are
+printed, and a non-zero exit code is returned.
+
+@item --show-prnum
+This option is used with the @code{--submit} option to display the PR
+number associated with the submitted PR.
 @end table
 
 @noindent The following options require a PR number to be given.
Index: gnats/client.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/client.c,v
retrieving revision 1.46
diff -u -p -r1.46 client.c
--- gnats/client.c	25 Nov 2002 13:58:33 -0000	1.46
+++ gnats/client.c	9 Feb 2003 02:43:11 -0000
@@ -329,12 +329,20 @@ get_reply (FILE *outfp)
 		}
 	      else
 		{
-		  read_server (outfp);
+		  if (outfp != NULL)
+		    read_server (outfp);
+		  else
+		    {
+		      fprintf (stderr, "%s: unexpected %d received\n",
+			       program_name, r->state);
+		      safe_exit();
+		    }
 		}
 	      break;
 
 	    case CODE_INFORMATION:
-	      fprintf (outfp, "%s\n", r->text);
+	      if (outfp != NULL)
+		fprintf (outfp, "%s\n", r->text);
 	      break;
 
 	    case CODE_NONEXISTENT_PR:
@@ -1216,7 +1224,7 @@ netSetEditEmailAddr (const char *addr)
 }
 
 static void
-netSendPRCmd (const char *cmd, FILE *file)
+netSendPRCmd (const char *cmd, FILE *file, int show_information)
 {
   char *line;
   if (debug)
@@ -1233,13 +1241,13 @@ netSendPRCmd (const char *cmd, FILE *fil
     }
   fprintf (serv_write, ".\r\n");
   /* if get_reply finds errors it writes messages and doesn't return */
-  get_reply (stdout);
+  get_reply (show_information ? stdout : NULL);
 }
 
 void
 netCheckPR (FILE *file, int initial)
 {
-  netSendPRCmd (initial ? "CHEK INIT" : "CHEK", file);
+  netSendPRCmd (initial ? "CHEK INIT" : "CHEK", file, 1);
 }
 
 void
@@ -1298,9 +1306,9 @@ netEditField (FILE *fp, const char *prnu
 }
 
 void
-netSubmitNewPR (FILE *file)
+netSubmitNewPR (FILE *file, int show_prnum)
 {
-  netSendPRCmd ("SUBM", file);
+  netSendPRCmd ("SUBM", file, show_prnum);
 }
 
 void
@@ -1310,7 +1318,7 @@ netModifyPR (FILE *file, const char *prN
 
   netSetEditEmailAddr (editEmailAddr);
   asprintf (&buf, "EDIT %s", prNum);
-  netSendPRCmd (buf, file);
+  netSendPRCmd (buf, file, 1);
   free (buf);
 }
 
Index: gnats/cmds.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/cmds.c,v
retrieving revision 1.70
diff -u -p -r1.70 cmds.c
--- gnats/cmds.c	14 Oct 2002 11:42:25 -0000	1.70
+++ gnats/cmds.c	9 Feb 2003 02:43:17 -0000
@@ -478,6 +478,7 @@ GNATS_subm (int ac, char **av ATTRIBUTE_
   char *tempfile;
   FILE *fp;
   ErrorDesc err;
+  int new_pr_num;
 
   if (ac != 0)
     {
@@ -507,9 +508,11 @@ GNATS_subm (int ac, char **av ATTRIBUTE_
     {
       if (daemon_lock_gnats (FALSE) == 0)
 	{
-	  if (submit_pr (currentDatabase, fp, &err) != 0)
+	  if ((new_pr_num = submit_pr (currentDatabase, fp, &err)) != 0)
 	    {
-	      printf ("%d PR added.\r\n", CODE_OK);
+	      printf ("%d-The added PR number is:\r\n",
+		      CODE_INFORMATION_FILLER);
+	      printf ("%d %d\r\n", CODE_INFORMATION, new_pr_num);
 	      fflush (stdout);
 	    }
 	  else
Index: gnats/file-pr.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/file-pr.c,v
retrieving revision 1.51
diff -u -p -r1.51 file-pr.c
--- gnats/file-pr.c	1 Nov 2002 11:37:51 -0000	1.51
+++ gnats/file-pr.c	9 Feb 2003 02:43:21 -0000
@@ -930,11 +930,13 @@ getBugNumber (const DatabaseInfo databas
   return bug_number;
 }
 
-/* Submit the PR whose contents are referred to by FP.  */
+/* Submit the PR whose contents are referred to by FP.
+ * Return the new PR number if it's a new PR, or return the PR number of
+ * the PR which was appended to if it's an existing PR. */
 int
 submit_pr (const DatabaseInfo database, FILE *fp, ErrorDesc *err)
 {
-  int result;
+  int result, retval;
   PR *pr = allocPR (database);
 
   result = (read_header (pr, fp) >= 0);
@@ -956,10 +958,8 @@ submit_pr (const DatabaseInfo database, 
 	    }
 	  else
 	    {
-	      if (append_report (fp, pr, prID, err) != 0)
-		{
-		  result = 0;
-		}
+	      retval = append_report (fp, pr, prID, err);
+	      result = (retval == 0) ? atoi (prID) : 0;
 	      free_pr (pr);
 	    }
 	  free (prID);
@@ -967,10 +967,8 @@ submit_pr (const DatabaseInfo database, 
       else
 	{
 	  read_pr (pr, fp, 0);
-	  if (createNewPRFile (pr, createCategoryDirs (database), err) < 0)
-	    {
-	      result = 0;
-	    }
+	  retval = createNewPRFile (pr, createCategoryDirs (database), err);
+	  result = (retval < 0) ? 0 : retval;
 	}
     }
   else
Index: gnats/gnats.h
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/gnats.h,v
retrieving revision 1.52
diff -u -p -r1.52 gnats.h
--- gnats/gnats.h	31 Oct 2002 23:43:28 -0000	1.52
+++ gnats/gnats.h	9 Feb 2003 02:43:22 -0000
@@ -292,7 +292,7 @@ extern void netEditField (FILE *fieldDat
 			  const char *editUserEmailAddr, int appendToField,
 			  char *reason);
 
-extern void netSubmitNewPR (FILE *file);
+extern void netSubmitNewPR (FILE *file, int show_prnum);
 extern void netModifyPR (FILE *file, const char *prNum,
 			 const char *editUserEmailAddr);
 extern void netLockDB (void);
Index: gnats/pr-edit.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/pr-edit.c,v
retrieving revision 1.37
diff -u -p -r1.37 pr-edit.c
--- gnats/pr-edit.c	1 Nov 2002 09:02:23 -0000	1.37
+++ gnats/pr-edit.c	9 Feb 2003 02:43:25 -0000
@@ -43,6 +43,7 @@ enum {
 } edit_options;
 
 #define DELETE_PR_OPT 256
+#define SHOW_PRNUM_OPT 257
 
 struct option long_options[] =
 {
@@ -61,6 +62,7 @@ struct option long_options[] =
   {"filename", 1, NULL, 'f'},
   {"version", 0, NULL, 'V'},
   {"delete-pr", 0, NULL, DELETE_PR_OPT},
+  {"show-prnum", 0, NULL, SHOW_PRNUM_OPT},
   {"help", 0, NULL, 'h'},
   {"user", 1, NULL, 'v'},
   {"passwd", 1, NULL, 'w'},
@@ -83,9 +85,10 @@ Modify database.\n\
   -L --lockdb              lock the whole database\n\
   -U --unlockdb            unlock the database\n\
   -c --check               check input for editting, don't change PR\n\
-  -C --check-initial       check input for submition, don't submit new PR\n\
+  -C --check-initial       check input for submission, don't submit new PR\n\
   -s --submit              submit new PR\n",
   "\
+     --show-prnum          display the newly created PR number (for --submit)\n\
   -a --append=FIELDNAME    append input to FIELDNAME\n\
   -r --replace=FIELDNAME   replace FIELDNAME with input\n\
      --delete-pr           delete PR from the database completely\n\
@@ -145,7 +148,7 @@ read_file (FILE *inp)
 static void
 handleNetworkEdit (int edit_options, FILE *fpin, char *prnum, char *username,
 		   char *editEmailAddr, char *processid, char *fieldname,
-		   char *reason)
+		   char *reason, int show_prnum)
 {
   int exitcode = 0;
 
@@ -165,7 +168,7 @@ handleNetworkEdit (int edit_options, FIL
       break;
     case SUBMIT:
       {
-	netSubmitNewPR (fpin);
+	netSubmitNewPR (fpin, show_prnum);
 	break;
       }
     case CHECK:
@@ -216,6 +219,7 @@ main (int argc, char **argv)
   int networkmode = 0;
   char *editUserEmailAddr = NULL;
   char *reason = NULL;
+  int show_prnum = 0;
 
   program_name = basename (argv[0]);
   edit_options = MODIFY;
@@ -233,6 +237,10 @@ main (int argc, char **argv)
 	  debug = 1;
 	  break;
 
+	case SHOW_PRNUM_OPT:
+	  show_prnum = 1;
+	  break;
+
 	case 'f':
 	  fp = fopen (optarg, "r");
 	  /* If they gave a bogus argument, then exit right away; we don't
@@ -398,7 +406,7 @@ main (int argc, char **argv)
 	  exit (3);
 	}
       handleNetworkEdit (edit_options, fp, prnum, username, editUserEmailAddr,
-			 processid, fieldname, reason);
+			 processid, fieldname, reason, show_prnum);
     }
 
   database = init_gnats (program_name, nameOfDatabase, &err);
@@ -467,6 +475,10 @@ main (int argc, char **argv)
 	case SUBMIT:
 	  {
 	    result = submit_pr (database, fp, &err);
+            if (show_prnum && result)
+              {
+                fprintf (stdout, "%d\n", result);
+              }
 	    break;
 	  }
 	case APPEND:
Index: send-pr/send-pr.sh
===================================================================
RCS file: /cvsroot/gnats/gnats/send-pr/send-pr.sh,v
retrieving revision 1.23
diff -u -p -r1.23 send-pr.sh
--- send-pr/send-pr.sh	29 Oct 2002 09:58:15 -0000	1.23
+++ send-pr/send-pr.sh	9 Feb 2003 02:43:28 -0000
@@ -536,8 +536,8 @@ do
     echo "$COMMAND: problem report mailed"
     xs=0; exit
   else
-    if $LIBEXECDIR/pr-edit --submit < $REF; then
-      echo "$COMMAND: problem report filed"
+    if pr_num=`$LIBEXECDIR/pr-edit --submit --show-prnum < $REF` ; then
+      echo "$COMMAND: problem report $pr_num filed"
       xs=0; exit
     else
       echo "$COMMAND: the problem report is not sent."


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2003-02-03 21:17             ` Mel Hatzis
  2003-02-03 22:10               ` Yngve Svendsen
@ 2003-02-09  8:28               ` Andrew J. Gray
  1 sibling, 0 replies; 22+ messages in thread
From: Andrew J. Gray @ 2003-02-09  8:28 UTC (permalink / raw)
  To: hatzis; +Cc: help-gnats, yngve.svendsen

> While we're on the topic of a 4.1 branch, I'd like to know if there's
> any interest in supporting alternative backend datastores for Gnats.

From Yngve's response and looking at the discussions on help-gnats in
May and June 2001 clearly there is some interest in this.  I must
admit the benefits of alternative datastores are not clear to me, if
you could spell them out for me that would be useful.

> If there's interest, I'll submit the changes I have thus far for
> review, and perhaps they can be rolled into the 4.1 development
> effort. I've done a great deal of testing of the 'flat-file'

Once 4.0 is released I would like to have a look at your changes,
until then I will be focusing on bug reports and getting 4.0 ready.

-- 
Andrew J. Gray


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2003-02-09  7:48           ` Andrew J. Gray
@ 2003-04-29 20:24             ` Yngve Svendsen
  0 siblings, 0 replies; 22+ messages in thread
From: Yngve Svendsen @ 2003-04-29 20:24 UTC (permalink / raw)
  To: Andrew J. Gray, hatzis; +Cc: help-gnats

At 17:49 09.02.2003 +1100, Andrew J. Gray wrote:
>OK, I will hold this patch for when we create a 4.1 branch.

I would like to suggest that we branch for a 4.0 release now. I think 
quality is good enough for a 4.0 release, and any remaining changes to 4.0 
should be only very minor bugfixes that should merge easily into the head 
branch.

- Yngve 



_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: patch to display new PR number for new submissions
  2002-12-03 19:52 ` patch to display new PR number for new submissions Mel Hatzis
  2002-12-04  3:02   ` Andrew J. Gray
  2002-12-08  7:58   ` Andrew J. Gray
@ 2003-08-30 11:58   ` Andrew J. Gray
  2 siblings, 0 replies; 22+ messages in thread
From: Andrew J. Gray @ 2003-08-30 11:58 UTC (permalink / raw)
  To: hatzis; +Cc: help-gnats

Hi Mel,

> Now that 4.0 beta2 is out the door please review
> (and hopefully accept) the following patch which
> allows send-pr and "pr-edit --submit" to display
> newly created PR numbers.
> 
> The patch basically provides an optional '--show-prnum'
> sub-option to 'pr-edit --submit' which tells
> pr-edit to display the PR number associated with
> the submitted PR.

I have committed your patch along with my modifications to it.

-- 
Andrew J. Gray
GNU GNATS Maintainer


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2003-08-30  8:09 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-02 15:08 GNU GNATS 4.0 beta2 released Andrew J. Gray
2002-12-02 15:11 ` compiling gnats 4.0 beta 2 Steve Friedman
2002-12-04  2:36   ` Andrew J. Gray
2002-12-03 19:52 ` patch to display new PR number for new submissions Mel Hatzis
2002-12-04  3:02   ` Andrew J. Gray
2002-12-08  7:58   ` Andrew J. Gray
2002-12-08 12:27     ` Yngve Svendsen
2002-12-08 23:11       ` Patching the manual Lars Henriksen
2002-12-12  3:58         ` Yngve Svendsen
2002-12-12  6:29       ` patch to display new PR number for new submissions Andrew J. Gray
2002-12-08 23:11     ` Mel Hatzis
2003-02-02  9:32       ` Andrew J. Gray
2003-02-03 20:46         ` Mel Hatzis
2003-02-03 20:51           ` Yngve Svendsen
2003-02-03 21:17             ` Mel Hatzis
2003-02-03 22:10               ` Yngve Svendsen
2003-02-09  8:28               ` Andrew J. Gray
2003-02-09  7:48           ` Andrew J. Gray
2003-04-29 20:24             ` Yngve Svendsen
2002-12-09 10:54     ` dirk bergstrom
2002-12-14 14:26       ` Andrew J. Gray
2003-08-30 11:58   ` Andrew J. Gray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).