If Dirty messages were only displayed with --verbose, then they can be difficult to find in the sea of Running messages.
ehuss: suggestion that Dirty is only displayed with --verbose, it shouldn't be too difficult to sift through the output when doing an investigation.
Also questions about how to display it in terms of multiple lines.
"From", "To", "Because" are printed as own status, rather than part of the "Dirty" status
Current PR has removed some of the From/To lines from the original proposal. Also, those aren't terribly useful due to the way fingerprints work (they often don't show up).
The screenshotted "because" also seems overly verbose, making it harder to scan for important information
Make additional information a separate PR to not block the current one
Verbose vs log?
log us hard to discover
"start with trace and prune down"
"Common to know" vs "trace events"?
Rebuild information is always too late…
Always log to file?
Uncertainty about what kind of performance impact that could have.
env logger might not work well for this
tracing might help
Log meta information so a command can print what happened
Moving parts that are specific to the code, particularly for link validation.
Holiday meeting schedule?
ehuss gone on 27th
jon out for next two weeks
Jacob is traveling
Ed will be watching kid out of school
Only skip 20th and 27th, meet on 3rd
And add Jon and Arlo to calendar event?
Contact Jacob
Sparse registry
ehuss going to add labels for cross-team approval
Split up PR
crates.io outage: they shut off invalidation to try to alleviate it, but the problem is more fundamental to how crates.io processes one thing at a time.
cargo:warning+=second line syntax support (epage is in favor)
Running things in parallel?
Print as unit with locked stdio would fix it
Could instead escape newlines
Breaking change?
Guarentee warning ordering (1 warning with 5 lines vs 5 warnings)
Need to precisely specify how we modify the line (prefix on first line)
Only guarentee alignment for lines 2..?
No prefix for multiline?
Should cargo:error= automatically cause the build script to error or not (previously, we said it should)
Make it clear in the documentation under which circumstances error should be used (under no circumstances can it proceed)
How to add new build.rs directives due to cargo:KEY=VALUE support
Assume what we add is unlikely to be used (minor break, rather than major break)
cargo:error=
cargo:metadata=KEY=VALUE
Do in new edition
Dependencies that aren't latest edition
Tell build script what the edition is: $CARGO_EDITION
But crates in package can be different editions
But we can just use top level for build.rs, scoping it to directives, rather than all code-gen
build.rs is tied to [package], not target, so can assume a single edition
Have directive to opt-in
cargo::
Can we add new namespace?
Question about sparse registry feedback. Eric to follup up with the summary.
arlosi: registry-auth without asymmetric tokens: zulip
Should we allow authenticated registries without asymmetric tokens?
Delaying the rollout of authenticated registries waiting for asymmetric tokens.
Time of rollout may be the primary concern.
Picking a timeline for re-evaluation of whether or not to require asymmetric.
Ask to try implementing asymmetric tokens. Other implementors shoehorn into things that are not designed for asymmetric tokens.
Current solutions can have worse security implications.
If asymmetric support was available in 6 months, how many implementors would still want symmetric tokens?
Can the work be split into smaller pieces to make the review/merge/implementation go more smoothly?
Having registry implementations would be very valuable for moving towards stabilization.
Some confusion due to missing information in the RFC about the details (headers, how to have a "dumb" implementation, etc.).
Start on the documentation in parallel with the implementation.
A specification for how to implement the protocol.
Jacob needs questions to be asked publicly.
Can we ask registry implementors (possibly the same set of people that @ehuss asked about sparse?)
"We want to do asymmetric authentication, this is our proposal, would this work for you, or would you rather have a different asymmetric implementation?"
2022-11-29
@weihanglo: Error when cargo update--precise or --aggressive without -p flag
Current behavior: It ignores the --precise field and updates everything.
--agressive is a bit different from --precise. --precise takes a field, which has no meaning without -p. --aggressive is the "default" behavior, so adding it really doesn't cause any harm.
jon: Should --aggressive even be a warning?
eric: would prefer to just make --precise an error now.
--aggressive could be left as a warning
@weihanglo: Aware of compression ratio for unpack size limit
A simple patch can work easily with updating dependencies (assuming the patch still applies)
Depending on a git repo for a patch can be somewhat heavy (needs to download the whole repo, etc.).
Patches using git were aimed for a workflow where once you have a git clone, you're one step away from posting a PR upstream. This would side-step that.
guardrails for the format of the patch (minimum number of lines, offset, fuzz, etc.)
Supporting other formats in the future?
git extensions to unidiff (rename x->y, then change this one line, binary files, etc.)
patching Cargo.toml could change the dependency requirements, requiring re-running the resolver.
Will require multiple passes.
Run resolver without the patches, apply the patches as new path-dependencies, run resolver again, that may change dependencies that now match other patches, which need to be applied, run resolver again, etc.
jon: put a restriction in the first iteration that doesn't allow patching Cargo.toml, and possibly add support for that later. It may add significant complexity to cargo, compared to the rest of this RFC.
Josh (and hopefully others 😊) will follow up with comments on some of the particulars. Overall in agreement with the general concept.
Breaking changes between certain steps (like alpha->beta) causes problems. The SemVer spec implies "anything goes" during pre-releases.
There are situations where things are likely to break (like during the alpha phase), but less likely in a later phase (like "rc" release candidates).
If you really want equal, you can write equal.
cargo add could add pre-releases with an equal by default
dtolnay's suggestion was
^1.0.0-beta.1 works as it does today.
1.0.0-beta.1 is treated as =1.0.0-beta.1
resolver="3" is a global thing which might not be the right way to opt-in to this.
But an edition might work since it is local to the Cargo.toml file.
Another option is: not specifying an operator is an error, and force the user to pick one. (in an edition)
Backwards compatible, less ambiguous
Perhaps sometime in the next year, can start a warning before the edition release to get people moving.
Will recommending = make it too difficult to update dependencies due to small differences?
Users will likely want a way to force an update (override the =), but we currently don't support that.
Should we (continue to) recommend that packages be a pre-release if any dependency is a pre-release?
Possibly adding a speed bump to cargo publish, with an option to override.
eric: Wondering about having built-in capabilities for discovering new pre-release versions. cargo outdated would provide that (and also cargo upgarde's dry-run?). Would that maybe help alleviate the difficulty of using = pre-releases? Because otherwise, the existence of new pre-releases isn't very visible.
Maven: snapshots. Snapshots can be mutated.
Cloudfront invalidation
Now in production again with more retries
Long-term known issue
Concern about moving to a third registry format (merkle), what to do with the serving of sparse registries? Can we just remove the invalidation (since it is mostly important to publishing)?
Can also switch to git index for publishing if using an old version or whatever.
Third-party registries will definitely prefer the current sparse-registry. Merkle may be unlikely something that they will want to (or can) use.
config.json could be a mechanism for opting-in to the merkle structure. Branching and depth factors could be parameters in the config.json.
Allows specifying features directly in target tables like [[bin]], which can then be used with optional dependencies to implement the same behavior as 2887.
That is not as intuitive, but covers more use cases, and would be easier to implement, and have a smaller impact.
Can't repupose required-features, since it has a different, existing use-case of "don't build this if not asked for".
josh: some people think required-features enables features.
Is there any way we can avoid having two fields? Like in an edition or something?
enable-features = […] force enables the given features when the binary is included.
force-enable-features = true would change the meaning of required-features
Some precedent: select vs depends in the Linux kernel's Kconfig language
Some way to build, but without a binary that enables features you don't want.
Instead of generating an error with --bin and required-features, change it so that it enables the features instead of generating an error.
The binaries are only built if expecitly requested (--bin) or the required-features are enabld otherwise.
artifact dependencies counts as an explicit request
default-install-features = […]
cargo run, there is an implicit binary associated with that
cargo test and cargo bench can build binaries, and there isn't an explicit choice for those binaries being given
Is there a concern about using this for optional dependencies will make those optional dependencies visible to all targets (like the lib)?
Something like cargo test will enable additional features for binaries, which isn't the set of features that are default for the library. cargo test --lib would be a workaround, but may not be clear to users
Improving error messages and diagnostics. For example cargo install saying what is excluded due to required-features.
The error message "error: target myexample requires the features: myfeature, another" could suggest using enable-features instead. (That error message is not good, and we should possibly continue to think about just removing it and imply --features, but that seems somewhat independent.)
With workspace inheritence, it will just leave some unused dependencies, which shouldn't cause problems.
For the others (patch, profile), it will cause an inconvenience, but ehuss feels it should not be too bad, and my original comment on that was not to be high-priority (it was fine that it slips).
Continue without any backports, we feel like the impact should be small
Scott: Add default-feauresto workspace dependencies derived from issue #11329
Issue: a bug that foo = {workspace=true, default-features=false} is not generating a warning about specifying default-features=false. Scott is working on a fix for that.
decision: allow default-features=false, and if you inherit a workspace dependency, the default-features needs to match what is specified in [workspace.dependencies], and if it doesn't, warn.
Should have test cases for both warning scenarios (workspace-dep has default-features=false and inheritance of it doesn't, and vice versa).
libgit2 performance issue with delta resolution
eric identified threading support as a huge performance hit, discussed various alternatives for that.
sparse registry status
Cloudfront invalidation: Turned on in prod yesterday, but caused issues.
Alro working on invalidation issues
Jacob started discussion about Fastly with infra
Invalidations are causing 503 errors
publish issues
Blocking is getting some testing now, but there might be some issues.
concern: crates.io regularly has a 4 minute outage (daily plus on every deploy)
Uncertain how cargo's timeout should deal with that.
Would be good to investigate why their git clone is so slow.
Need positive confirmation from crates.io/infra that they are ready to support it.
Stabilization will be opt-in at first.
Turn it on in nightly-only by default to force getting more exposure and testing and feedback.
Eric sent out requests for feedback from registry implementers. Feedback has been coming in, and eric will try to summarize it.
The absolute path to a dependency will vary by machine, pointing outside of a workspace, etc.
Josh proposing to postpone, Jon doesn't need it anymore, and may not champion it, but it is definitely a recognized problem and something where we could do better.
Making it easier to talk about things in Cargo.toml that are "elsewhere" but are somehow well known.
2022-10-25
epage: unavailable
@weihanglo: interaction between --package and feature resolve v2
discussed relationship with asymmetric tokens PR and the window between them. Should be fine to land on nightly for experimentation.
Josh: don't want to every stabilize support for symmetric shared-secret (non-asymmetric) tokens with sparse registry, but it's fine if they go in as nightly features sequentially
Have not brought up asymmetric tokens with crates.io. Would like to start those conversations. May need an RFC due to the details.
Jacob to follow up with them to start understanding how we can get started.
@weihanglo: Cannot build vendored git dependency if it inherits info from a workspace
Cargo uses current_exe() which is the wrong thing from a library.
Some build scripts don't use $CARGO and blindly call cargo
Proposal: Don't change $CARGO if it is already set. This allows the library user to override it.
Josh: Concern about using it to abuse it by making it a wrapper around cargo to change its behavior.
Josh: Alternative, adjusting PATH so that everything just calls the right thing. Make a separate directory that just contains cargo (so as not to affect other things). Tradeoff: could make existing build scripts work that way, but would be more complex.
Jon: Concern about fragility of changing PATH, and $CARGO is already a well-known method.
Subcommands: A subcommand that uses cargo as a library, when that subcommand does something (like running a build), $CARGO points to cargo-mysubcommand, and the build script will run the wrong thing.
Concern about this changing behavior. The outer cargo sets $CARGO, the subcommand then performs some operation with $CARGO set to itself. With this change, it will now point ot the outer cargo (~/.cargo/bin/cargo).
Adding a new environment variable could help with subcommands that don't get updated on user systems.
eric: Not certain there is enough of a problem here to justify adding more environment variables.
cargo-the-binary could override $CARGO to itself (like it does today)
Jon to open a PR implementing the "don't override" option.
Jon to open a discussion for a separate PR to set CARGO_BIKESHED (for some value of BIKESHED)
2022-10-18
Merging publish delay when?
Now seems fine, no need to wait.
Sparse may need to wait till the next branch.
Muscraft: Is suggesting cargo fix something that should be added now?
Don't have a process for having an outside (non-team-member) staying on as a maintainer.
Pull in cargo team?
In cargo repo or its own repo?
So cargo specific, seems fine
stdlib could always pull in correct home so people stop using it ouside of cargo's needs
stdlib looks at HOME on Windows which doesn't work right on cygwin
Should we rename to cargo_home
Might cause some churn
Will migrate to rust-lang/cargo/crates, can move to a dedicated repo in the future if we desire. Or, fix and un-deprecate the std version.
eric: Are changes to dependencies that cause new lints to fire a semver compatible change? I think the answer is "yes", but want more feedback.
Example: Removing unsafe from a function can cause unused_unsafe lint to fire. If the package has deny(unused_unsafe), it will then fail to compile.
Some other examples would be deprecated and must_use, though I think those almost certainly should be allowed.
There are lots of lints, and some have some subtle nuances that might not be obvious. Should we consider it on a lint-by-lint basis, or is it ok to just make a blanket statement?
Some very popular crates may be more sensitive to breaking dependents.
cap-lints makes this not a breaking change
Macros are a little complicated, since they suppress some lints (don't remember the rules for which ones).
Will move forward with the assumption that introducing any new lint is OK. May add some wording around the potential risks so that library authors can understand them.
PR open to add it to add suggestion to both warnings and errors
But cargo fix could corrupt code when there are errors, so we can limit the hint to warnings
But cargo fix will error because the tree is dirty, can we instead remove that? I stopped using cargo fix as part of edition migration because of this flag
But quality of fixes isn't always there
This will never be addressed if we don't put it out in the open
Update fix to suggest -p, --tests, --lib
Suggest --allow-dirty? Always mention it? make it default?
Concern about this being confusing about subtracting features
Motivation:
Take exiting behavior and put it behind a feature flag
This is a breaking change for default-features=false users
Libraries are actively doing this without bumping major
Ideally do this without a breaking change
2 RFCs and unconf on it, there is interest
Bumping major
Disruptive for everyone, even if not needed
Warp, tokio, etc probably wants larger windows without breakin
Usability for clap is terrible
2022-08-23
epage: Follow up on conversation with Jon
tl;dr of conversation with Jon: give him 1 dev year of projects to free up team to focus on growing itself with no concern for company politics. They'll then choose how to split it up and best fits among people. If its successful, he'll more easily get management to do another year etc.
issue: dependency on an alt registry which has a dependency on a second alt registry. Today, the second registry doesn't have to be configured locally. In the future, if the second registry shuts down their git index, then that second registry wouldn't be accessible.
uncertainty
concern: in order to know the canonical URL, Cargo needs to download config.json ahead of time to know that mapping.
2022-08-16
epage: Should we put more than ehuss into the review cycle?
Proposal: put all available but ehuss, we then escalate PRs to him when we feel uncomfortable with it
People available: epage, weihanglo, josh after spain
Use CODEOWNERS
ehuss will point to process
epage: rotate release assignments to help all learn, try to improve
This will likely be rare. Most will be content being in git.
New registries can stick to one or the other.
Challenge: companies that need to rebuild software from years ago
Can take transition cost
Would be alt-registry
For those that want to transition, there are a few options:
Serve both temporarily, and have users update their config, and then turn off git once everyone is transitioned.
"Yank the band-aid", where there is a single day transition
This is very difficult. Requires updating all Cargo.lock and .crate files.
Some are using alt-registries to "mirror" crates.io with modifications.
config.json could indicate what the "lock" URL is.
When configured in git, cargo would then say "oh, ok, I'll use sparse".
Cargo could then remember that it needs to talk to sparse.
Drawback: Users would clone the repo every time they start from scratch (like uncached CI or new environments).
Undoing the operation: If the git repo has a config -> use this instead, and that is used unconditionally, then there is no way for the user to go back to the git repo.
When a fix is published, that requires all reverse dependencies to publish a new version. For security fixes, this is more important because people often don’t publish very often.
It puts pressure on the community to keep compatibility, and to expose incompatible changes quickly. (At least, the exposure seems to happen faster with cargo install.)
https://github.com/rust-lang/cargo/issues/4309 providing a cargo outdated-like view for cargo update would provide a natural way to clarify that a dependency was held back and why (cargo upgrade just added this view, just not rust-version support yet)
How to organize discussion?
Crossing multiple teams
Concern about the sole focus on "MSRV". There could be a more wholistic view of what the user experience should be.
The rust-lang org only supports latest stable. Implying with MSRV that users can or should be running older versions doesn't match with our current policy that only stable is supported.
Documenting rust-lang's support
Cargo: on the rust-version field
Release: Forge?
Populating rust-version into the index.
Resolver support.
cargo add or cargo update or whatever, provide better error messages (or behavior) when comparing the rust-version.
crates.io filtering the index based on version being requested
supporting third-party tooling, such as mirrors filtered for a specific version
concern about this requires almost everyone to manually enter their rust-version and track it. If just one package doesn't follow this, then the premise that rust-version will address people's use cases may be false.
And even projects that have rust-version may be incorrectly stated (since it isn't tested on publish).
Compiler warnings for using API items annotated with a higher version?
Josh: compressing the manifest and include it with the index so that it has all information
move forward with negative numbers, -1 means max-1
Performance impact of including in help?
Probably u secs, so once per proc is probably fine, even for third-party commands
What about default for hetergenous (big/little core, performance/efficiency core, etc) CPUs?
For now, it’s usually ok to ignore the differences, but eric is concerned that it will become more of an issue in the future as they become more common (and more complex). A bigger concern might be memory usage when spawning too many jobs, which is a problem today.
Intuition or mental model may be confusing or complicated
What if * means something different in the future.
[profile.build] would that be any less confusing?
The idea is to have a single place to set build settings (instead of needing to duplicate in multiple profiles), and to try to avoid complexities around shared dependencies (profile.build is always used). In theory to simplify the logic. build-override should then almost never need to be used.
But, adding a whole new mechanism could add to the complexity, not reduce it.
A warning to let them know if package.* and build-override are both set, that one is overriding the other.
No conclusion yet, needs more thought and consideration.
2022-07-19
safe.directories
Should we trust the directory we’re directly in?
Concerns:
Inconsistency with rustup
Still has a potential scenario where cargo is run in an automated fashion (e.g. metadata, locate-project)
Don’t want to worry about security boundaries in cargo itself.
Inconstent behavior in a workspace, if there is mixed permissions among the members (think a weird git submodule checkout)
Can it be ignored as running as root?
People run su and probably have more complex root prompts than they should
Another docker detection case? Probably not, let’s not be Docker-specific.
git recently added more escape hatches and checks, eric will post those to the rfc
Concern about moving forward with this change if this isn’t something that we’ve discussed. It may create a convention that we may not necessarily want users to adopt.
CI or dev related, like deny warnings, docs-specific features
Optional dev dependencies
Ivy Java dependency manager has this
Semantic behaviors:
Theoretical: Prevent activating a feature (across a registry? or in Cargo.toml? CLI only?)
Actual: hide from documentation and other user-things (like cargo add display)
There may be multiple states that we may want to add for a feature, such as public/private,
stable/unstable, deprecated, etc. Having one of these use a naming convention would be a little inconstent.
Example of what this would look like: [features.myfeat] description = "This feature makes things awesome." public = true # or hidden? unstable = true deprecated = "use xyz instead" include = ["anotherfeature", "dep:somedep", "anotherdep/featxyz"]
deprecated features isn’t ideal right now
Limited to build.rs warnings, in one case its the only reason for the build.rs
Feature migrations
_feature-foo underscores and kebab-case. Might pressure someone to use underscores instead of dashes.
Can’t set the “workspace edition”, which means users continue to get confused about not setting resolver ="``2``"
cargo new for workspace could set the default
is there some way to detect the scenario and suggest a fix?
If all members are 2021, and resolver is unset?
This helps decouple when using non-virtual workspace
eric: only thought is that package doesn’t scream that this means “these can be reused in the workspace”, and might be confusing (subtle difference between [workspace.package] and [package] that is very different)
josh: in the future, it would be nice to be able to inherit multiple fields from the [workspace.package] table in one go (or all dependencies, etc.)
josh: would this help with rustc-workspace-hack. No, not without several more changes.
They’d like to start an FCP, which will include three teams (including Cargo); are we fine with that?
eric: concern that the motivation is for privacy, but this is not sufficient. There are multiple ways that paths and other environment information can leak into a binary, and I do not want to give the false sense of security to someone using it.
Build scripts
environment variables (env!). For example, cargo-bisect-rustc embeds the absolute path of RUST_SRC_REPO.
Things out of rustc’s control (linker scripts, linkers, etc.)
This provides some incremental improvement to privacy, but not absolute privacy
Passing the information down the build scripts so cc-rs could pass --remap-path-prefix to clang or gcc