Closed
Conversation
Signed-off-by: lucasew <lucas59356@gmail.com>
infinisil
requested changes
Nov 13, 2023
| */ | ||
| fromHexString = value: | ||
| let | ||
| parsed = builtins.fromTOML "v=0x${value}"; |
Member
There was a problem hiding this comment.
We should make sure to check for the limits of this approach. I recommend a single builtins.match "^[0-9a-fA-F]{,<maximum>}$" value to validate there's no invalid characters and not too many (fill in ). The current length limit should also be documented as a warning in the docs (see here), with a note that it could get increased in the future.
Comment on lines
+167
to
+170
| testFromHexStringSecondExample = { | ||
| expr = fromHexString (builtins.hashString "sha256" "test"); | ||
| expected = 9223372036854775807; | ||
| }; |
Member
There was a problem hiding this comment.
This test will run into the length limit, needs some trimming :)
Contributor
|
This PR can be closed since I cherry-picked the commit into #318712 |
emilazy
added a commit
to emilazy/nixpkgs
that referenced
this pull request
Aug 14, 2025
This was cherry‐picked from <NixOS#266705> and merged as part of <NixOS#318712>, despite there being a blocking review on the former pointing out these kinds of issues. This documents some of the dodgy behaviour. It also can’t handle negative literals. It might be worth considering deprecating and dropping this, by inlining it into `lib.network.ipv6.fromString`, its only in‐tree user.
13 tasks
Member
|
FWIW, this should really not have been merged in its current state without the review comments being addressed; see #433710. |
nixpkgs-ci bot
pushed a commit
that referenced
this pull request
Aug 16, 2025
This was cherry‐picked from <#266705> and merged as part of <#318712>, despite there being a blocking review on the former pointing out these kinds of issues. This documents some of the dodgy behaviour. It also can’t handle negative literals. It might be worth considering deprecating and dropping this, by inlining it into `lib.network.ipv6.fromString`, its only in‐tree user. (cherry picked from commit 6673e05)
arcnmx
pushed a commit
to arcnmx/nixpkgs-lib
that referenced
this pull request
Aug 29, 2025
This was cherry‐picked from <NixOS/nixpkgs#266705> and merged as part of <NixOS/nixpkgs#318712>, despite there being a blocking review on the former pointing out these kinds of issues. This documents some of the dodgy behaviour. It also can’t handle negative literals. It might be worth considering deprecating and dropping this, by inlining it into `lib.network.ipv6.fromString`, its only in‐tree user. (cherry picked from commit 6673e05ad065b0f2388c94cc3b3445f9f7da780e)
github-actions bot
pushed a commit
to yunfachi/nixpkgs.lib
that referenced
this pull request
Oct 28, 2025
This was cherry‐picked from <NixOS/nixpkgs#266705> and merged as part of <NixOS/nixpkgs#318712>, despite there being a blocking review on the former pointing out these kinds of issues. This documents some of the dodgy behaviour. It also can’t handle negative literals. It might be worth considering deprecating and dropping this, by inlining it into `lib.network.ipv6.fromString`, its only in‐tree user.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Add a function that convert an hexadecimal string to it's int representation
Simplification of #258834
How to test:
nix-instantiate --eval lib/tests/misc.nixThings done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)