You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/08/31 17:02:21 UTC

[GitHub] [trafficserver] ywkaras opened a new issue, #9073: Problems with strerror_r().

ywkaras opened a new issue, #9073:
URL: https://github.com/apache/trafficserver/issues/9073

   Not working on Ubuntu:
   ```
   wkaras ~/STRERR
   $ cat x.cc
   #include <string.h>
   
   #include <iostream>
   
   bool
   _success(int retval)
   {
     return retval == 0;
   }
   
   bool
   _success(char *retval)
   {
     return retval != nullptr;
   }
   
   void test(int err_num)
   {
     char buf[256];
     char const *out;
   
     // Handle either GNU or XSI version of strerror_r().
     //
     if (!_success(strerror_r(err_num, buf, 256))) {
       out = "strerror_r() call failed";
     } else {
       buf[255] = '\0';
       out      = buf;
     }
   
     std::cout << "len=" << strlen(out) << '\n';
     std::cout << '"' << out << '"' << '\n';
   }
   
   int main()
   {
     test(1);
     test(98);
   
     return 0;
   }
   wkaras ~/STRERR
   $ gcc -Wall -Wextra -pedantic x.cc -lstdc++
   wkaras ~/STRERR
   $ ./a.out
   len=1
   ""
   len=1
   ""
   wkaras ~/STRERR
   $ gcc --version
   gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
   Copyright (C) 2019 Free Software Foundation, Inc.
   This is free software; see the source for copying conditions.  There is NO
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   
   wkaras ~/STRERR
   $ cat /etc/lsb-release 
   DISTRIB_ID=Ubuntu
   DISTRIB_RELEASE=20.04
   DISTRIB_CODENAME=focal
   DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"
   wkaras ~/STRERR
   $ 
   ```
   Also fails on RHEL 7.9 with GCC 8.3.1.
   
   strerror_r() is used in include/ts/util/Strerror.h .
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ywkaras commented on issue #9073: Problems with strerror_r().

Posted by GitBox <gi...@apache.org>.
ywkaras commented on issue #9073:
URL: https://github.com/apache/trafficserver/issues/9073#issuecomment-1233607973

   One potential fix us to replace strerror_r() with strerror() but protect the call with a mutex.  For that to be effective, we would have to replace all current strerror() use (about 250 calls) with ts::Strerror use.  But, that's something we should do anyway.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ywkaras closed issue #9073: Problems with strerror_r().

Posted by GitBox <gi...@apache.org>.
ywkaras closed issue #9073: Problems with strerror_r().
URL: https://github.com/apache/trafficserver/issues/9073


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] maskit commented on issue #9073: Problems with strerror_r().

Posted by GitBox <gi...@apache.org>.
maskit commented on issue #9073:
URL: https://github.com/apache/trafficserver/issues/9073#issuecomment-1234618382

   > The GNU-specific strerror_r() returns a pointer to a string
          containing the error message.  This may be either a pointer to a
          string that the function stores in buf, or a pointer to some
          (immutable) static string (in which case buf is unused).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ywkaras commented on issue #9073: Problems with strerror_r().

Posted by GitBox <gi...@apache.org>.
ywkaras commented on issue #9073:
URL: https://github.com/apache/trafficserver/issues/9073#issuecomment-1234631139

   Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org