-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please consider reducing the number of rand-* crates #850
Comments
Hello! I'm guessing you don't have a method of packaging multiple Rust crates into a single dpkg? Because I agree with your assessment that multiple packages make little sense within Debian. Rust already has many small crates, which provides a great mechanism for code reuse. For version 0.7 we have made some effort to reduce the number of dependencies (see #713). Actually, that list is somewhat out of date: |
You could package anything you like together, but.. You need some version number for the overall package, so rand should commit to updating its own version number anytime you suggest updating rand sub-crates. If not, you're ask them to make up this overall version number themselves, which makes no sense. I'm also curious if/when Rust needs some "packaging and dynamic linking WG" that maintains a "Rust distribution" ala LaTeX which handles many common crates via dynamic linking. If such a project existed then it would provide a smaller number of version numbers, along side with the primary goals of making Rust code more memory efficient, and preventing churn by slowing crate updates. |
I don't think we want to commit to this: part of the reason for the separation is to de-couple versions. There is another option which may be relevant when packaging internal dependencies: include them within the same lib (probably possible via automated code mutation; could potentially be done via a compiler option in the future). E.g.
In our case we don't have a very fast release schedule anyway; I don't believe slowing this even further would be a good trade.
IMO, at some point Rust should revisit the question of "what is a crate". E.g. I think it should be possible to have multiple independently versioned APIs provided by the same lib — in this case a single "rand" package which provides |
It is not clear what version this package should have. It's version would have to change for every minor update of |
Hmm, when it comes to packaging dylibs this doesn't help. Theoretically Rust could build it's own type of dylib which is allowed to include multiple APIs, and allowed to link in multiple versions of the dylib (so long as no more than one copy of the API version is active), but that's quite another thing (and hard to make compatible with C libs). |
Actually, this is probably fine: Debian's |
Perhaps @burdges is right that we should commit to updating the That should allow many of these crates to be packaged together. If we do that I would want to exclude |
@vks's idea by itself could result in multiple versions static/thread-local symbols within binaries (e.g. |
We'll see if @kpcyrd thinks such versioning tricks suffice.. or maybe if other issues cause the trouble. Apologies for the derail.. I have not considered rand's version trick much, so not sure if that's the real solution. I do think rust binaries including multiple crate versions makes sense for a young developing language, but rust eventually becoming a real systems language in which people write the kernel, system libraries, GUIs, etc. really benefits from a dylibs system in which very few crate version get used much. Ideally some WG would bless particular crate versions every year or so. We do not require this in scripting-inspired languages like Go because you deploy code devops style but you need this to become a foundation for everything else. Now Debian packages many scripting-inspired languages, so @kpcyrd might be running into something more rand specific. |
That sounds nice until things break. I personally do not mind whether rand uses zero or 200 dependencies, but rand should make sure that it works with every single valid combination of its dependencies, and that updating minor rand versions works under arbitrary valid dependency graph constraints. The more dependencies rand has, the more work this takes. The concern isn't theoretical: a patch level update from rand 0.6.1 to rand 0.6.5 fails in rust-lang/rust, because rand 0.6.5 does not link properly for the versions resolved for its dependencies in rust-lang/rust dependency graph. The versions resolved there are allowed by the Cargo.toml files of rand and its dependencies, so it is a valid dependency tree. This means that 0.6.5 should be yanked, and a new 0.6.6 without the issue should be released. The more dependencies rand has, the more work fixing things when they break will take. |
@gnzlbg I disagree. See #741 for example. This type of testing adds a lot of work for very little gain. For the specific issue you mention, I believe the correct solution would be to mark This is similar to the diamond inheritance problem: |
The
I'm not suggesting that you test this, I'm arguing that this shouldn't happen. How you achieve that goal is up to you. |
Where are the docs for that? |
https://doc.rust-lang.org/cargo/reference/manifest.html#the-links-field-optional
|
So we would need to make |
No, that is not required. |
So if we add It's also not possible to do that since (from my understanding) we cannot retroactively add this to the problematic version, 0.3.0. Also yanking version 0.3.0 doesn't solve the problem for those doing minimal upgrades. |
If you do that, only a single version of Note that the error produced in rust-lang/rust is a link-time error. That's super weird to encounter in Rust, and often only happens if you are trying to link two incompatible versions of a C library anyways.
This is broken already, at least for some combinations of rand 0.6 and 0.7.
You probably would need to yank 0.3.0 and 0.3.1 and release a newer version with the fix. But giving that the whole "compatibility wrapper" can create link-time errors, I wonder how compatible this "trick" actually is. I haven't studied what rand does there in detail. |
It isn't the compatibility wrapper which is responsible for link-time errors, it's the usage of multiple versions of a shared API ( I don't think yanking 0.3.0 would fix anything: the only users hitting this error are those doing a conservative upgrade from an early 0.6.x of
That's the first I've heard of this. I don't see why it should obe. |
So how does that result in linking errors of C symbols? Maybe we should move this conversation to a different issue. |
It doesn't. Sounds like we're talking about different issues, so yes, open a new issue if you like. |
I will close this issue now because (a) it has gone off-topic, (b) it appears to relate more to Rand 0.6, and (c) it has no concrete deliverables. I do consider this an important aspect of any design changes. For reference, this is the dependency tree of a minimal crate:
Of these, |
Hello!
I'm one of the (co-)maintainers of the rand-* packages in debian. I'd like to suggest a discussion about moving from the micro-crate approach to a smaller number of crates.
Our update workflow currently looks like this, we started a rand update shortly after the debian buster release in early July and are still working on it:
A smaller number of crates (or even a single rand crate) would save us some overhead and make our work a bit easier (we are about a handful of volunteers currently maintaining 572 packages).
What are your thoughts on this?
Thanks!
The text was updated successfully, but these errors were encountered: