Compilation of trunk fails

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Compilation of trunk fails

Jon Watte-2
Is "make check" something that's not used anymore?
I just checked out trunk and built it (C++) on Ubuntu 9.04, after
adding the necessary pre-requisites.
However, the "make check" step first fails with compilation errors
(several warnings about ignoring return values).
Then running it fails 6 out of 13 tests.

Here is a patch to make "make check" not fail with compilation errors
(warnings are errors). I don't know if fprintf() is the appropriate
way to return these error cases, but there you have it.
The diff is taken from within trunk/qpid/cpp

Sincerely,

jw


--
Americans might object: there is no way we would sacrifice our living
standards for the benefit of people in the rest of the world.
Nevertheless, whether we get there willingly or not, we shall soon
have lower consumption rates, because our present rates are
unsustainable.


Index: src/tests/qrsh_server.cpp
===================================================================
--- src/tests/qrsh_server.cpp (revision 900278)
+++ src/tests/qrsh_server.cpp (working copy)
@@ -486,9 +486,15 @@
             FILE * fp;
             if ( (fp = fopen ( pid_file_name.str().c_str(), "r" ) ) )
             {
-                fscanf ( fp, "%d", & pid );
+                if (fscanf ( fp, "%d", & pid ) < 1)
+                {
+                    fprintf(stderr, "warning: %s is empty\n",
pid_file_name.str().c_str());
+                }
+                else
+                {
+                    abstract_name_map.insert(pair<char*,
int>(strdup(file->d_name), pid));
+                }
                 fclose ( fp );
-                abstract_name_map.insert(pair<char*,
int>(strdup(file->d_name), pid));
             }
             else
             {
@@ -587,7 +593,12 @@
     char const * truncated_command = skipWord(skipWord(command.c_str()));

     if ( truncated_command )
-        system ( truncated_command );
+    {
+        if (system ( truncated_command ) < 0)
+        {
+            fprintf(stderr, "Error: system(%s) failed\n", truncated_command);
+        }
+    }
 }


Index: src/tests/qrsh_run.cpp
===================================================================
--- src/tests/qrsh_run.cpp (revision 900278)
+++ src/tests/qrsh_run.cpp (working copy)
@@ -45,7 +45,11 @@
     int  my_pid = getpid();
     int  child_pid;

-    pipe(fd);
+    if (pipe(fd) < 0)
+    {
+        fprintf(stderr, "Error: pipe() failed. Cannot continue.\n");
+        exit(1);
+    }

     char const * root_dir   = argv[1]; // This arg is prepended by qrsh_server.
     char const * child_name = argv[2]; // This arg comes from qrsh.
@@ -125,7 +129,11 @@
       }
       char symbolic_name[1000];
       strcpy ( symbolic_name, "qrsh_no_name" );
-      fscanf ( fp, "%s", symbolic_name );
+      if (fscanf ( fp, "%s", symbolic_name ) < 1)
+      {
+          fprintf(stderr, "Error: could not read symbolic name.\n");
+          exit(1);
+      }
       fclose ( fp );

       // Make the name of the child's exit code file.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Compilation of trunk fails

Gordon Sim
On 01/18/2010 05:37 AM, Jon Watte wrote:

> Is "make check" something that's not used anymore?
> I just checked out trunk and built it (C++) on Ubuntu 9.04, after
> adding the necessary pre-requisites.
> However, the "make check" step first fails with compilation errors
> (several warnings about ignoring return values).
> Then running it fails 6 out of 13 tests.
>
> Here is a patch to make "make check" not fail with compilation errors
> (warnings are errors). I don't know if fprintf() is the appropriate
> way to return these error cases, but there you have it.
> The diff is taken from within trunk/qpid/cpp


We can only apply patches if they are granted to the ASF. The simple way
to do this is to attach it to a Jira and choose "Grant license to ASF
for inclusion in ASF works (as per the Apache License ยง5)".

I have created a Jira for this issue:
https://issues.apache.org/jira/browse/QPID-2342. If you can attach the
patch there that would be greatly appreciated!

>
> Sincerely,
>
> jw
>
>
> --
> Americans might object: there is no way we would sacrifice our living
> standards for the benefit of people in the rest of the world.
> Nevertheless, whether we get there willingly or not, we shall soon
> have lower consumption rates, because our present rates are
> unsustainable.
>
>
> Index: src/tests/qrsh_server.cpp
> ===================================================================
> --- src/tests/qrsh_server.cpp (revision 900278)
> +++ src/tests/qrsh_server.cpp (working copy)
> @@ -486,9 +486,15 @@
>               FILE * fp;
>               if ( (fp = fopen ( pid_file_name.str().c_str(), "r" ) ) )
>               {
> -                fscanf ( fp, "%d",&  pid );
> +                if (fscanf ( fp, "%d",&  pid )<  1)
> +                {
> +                    fprintf(stderr, "warning: %s is empty\n",
> pid_file_name.str().c_str());
> +                }
> +                else
> +                {
> +                    abstract_name_map.insert(pair<char*,
> int>(strdup(file->d_name), pid));
> +                }
>                   fclose ( fp );
> -                abstract_name_map.insert(pair<char*,
> int>(strdup(file->d_name), pid));
>               }
>               else
>               {
> @@ -587,7 +593,12 @@
>       char const * truncated_command = skipWord(skipWord(command.c_str()));
>
>       if ( truncated_command )
> -        system ( truncated_command );
> +    {
> +        if (system ( truncated_command )<  0)
> +        {
> +            fprintf(stderr, "Error: system(%s) failed\n", truncated_command);
> +        }
> +    }
>   }
>
>
> Index: src/tests/qrsh_run.cpp
> ===================================================================
> --- src/tests/qrsh_run.cpp (revision 900278)
> +++ src/tests/qrsh_run.cpp (working copy)
> @@ -45,7 +45,11 @@
>       int  my_pid = getpid();
>       int  child_pid;
>
> -    pipe(fd);
> +    if (pipe(fd)<  0)
> +    {
> +        fprintf(stderr, "Error: pipe() failed. Cannot continue.\n");
> +        exit(1);
> +    }
>
>       char const * root_dir   = argv[1]; // This arg is prepended by qrsh_server.
>       char const * child_name = argv[2]; // This arg comes from qrsh.
> @@ -125,7 +129,11 @@
>         }
>         char symbolic_name[1000];
>         strcpy ( symbolic_name, "qrsh_no_name" );
> -      fscanf ( fp, "%s", symbolic_name );
> +      if (fscanf ( fp, "%s", symbolic_name )<  1)
> +      {
> +          fprintf(stderr, "Error: could not read symbolic name.\n");
> +          exit(1);
> +      }
>         fclose ( fp );
>
>         // Make the name of the child's exit code file.
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:[hidden email]
>


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Compilation of trunk fails

Jon Watte-2
On Mon, Jan 18, 2010 at 2:52 AM, Gordon Sim <[hidden email]> wrote:

> I have created a Jira for this issue:
> https://issues.apache.org/jira/browse/QPID-2342. If you can attach the
> patch there that would be greatly appreciated!
>


Done.

Sincerely,

jw


--
Americans might object: there is no way we would sacrifice our living
standards for the benefit of people in the rest of the world. Nevertheless,
whether we get there willingly or not, we shall soon have lower consumption
rates, because our present rates are unsustainable.