Skip to content

Conversation

corpix
Copy link
Contributor

@corpix corpix commented Apr 4, 2021

Motivation for this change

raco exe some-racket-file.rkt is not working since update to Racket 8.0, see #114993

It fails because Racket try to detect a runtime variant reading a string from it's own executable. Of course it fails to correctly detect runtime type using this method because racket executable is a wrapper script.

This pull request removes patching out a runtime detection mechanism, hardcoding 'cs runtime variant (because this is a variant built by racket derivation).

I don't like this solution. But maybe someone who will see this pull request could suggest a better way to mitigate the problem?

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Apr 4, 2021
@r-rmcgibbo
Copy link

r-rmcgibbo commented Apr 4, 2021

Result of nixpkgs-review pr 118490 at b6544d6e run on aarch64-linux 1

2 packages built successfully:
  • racket
  • racket-minimal
15 suggestions:
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/rm' doesn't match anything in file 'src/ChezScheme/workarea'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/cp' doesn't match anything in file 'src/bc/src/string.c'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/true' doesn't match anything in file 'src/lt/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/ln' doesn't match anything in file 'src/lt/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/ln' doesn't match anything in file 'src/cs/c/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/rm' doesn't match anything in file 'src/cs/c/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/ln' doesn't match anything in file 'src/bc/src/string.c'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/rm' doesn't match anything in file 'src/bc/src/string.c'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/true' doesn't match anything in file 'src/bc/src/string.c'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/usr/bin/uname' doesn't match anything in file 'src/ChezScheme/workarea'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/true' doesn't match anything in file 'src/ChezScheme/workarea'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/cp' doesn't match anything in file 'src/lt/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/true' doesn't match anything in file 'src/cs/c/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/rm' doesn't match anything in file 'src/lt/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/cp' doesn't match anything in file 'src/cs/c/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    

Result of nixpkgs-review pr 118490 at b6544d6e run on x86_64-linux 1

1 package failed to build:
2 packages built successfully:
  • racket
  • racket-minimal
15 suggestions:
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/ln' doesn't match anything in file 'src/bc/src/string.c'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/ln' doesn't match anything in file 'src/cs/c/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/true' doesn't match anything in file 'src/cs/c/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/usr/bin/uname' doesn't match anything in file 'src/ChezScheme/workarea'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/rm' doesn't match anything in file 'src/lt/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/true' doesn't match anything in file 'src/bc/src/string.c'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/cp' doesn't match anything in file 'src/bc/src/string.c'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/rm' doesn't match anything in file 'src/ChezScheme/workarea'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/ln' doesn't match anything in file 'src/lt/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/cp' doesn't match anything in file 'src/lt/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/rm' doesn't match anything in file 'src/bc/src/string.c'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/true' doesn't match anything in file 'src/lt/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/rm' doesn't match anything in file 'src/cs/c/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/cp' doesn't match anything in file 'src/cs/c/configure'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    
  • warning: stale-substitute

    Stale substituteInPlace detected.
    substituteStream(): WARNING: pattern '/bin/true' doesn't match anything in file 'src/ChezScheme/workarea'
    Near pkgs/development/interpreters/racket/default.nix:102:0:

        |
    102 |     description = "A programmable programming language";
        | ^
    

Note that build failures may predate this PR, and could be nondeterministic or hardware dependent.
Please exercise your independent judgement.

@@ -71,6 +71,7 @@ stdenv.mkDerivation rec {
buildInputs = [ fontconfig libffi libtool sqlite gsettings-desktop-schemas gtk3 ]
++ lib.optionals stdenv.isDarwin [ libiconv CoreFoundation ncurses ];

patches = [ ./variant.patch ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment why we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done

@SuperSandro2000 SuperSandro2000 requested review from iblech and marsam April 4, 2021 21:52
@iblech
Copy link
Contributor

iblech commented Apr 4, 2021

I am sorry, I don't have time to review this right now, but I'd like to link racket/racket#3685 which seems to be relevant. In any case, thank you for your work in improving our Racket support!

@tomberek
Copy link
Contributor

tomberek commented Apr 6, 2021

Result of nixpkgs-review pr 118490 run on x86_64-darwin 1

1 package marked as broken and skipped:
  • racket
1 package failed to build:
  • racket-minimal

@LiberalArtist
Copy link

It's not directly related, but, for anyone reading this thread, there's been some coordination going on for Nix- and Guix-related issues with Racket over at racket/racket#3707. Among other things, most (hopefully all!) patches to the Racket source should no longer be needed for the forthcoming Racket 8.1.

@@ -0,0 +1,54 @@
diff --git racket/collects/setup/variant.rkt racket/collects/setup/variant.rkt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the following patch work for you?

--- racket/collects/setup/variant.rkt
+++ racket/collects/setup/variant.rkt
@@ -6,7 +6,8 @@
 
 (provide variant-suffix)
 
-(define plain-variant
+(define plain-variant 'cs)
+#;(define plain-variant
   (delay/sync
    (cond
      [(cross-installation?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I could, this should save some patch lines :)
Will check results later when build finish

@SuperSandro2000
Copy link
Member

ping @corpix

@SuperSandro2000 SuperSandro2000 requested a review from marsam April 22, 2021 01:22
@yrashk yrashk mentioned this pull request Jun 1, 2021
9 tasks
@stale
Copy link

stale bot commented Oct 22, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 22, 2021
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 24, 2021
@corpix
Copy link
Contributor Author

corpix commented Oct 24, 2021

Not relevant anymore

@corpix corpix closed this Oct 24, 2021
@marsam
Copy link
Contributor

marsam commented Oct 24, 2021

I'm sorry for the late response.
I believe it's still relevant, I'm going to reopen it and merged it as soon as it finish the evaluation, I hope you don't mind.

@marsam marsam reopened this Oct 24, 2021
@marsam marsam merged commit 6b23e8f into NixOS:master Oct 24, 2021
@corpix corpix deleted the fix/racket branch July 21, 2022 20:01
@rc-zb rc-zb mentioned this pull request Jan 30, 2025
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants