Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 't/30008/after__30053__sphinx_3_1_2_does_not_build_on_ub…
Browse files Browse the repository at this point in the history
…untu__trusty_xenial_bionic___debian_jessie__centos_7__again_' into t/30576/public/30576
  • Loading branch information
Matthias Koeppe committed Sep 22, 2020
2 parents a8b77cd + ff0dbc6 commit f05a110
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 10 additions & 0 deletions build/bin/sage-system-python
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ fi
# is accessible by this python; this is to guard on Cygwin against Pythons
# installed somewhere else in Windows.

# Trac #30008: Make it work even if the environment tries to sabotage UTF-8
# operation in Python 3.0.x-3.6.x by setting LC_ALL=C or similar.

if [ "$LC_ALL" = "C" -o "$LANG" = "C" -o "$LC_CTYPE" = "C" ]; then
LC_ALL=$(locale -a | grep -E -i '^(c|en_us)[-.]utf-?8$' | head -n 1)
LANG=$LC_ALL
export LC_ALL
export LANG
fi

PYTHONS="python python3 python3.8 python3.7 python2.7 python3.6 python2"
for PY in $PYTHONS; do
PYTHON="$(PATH="$SAGE_ORIG_PATH" command -v $PY)"
Expand Down
9 changes: 7 additions & 2 deletions build/sage_bootstrap/uncompress/tar_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@

class SageBaseTarFile(tarfile.TarFile):
"""
Sage as tarfile.TarFile, but applies a reasonable umask (0022) to the
permissions of all extracted files and directories.
Same as tarfile.TarFile, but applies a reasonable umask (0022) to the
permissions of all extracted files and directories, and fixes
the encoding of file names in the tarball to be 'utf-8' instead of
depending on locale settings.
Previously this applied the user's current umask per the default behavior
of the ``tar`` utility, but this did not provide sufficiently reliable
Expand All @@ -46,6 +48,9 @@ class SageBaseTarFile(tarfile.TarFile):
umask = 0o022

def __init__(self, *args, **kwargs):

kwargs['encoding'] = 'utf-8'

# Unfortunately the only way to get the current umask is to set it
# and then restore it
super(SageBaseTarFile, self).__init__(*args, **kwargs)
Expand Down

0 comments on commit f05a110

Please sign in to comment.