Hi,
Recently, I pushed a PR to use uu_ln in Nushell which had to be reverted because tests didnt pass on macos. You can see a description of what we found.
MRE
cargo new mre --vcs=none
cd mre
Important: make sure to set your cargo_home to a tmp or
any non default directory, otherwise it might use your cached artifactss
export CARGO_HOME=/tmp/.cargo/
Add uucore and fluent and leave ln on purpose out
cargo add uucore uu_cp fluent
You must add a random utility, uu_cp does the job.
Use this as your src/main.rs:
use uucore::translate;
fn main() {
let _ = uucore::localized_help_template("ln");
let msg = translate!("ln-error-missing-destination", "operand" => "foo");
if msg.contains("ln-error-missing-destination") {
eprintln!("Error is is: {msg}. Utility not localized properly");
} else {
eprintln!("Got translation: {msg}");
}
}
Build initially and run it
As expected uu_ln doesnt work because it wasnt added to our deps.
Add uu_ln
Expected: it works
Still not working.
Msg is: ln-error-missing-destination. Utility not localized properly
Now to fix it, we force uucore to rebuild:
Rerun cargo r:
Got translation: missing destination file operand after foo
Im guessing a fix could be either a new re-run-if-env-changed on build.rs, or some sort of hash on registry directory which can be then recalculated to know if something has changed, but im no expert.
Thanks for your great work!
Hi,
Recently, I pushed a PR to use
uu_lnin Nushell which had to be reverted because tests didnt pass onmacos. You can see a description of what we found.MRE
cargo new mre --vcs=none cd mreImportant: make sure to set your cargo_home to a tmp or
any non default directory, otherwise it might use your cached artifactss
export CARGO_HOME=/tmp/.cargo/Add uucore and fluent and leave
lnon purpose outYou must add a random utility,
uu_cpdoes the job.Use this as your
src/main.rs:Build initially and run it
As expected uu_ln doesnt work because it wasnt added to our deps.
Add
uu_lnExpected: it works
Still not working.
Now to fix it, we force uucore to rebuild:
Rerun
cargo r:Im guessing a fix could be either a new
re-run-if-env-changedon build.rs, or some sort of hash on registry directory which can be then recalculated to know if something has changed, but im no expert.Thanks for your great work!