tcdi / plrust

A Rust procedural language handler for PostgreSQL
PostgreSQL License
1.12k stars 32 forks source link

env/option_env failing to be linted by plrustc #393

Open thomcc opened 12 months ago

thomcc commented 12 months ago

Because this is unrelated to https://github.com/tcdi/plrust/issues/387 it deserves it's own issue.

Fixing it outright seems difficult (still not sure how), I think it'd probably be fine to try wiping the env on entry to plrustc when compiling the plrust user crate though. Because it seems specific to the env macro (and not a more general thing) that should be enough.

eeeebbbbrrrr commented 12 months ago

It’s unclear to me what effect wiping the environment would have on Postgres. It can get some settings from the environment but I don’t know if that’s during startup only (I’d hope!) or if it happens during runtime too

thomcc commented 12 months ago

This would just be inside plrustc.

eeeebbbbrrrr commented 12 months ago

oh. well, should plrust clear the env for the cargo Command it spawns? We currently do this, but could do more: https://github.com/tcdi/plrust/blob/87a90823ad9474d6c942b41524136d262ae677b6/plrust/src/user_crate/cargo.rs#L122

thomcc commented 12 months ago

Nah, I think we'd do this inside plrustc itself, to make sure we don't mess something up with cargo.

thomcc commented 12 months ago

This is pretty annoying to do correctly so I think we'll do this slightly incorrectly and hope it doesn't break anything.

workingjubilee commented 12 months ago

On the scale of code crimes we commit, it probably will be far from the top.

thomcc commented 12 months ago

... That is quite true.