Re: Is _environ present in 7.0-RELEASE ?

2008-08-11 Thread Jeremy Chadwick
On Mon, Aug 11, 2008 at 03:38:04PM +0530, Ashish Shukla wrote:
 Following is the test program I wrote to reproduce the error.
 
 88
 abbe [~] monte-cristo% cat test.c
 extern char ** _environ;
  
 #ifndef NULL
 #define NULL (char**)0
 #endif
  
 int main()
 {
 _environ = NULL;
 }
 abbe [~] monte-cristo% cc -o test test.c
 /var/tmp//ccz3twdu.o(.text+0x7): In function `main':
 : undefined reference to `_environ'
 abbe [~] monte-cristo% sed -e s/_environ/environ/g -i '' test.c
 abbe [~] monte-cristo% cat test.c
 extern char ** environ;
  
 #ifndef NULL
 #define NULL (char**)0
 #endif
  
 int main()
 {
 environ = NULL;
 }
 abbe [~] monte-cristo% cc -o test test.c
 abbe [xine-lib-1.1.14] monte-cristo% cat /etc/make.conf
 CPUTYPE?=nocona
 CFLAGS= -O2 -fno-strict-aliasing -pipe -msse -msse2 -msse3 -mmmx -march=nocona
 MAKEOPTS=-j3
 88
 
 The '__environ' symbol is also not defined. Can anyone hint me, what is 
 misconfigured on my box ?

Something tells me this might interest you.  See the most recent commit:

http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/getenv.c


-- 
| Jeremy Chadwickjdc at parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Is _environ present in 7.0-RELEASE ?

2008-08-11 Thread Ashish Shukla आशीष शुक्ल
Jeremy Chadwick writes:
 On Mon, Aug 11, 2008 at 03:38:04PM +0530, Ashish Shukla wrote:

[snip]

 The '__environ' symbol is also not defined. Can anyone hint me, what is 
 misconfigured on my box ?

 Something tells me this might interest you.  See the most recent commit:

 http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/getenv.c

Sorry, but I'm not able to figure out, what relevant stuff there is
relevant here. I checked out the diff[1] (with the previous commit) and
the recent commit 1.12.2.2[2], but not able to find anything
relevant. Could you please elaborate, what are you trying to say ?

References:
[1] -
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/getenv.c.diff?r1=1.12.2.1;r2=1.12.2.2;f=h
[2] - 
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/getenv.c?rev=1.12.2.2;content-type=text%2Fplain

Thanks
Ashish Shukla
-- 
·-- ·-  ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --


pgpsMIDG6zzds.pgp
Description: PGP signature


Re: Is _environ present in 7.0-RELEASE ?

2008-08-11 Thread Jeremy Chadwick
On Mon, Aug 11, 2008 at 05:49:41PM +0530, Ashish Shukla  
??? wrote:
 Jeremy Chadwick writes:
  On Mon, Aug 11, 2008 at 03:38:04PM +0530, Ashish Shukla wrote:
 
 [snip]
 
  The '__environ' symbol is also not defined. Can anyone hint me, what is 
  misconfigured on my box ?
 
  Something tells me this might interest you.  See the most recent commit:
 
  http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/getenv.c
 
 Sorry, but I'm not able to figure out, what relevant stuff there is
 relevant here. I checked out the diff[1] (with the previous commit) and
 the recent commit 1.12.2.2[2], but not able to find anything
 relevant. Could you please elaborate, what are you trying to say ?

1) The only variable exported to a process from libc is environ,
not __environ or _environ.  Look at src/lib/libc/stdlib/getenv.c for
an example, and confirmation.

2) Your code assigns environ = NULL, which is why I felt the above
commit has relevancy to you.  You should be aware that there are many
different conditions where clearing environ on FreeBSD behaves
differently compared to other OSes; the commit makes it compatible with
pretty much everything.

-- 
| Jeremy Chadwickjdc at parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Is _environ present in 7.0-RELEASE ?

2008-08-11 Thread Ashish Shukla आशीष शुक्ल
Jeremy Chadwick writes:
 On Mon, Aug 11, 2008 at 05:49:41PM +0530, Ashish Shukla  
 ??? wrote:
 Jeremy Chadwick writes:
  On Mon, Aug 11, 2008 at 03:38:04PM +0530, Ashish Shukla wrote:
 
 [snip]
 
  The '__environ' symbol is also not defined. Can anyone hint me, what is 
  misconfigured on my box ?
 
  Something tells me this might interest you.  See the most recent commit:
 
  http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/getenv.c
 
 Sorry, but I'm not able to figure out, what relevant stuff there is
 relevant here. I checked out the diff[1] (with the previous commit) and
 the recent commit 1.12.2.2[2], but not able to find anything
 relevant. Could you please elaborate, what are you trying to say ?

 1) The only variable exported to a process from libc is environ,
 not __environ or _environ.  Look at src/lib/libc/stdlib/getenv.c for
 an example, and confirmation.

Yes, this is what I'm trying to say. But if you saw my libxine's
config.log, there is a check in its configure script for presence of
_environ variable, which is not present in 7.0-RELEASE at least. So,
I'm wondering, why no one else received this error while building
libxine port.

 2) Your code assigns environ = NULL, which is why I felt the above
 commit has relevancy to you.  You should be aware that there are many
 different conditions where clearing environ on FreeBSD behaves
 differently compared to other OSes; the commit makes it compatible with
 pretty much everything.

nop, that is just a simple test case, and my aim of assigning NULL to
force compiler to generate code referencing 'environ' variable.

So, should I file a PR for this ?

Thanks for the reply,

Ashish
-- 
·-- ·-  ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --


pgpTGBiuj0QTi.pgp
Description: PGP signature


Re: Is _environ present in 7.0-RELEASE ?

2008-08-11 Thread Jeremy Chadwick
On Mon, Aug 11, 2008 at 06:43:56PM +0530, Ashish Shukla  
??? wrote:
 Jeremy Chadwick writes:
  On Mon, Aug 11, 2008 at 05:49:41PM +0530, Ashish Shukla  
  ??? wrote:
  Jeremy Chadwick writes:
   On Mon, Aug 11, 2008 at 03:38:04PM +0530, Ashish Shukla wrote:
  
  [snip]
  
   The '__environ' symbol is also not defined. Can anyone hint me, what is 
   misconfigured on my box ?
  
   Something tells me this might interest you.  See the most recent commit:
  
   http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/getenv.c
  
  Sorry, but I'm not able to figure out, what relevant stuff there is
  relevant here. I checked out the diff[1] (with the previous commit) and
  the recent commit 1.12.2.2[2], but not able to find anything
  relevant. Could you please elaborate, what are you trying to say ?
 
  1) The only variable exported to a process from libc is environ,
  not __environ or _environ.  Look at src/lib/libc/stdlib/getenv.c for
  an example, and confirmation.
 
 Yes, this is what I'm trying to say. But if you saw my libxine's
 config.log, there is a check in its configure script for presence of
 _environ variable, which is not present in 7.0-RELEASE at least. So,
 I'm wondering, why no one else received this error while building
 libxine port.
 
  2) Your code assigns environ = NULL, which is why I felt the above
  commit has relevancy to you.  You should be aware that there are many
  different conditions where clearing environ on FreeBSD behaves
  differently compared to other OSes; the commit makes it compatible with
  pretty much everything.
 
 nop, that is just a simple test case, and my aim of assigning NULL to
 force compiler to generate code referencing 'environ' variable.
 
 So, should I file a PR for this ?

To have the port fixed?  Absolutely.  It may be more worthwhile to
discuss the issue upstream with the software maintainers, as the fix
could be implemented in the official source (an #ifdef for FreeBSD
should suffice, and then use a local pointer, e.g. char *my_environ).

-- 
| Jeremy Chadwickjdc at parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to [EMAIL PROTECTED]