[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19874: 25.0.50; encode-time not working as expected
From: |
Ashish SHUKLA |
Subject: |
bug#19874: 25.0.50; encode-time not working as expected |
Date: |
Fri, 27 Feb 2015 13:58:10 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (amd64-portbld-freebsd10.1) |
On Thu, 26 Feb 2015 22:38:31 -0800, Paul Eggert <eggert@cs.ucla.edu> said:
| Ashish SHUKLA wrote:
|| So, looks like you're right it only happens with X11 (Gtk3) build
| Possibly the Gtk3 code calls 'setenv', and this collides with Emacs's
| implementation of putenv.
| Emacs's putenv implementation should be portable to any POSIX
| platform, but FreeBSD 10.1 getenv+setenv has a bug. The attached
| program should work on any POSIX platform, and it does work on
| GNU/Linux and on Solaris, but it doesn't work on FreeBSD 10.1. Emacs
| has similar code, which apparently also runs afoul of the FreeBSD bug.
In FreeBSD, every call to setenv() results in a rebuilding of "internal
environment" with strdup-ed copies of existing strings in "environ"[1], and
getenv only refers to "environ" iff environ is different than what "internal
environment" points to.
If your test program is modified a bit:
--8<---------------cut here---------------start------------->8---
#include <stdio.h>
#include <stdlib.h>
extern char **environ;
char env1[] = "abc=def";
char *small_environ[] = { env1, 0 };
int
main (void)
{
int i = 0;
environ = small_environ;
for( i = 0; NULL != environ[i]; i++ )
printf( "environment[%d]: %p\n", i, environ[i] );
if (setenv ("mno", "pqr", 0) != 0)
return perror ("setenv"), 1;
for( i = 0; NULL != environ[i]; i++ )
printf( "environment[%d]: %p\n", i, environ[i] );
environ[1][0] = 'x';
if (! getenv ("xbc")) {
printf("environ: %p\nsmall_environ: %p\n", environ, small_environ );
return fprintf (stderr, "getenv failed\n"), 1;
}
return 0;
}
--8<---------------cut here---------------end--------------->8---
then it doesn't fail:
--8<---------------cut here---------------start------------->8---
% /tmp/putenv-test
environment[0]: 0x600de0
environment[0]: 0x801008060
environment[1]: 0x801008058
--8<---------------cut here---------------end--------------->8---
which is definitely incompatible with GNU Emacs, and thus breaks its
expectations.
References:
[1]
http://svnweb.freebsd.org/base/releng/10.1/lib/libc/stdlib/getenv.c?revision=272461&view=markup#l349
HTH
--
Ashish SHUKLA
“echo pkill cat >curiosity ; chmod +x !$; ./curiosity” (abbe, 2010)
Sent from my Emacs
signature.asc
Description: PGP signature
- bug#19874: 25.0.50; encode-time not working as expected, (continued)
- bug#19874: 25.0.50; encode-time not working as expected, Ashish SHUKLA, 2015/02/26
- bug#19874: 25.0.50; encode-time not working as expected, Wolfgang Jenkner, 2015/02/26
- bug#19874: 25.0.50; encode-time not working as expected, Ashish SHUKLA, 2015/02/26
- bug#19874: 25.0.50; encode-time not working as expected, Wolfgang Jenkner, 2015/02/26
- bug#19874: 25.0.50; encode-time not working as expected, Wolfgang Jenkner, 2015/02/26
- bug#19874: 25.0.50; encode-time not working as expected, Ashish SHUKLA, 2015/02/27
- bug#19874: 25.0.50; encode-time not working as expected, Paul Eggert, 2015/02/27
- bug#19874: 25.0.50; encode-time not working as expected, Paul Eggert, 2015/02/27
- bug#19874: 25.0.50; encode-time not working as expected, Ashish SHUKLA, 2015/02/27
bug#19874: 25.0.50; encode-time not working as expected, Paul Eggert, 2015/02/27
bug#19874: 25.0.50; encode-time not working as expected,
Ashish SHUKLA <=
bug#19874: 25.0.50; encode-time not working as expected, Wolfgang Jenkner, 2015/02/27