Skip to content

Commit

Permalink
dev-script: fix env variable handling #1673
Browse files Browse the repository at this point in the history
- change dockerfiles to hardcode environment variables instead of trying
  to source them from the script
- Fix a typo in setting LANG
  • Loading branch information
marsella committed Jun 13, 2024
1 parent 05392cf commit 36a6f57
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dev/dev_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,11 @@ put_brew_packages_in_path() {
set_ubuntu_language_encoding() {
case $CRYPTOL_PLATFORM in
$UBUNTU20 | $UBUNTU22)
if $LANG!= *"UTF-8"* || $LANG != *"utf-8"*; then
if $LANG != *"UTF-8"* || $LANG != *"utf-8"*; then
notice "Language environment variables are not set as expected."
notice " You may need to set them to UTF-8."
notice " Uncomment the LANG var in $VAR_FILE before sourcing to do so"
echo "# uncomment the following lines to fix decoding errors e.g. hGetContents" >> $VAR_FILE
echo "# uncomment the following line to fix decoding errors e.g. hGetContents" >> $VAR_FILE
echo "# export LANG=C.UTF-8" >> $VAR_FILE
fi;;
*) return;;
Expand Down
9 changes: 5 additions & 4 deletions dev/ubuntu20.04.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
FROM ubuntu:20.04
WORKDIR /home/

ENV LANG="C.UTF-8" LC_ALL="C.UTF-8"

RUN apt-get -y upgrade \
&& apt-get -y update \
&& apt-get install -y \
Expand All @@ -18,5 +16,8 @@ RUN ["git", "clone", "https://github.com/GaloisInc/cryptol.git"]

WORKDIR /home/cryptol
RUN ["dev/dev_setup.sh"]
RUN ["source", "dev/env.sh"]
CMD ["/bin/sh"]

# Hardcode the environment variables we're going to need
ENV LANG="C.UTF-8" LC_ALL="C.UTF-8" PATH=$PATH:/root/.ghcup/bin

CMD ["/bin/bash"]
9 changes: 5 additions & 4 deletions dev/ubuntu22.04.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
FROM ubuntu:22.04
WORKDIR /home/

ENV LANG="C.UTF-8" LC_ALL="C.UTF-8"

RUN apt-get -y upgrade \
&& apt-get -y update \
&& apt-get install -y \
Expand All @@ -18,5 +16,8 @@ RUN ["git", "clone", "https://github.com/GaloisInc/cryptol.git"]

WORKDIR /home/cryptol
RUN ["dev/dev_setup.sh"]
RUN ["source", "dev/env.sh"]
CMD ["/bin/sh"]

# Hardcode the environment variables we're going to need
ENV LANG="C.UTF-8" LC_ALL="C.UTF-8" PATH=$PATH:/root/.ghcup/bin

CMD ["/bin/bash"]

0 comments on commit 36a6f57

Please sign in to comment.