Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions test-framework/sudo-compliance-tests/src/sudo/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,21 @@ fn rootpw_takes_priority_over_targetpw() {
.output(&env);
assert!(!output.status().success());
}

#[cfg(target_os = "linux")]
#[test]
fn tish_you_spoke_french() {
let env = Env("")
.file("/tmp/install-po.sh", include_str!("misc/install-po.sh"))
.build();

let _ = Command::new("sh").arg("/tmp/install-po.sh").output(&env);

let output = Command::new("env")
.arg("LANG=fy_NL.utf8")
.args(["sudo", "true"])
.output(&env);

output.assert_exit_code(1);
assert_contains!(output.stderr(), "twadde weach");
}
17 changes: 17 additions & 0 deletions test-framework/sudo-compliance-tests/src/sudo/misc/install-po.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /bin/sh

mkdir -p /usr/share/locale/fy/LC_MESSAGES/

msgfmt - -o /usr/share/locale/fy/LC_MESSAGES/sudoers.mo <<EOF
msgid "%s is not in the sudoers file.\n"
msgstr "%s waard wegere troch de twadde weach.\n"
EOF

msgfmt - -o /usr/share/locale/fy/LC_MESSAGES/sudo-rs.mo <<EOF
msgid "I'm sorry {user}. I'm afraid I can't do that"
msgstr "{user} waard wegere troch de twadde weach."
EOF

# uncomment the frisian line
sed -ibak '/fy_NL/s/^# *//' /etc/locale.gen
locale-gen
2 changes: 1 addition & 1 deletion test-framework/sudo-test/src/ours.linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM rust:1-slim-trixie
RUN apt-get update && \
apt-get install -y --no-install-recommends apparmor libpam0g-dev libapparmor1 procps sshpass rsyslog ca-certificates tzdata
apt-get install -y --no-install-recommends apparmor libpam0g-dev libapparmor1 procps sshpass rsyslog ca-certificates tzdata locales gettext
# cache the crates.io index in the image for faster local testing
RUN cargo search sudo
WORKDIR /usr/src/sudo
Expand Down
2 changes: 1 addition & 1 deletion test-framework/sudo-test/src/theirs.linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM debian:trixie-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends sudo procps sshpass rsyslog && \
apt-get install -y --no-install-recommends sudo procps sshpass rsyslog locales gettext && \
rm /etc/sudoers
# Ensure we use the same shell across OSes
RUN chsh -s /bin/sh
Expand Down