GNU bug report logs -
#19874
25.0.50; encode-time not working as expected
Previous Next
Reported by: ashish.is <at> lostca.se (Ashish SHUKLA)
Date: Sun, 15 Feb 2015 13:42:01 UTC
Severity: normal
Found in version 25.0.50
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #100 received at 19874 <at> debbugs.gnu.org (full text, mbox):
On Sat, Feb 28 2015, Paul Eggert wrote:
> Wolfgang Jenkner wrote:
>> No, I think about the parenthetical remark above: It states `copying the
>> environment strings' and not `copying the pointers to the environment
>> strings'. Normally, in documentation, copying a `string' refers to the
>> object, i.e the region in memory it occupies, not to the pointer
>> designating it.
>
> That interpretation of the rationale is inconsistent with how putenv
> is required to behave. If one uses putenv to add a string to the
> environment, one can later alter the string (via strcpy, say), and
> this changes the environment; this is quite clear from the normative
> text. Under the above interpretation, however, getenv could copy the
> string's contents somewhere else, which would mean that modifying the
> putenv-supplied string would not change the environment.
Sure, if putenv is supported it must be compatible with getenv (as the
standard states) and the interpretation of the rationale in this case
implies that getenv can't copy the strings' content, but setenv may,
IIUC (I'm still just wondering if the test program you posted is
conforming).
> If the rationale were intended to discuss copying the strings'
> contents, then its sentence "copying the environment strings into
> a new array and assigning environ to point to it" would be incorrect,
> as one would not assign environ to point to the new array containing
> the strings' contents, but rather one would assign environ[0],
> environ[1], environ[2], etc. to point within the new array. The
> context of that part of the rationale makes it clear that "assign to
> environ" means "environ = SOMETHING", not "environ[0] = SOMETHING".
Yes, I was simply thinking about something like
q = environ_tmp;
for (p = environ; *p; p++, q++)
*q = strdup(*p);
environ = environ_tmp;
This bug report was last modified 5 years and 118 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.