Skip to content
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

ruffle_desktop doesn't properly get current time due to "deterministic" build feature #285887

Open
edanaher opened this issue Feb 2, 2024 · 3 comments
Labels
0.kind: bug Something is broken

Comments

@edanaher
Copy link
Contributor

edanaher commented Feb 2, 2024

Describe the bug

Ruffle desktop currently provides a dummy time (2001-02-03 04:05:06) when a Flash application requests the time.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Download any flash application that uses the current time (e.g., a simple clock app: wget http://www.matsclock.com/matsclock.swf)
  2. Run the flash application: ruffle_desktop matsclock.swf
  3. Note that it shows a constant 4:05:06, rather than the current time.

Expected behavior

The application should show the current time.

Additional context

The Ruffle Discord gave me some help here: the problem is that the "deterministic" feature is being set. This is used by Ruffle for testing and other features where they want deterministic output. (So this very reasonably stubs in a fake time rather than using the current time).

Unfortunately, the way Cargo works, features are combined across all packages being built and applied to all of them; in particular, since the exporter uses the deterministic flag and is also being built, that flag gets pushed through the whole build, including ruffle_desktop.

I fixed this by simply changing the cargoBuildFlags to --package=ruffle_desktop rather than --workspace; this builds only the desktop player. However, this would be a regression since we currently build all the packages in the workspace. AFAICT, if we wanted to build the multiple packages, we'd have to do multiple builds. I'm not sure how easy that is; I haven't worked much with Rust in Nix.

An alternative would be to patch out the deterministic flag in the various Cargo.toml's; however, I don't know what the impact would be on the other packages of not using that flag.

So I know a couple possible fixes here, but am not sure about the best way. If someone else has some insight, I'd be happy to put together a PR, but wanted to get some feedback first.

Notify maintainers

@jchv
@GovanifY

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.71, NixOS, 24.05 (Uakari), 24.05pre567746.317484b1ead8`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@edanaher edanaher added the 0.kind: bug Something is broken label Feb 2, 2024
@jchv
Copy link
Contributor

jchv commented Feb 12, 2024

Maybe we can separate the individual packages into their own derivations? Looks like there is a bit of prior art with sshx here, and it looks like roughly what I'd expect. Not sure what to do for the main ruffle package though. Maybe symlinkJoin the derivations together?

There are already some binaries that maybe don't make much sense to include with the main ruffle build anyway, like the ruffle_web_safari binary that is just a stub outside of macOS, and build_playerglobal.

I'll try to find a bit of time to look into it now that we've got a newer build of ruffle merged, as it doesn't look too hard. However, I may be a bit busy for the next week or two.

@edanaher
Copy link
Contributor Author

Oh, the sshx example looks nice, and symlinkJoin seems reasonable to me for the overall package. Though on further reflection, it also seems potentially reasonable to deprecate the top-level ruffle package and give an error suggesting the child packages instead. I'm pretty sure I've seen this sort of behavior before, but I'm not sure what the typical Nixpkgs policy would be for this sort of change.

And while I'm somewhat interested in trying to put this together, I'm unlikely to get to it in the near future. If it's still open in a month or two, maybe I'll give it a shot. For the moment though, a local build with --package=ruffle_desktop is working well enough.

@jchv
Copy link
Contributor

jchv commented Feb 13, 2024

Hmm... I kind of agree with you, maybe it really is senseless to bother building exporter and friends when all most people want is the player. It'd be nice to have them in nixpkgs, but if we switch over to symlinkJoin with separate derivations, a lot of overlapping code will just get compiled multiple times for no benefit to many users. I wonder if there's a good way to eat our cake and have it too. I'll try to find some prior art.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants