tailhook / unshare

The low-level linux containers creation library for rust
Apache License 2.0
124 stars 27 forks source link

environment ordering #22

Open joshtriplett opened 3 years ago

joshtriplett commented 3 years ago

I'd like to be able to control the ordering of variables in the environment. Would it be reasonable for the environment hash to become an ordered hash-map, rather than an unordered one?

tailhook commented 3 years ago

Sounds fine. But this is an extra dependency and is rarely needed, so let's make it an optional feature.

Just curious, what is the use case?

joshtriplett commented 3 years ago

@tailhook Some tools print out or otherwise operate on environment variables in the order they appear in the environment, rather than sorting them first. I'd like to ensure reproducibility, and the easiest way to do that would be to always emit the environment in the same order.

It's also an (extremely minor) optimization.