STINNER Victor <victor.stin...@haypocalc.com> added the comment:

Current code of execve() has a bug: it uses the length of the environment 
variable value in *characters* and not in *bytes* to allocate the "p" buffer. I 
remember that someone wrote a comment somewhere about that... The result is 
that the environment variable value is truncated by 1 byte.

Example (copy of http://dpaste.com/184803/):
-----------
$ cat test.py
#!/usr/bin/python
# -*- coding: utf-8 -*-

import os

env = {"VAR": "ćd"}
os.execve("test.sh", [], env)
$ cat test.sh
#!/bin/bash

declare -p VAR
$ python2.6 test.py
declare -x VAR="ćd"
$ python3.1 test.py
declare -x VAR="ć"
-----------

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8391>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to