[GHC] #2352: POSIX.1 unsetenv returns int

View: New views
3 Messages — Rating Filter:   Alert me  

[GHC] #2352: POSIX.1 unsetenv returns int

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2352: POSIX.1 unsetenv returns int
-------------------------------+--------------------------------------------
    Reporter:  donn            |       Owner:                
        Type:  bug             |      Status:  new          
    Priority:  normal          |   Component:  libraries/unix
     Version:  6.8.2           |    Severity:  minor        
    Keywords:                  |    Testcase:                
Architecture:  x86_64 (amd64)  |          Os:  NetBSD        
-------------------------------+--------------------------------------------
 While plenty of C libraries declare void unsetenv(), the POSIX.1003.1
 standard is int unsetenv(), with return values 0 or -1.  In the latter
 case, errno is set to EINVAL, for causes including the present of "=" in
 the value.  Of course this is not of earthshaking importance.

 The following is the autoconf test (just a copy of the same test for
 usleep().)

 --- libraries/unix/configure.ac.dist    2008-06-03 10:39:45.000000000
 -0700
 +++ libraries/unix/configure.ac 2008-06-06 21:43:19.000000000 -0700
 @@ -75,6 +75,19 @@
    ;;
  esac

 +###  POSIX.1003.1 unsetenv returns 0 or -1 (EINVAL), but older
 implementations
 +###  in common use return void.
 +AC_CACHE_CHECK([return type of unsetenv], cv_func_unsetenv_return_type,
 +  [AC_EGREP_HEADER(changequote(<, >)<void[      ]+unsetenv>changequote([,
 ]),
 +                   /usr/include/stdlib.h,
 +                   [cv_func_unsetenv_return_type=void],
 +                   [cv_func_unsetenv_return_type=int])])
 +case "$cv_func_unsetenv_return_type" in
 +  "void" )
 +    AC_DEFINE([UNSETENV_RETURNS_VOID], [1], [Define if stdlib.h declares
 unsetenv to return void.])
 +  ;;
 +esac
 +
  dnl ** sometimes RTLD_NEXT is hidden in #ifdefs we really don't wan to
 set
  AC_MSG_CHECKING(for RTLD_NEXT from dlfcn.h)
  AC_EGREP_CPP(yes,

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2352>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2352: POSIX.1 unsetenv returns int

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2352: POSIX.1 unsetenv returns int
----------------------------+-----------------------------------------------
 Reporter:  donn            |          Owner:  igloo        
     Type:  bug             |         Status:  new          
 Priority:  normal          |      Milestone:  6.10.1        
Component:  libraries/unix  |        Version:  6.8.2        
 Severity:  minor           |     Resolution:                
 Keywords:                  |     Difficulty:  Unknown      
 Testcase:                  |   Architecture:  x86_64 (amd64)
       Os:  NetBSD          |  
----------------------------+-----------------------------------------------
Changes (by igloo):

  * owner:  => igloo
  * difficulty:  => Unknown
  * milestone:  => 6.10.1

Old description:

> While plenty of C libraries declare void unsetenv(), the POSIX.1003.1
> standard is int unsetenv(), with return values 0 or -1.  In the latter
> case, errno is set to EINVAL, for causes including the present of "=" in
> the value.  Of course this is not of earthshaking importance.
>
> The following is the autoconf test (just a copy of the same test for
> usleep().)
>
> --- libraries/unix/configure.ac.dist    2008-06-03 10:39:45.000000000
> -0700
> +++ libraries/unix/configure.ac 2008-06-06 21:43:19.000000000 -0700
> @@ -75,6 +75,19 @@
>    ;;
>  esac
>
> +###  POSIX.1003.1 unsetenv returns 0 or -1 (EINVAL), but older
> implementations
> +###  in common use return void.
> +AC_CACHE_CHECK([return type of unsetenv], cv_func_unsetenv_return_type,
> +  [AC_EGREP_HEADER(changequote(<, >)<void[
> ]+unsetenv>changequote([, ]),
> +                   /usr/include/stdlib.h,
> +                   [cv_func_unsetenv_return_type=void],
> +                   [cv_func_unsetenv_return_type=int])])
> +case "$cv_func_unsetenv_return_type" in
> +  "void" )
> +    AC_DEFINE([UNSETENV_RETURNS_VOID], [1], [Define if stdlib.h declares
> unsetenv to return void.])
> +  ;;
> +esac
> +
>  dnl ** sometimes RTLD_NEXT is hidden in #ifdefs we really don't wan to
> set
>  AC_MSG_CHECKING(for RTLD_NEXT from dlfcn.h)
>  AC_EGREP_CPP(yes,
New description:

 While plenty of C libraries declare void unsetenv(), the POSIX.1003.1
 standard is int unsetenv(), with return values 0 or -1.  In the latter
 case, errno is set to EINVAL, for causes including the present of "=" in
 the value.  Of course this is not of earthshaking importance.

 The following is the autoconf test (just a copy of the same test for
 usleep().)
 {{{
 --- libraries/unix/configure.ac.dist    2008-06-03 10:39:45.000000000
 -0700
 +++ libraries/unix/configure.ac 2008-06-06 21:43:19.000000000 -0700
 @@ -75,6 +75,19 @@
    ;;
  esac

 +###  POSIX.1003.1 unsetenv returns 0 or -1 (EINVAL), but older
 implementations
 +###  in common use return void.
 +AC_CACHE_CHECK([return type of unsetenv], cv_func_unsetenv_return_type,
 +  [AC_EGREP_HEADER(changequote(<, >)<void[      ]+unsetenv>changequote([,
 ]),
 +                   /usr/include/stdlib.h,
 +                   [cv_func_unsetenv_return_type=void],
 +                   [cv_func_unsetenv_return_type=int])])
 +case "$cv_func_unsetenv_return_type" in
 +  "void" )
 +    AC_DEFINE([UNSETENV_RETURNS_VOID], [1], [Define if stdlib.h declares
 unsetenv to return void.])
 +  ;;
 +esac
 +
  dnl ** sometimes RTLD_NEXT is hidden in #ifdefs we really don't wan to
 set
  AC_MSG_CHECKING(for RTLD_NEXT from dlfcn.h)
  AC_EGREP_CPP(yes,
 }}}

Comment:

 Thanks for the patch, we'll take a look

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2352#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2352: POSIX.1 unsetenv returns int

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2352: POSIX.1 unsetenv returns int
----------------------------+-----------------------------------------------
 Reporter:  donn            |          Owner:  igloo        
     Type:  bug             |         Status:  closed        
 Priority:  normal          |      Milestone:  6.10.1        
Component:  libraries/unix  |        Version:  6.8.2        
 Severity:  minor           |     Resolution:  fixed        
 Keywords:                  |     Difficulty:  Unknown      
 Testcase:                  |   Architecture:  x86_64 (amd64)
       Os:  NetBSD          |  
----------------------------+-----------------------------------------------
Changes (by igloo):

  * status:  new => closed
  * resolution:  => fixed

Comment:

 http://osdir.com/ml/lib.gnulib.bugs/2004-11/msg00009.html says that it
 returns `void` on NetBSD, and FreeBSD and Redhat 7.3 GNU/Linux, while my
 man page and
 http://www.opengroup.org/onlinepubs/009695399/functions/unsetenv.html
 agree that it should return `int`, so both cases really do exist.

 I've applied the patch.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2352#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs