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

networking.hostId: fix cmd in description #46495

Merged
merged 1 commit into from
Sep 11, 2018
Merged

Conversation

erikarvstedt
Copy link
Member

@erikarvstedt erikarvstedt commented Sep 10, 2018

Pad the hex literal with leading zeros to the required length of 8 bytes (32 bit).

Question to reviewers:

As /etc/machine-id is already a random, lower-case hex string, why not just use head -c 8 /etc/machine-id?

@GrahamcOfBorg GrahamcOfBorg added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Sep 10, 2018
@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 0 This PR does not cause any packages to rebuild labels Sep 10, 2018
@@ -341,7 +341,7 @@ in
You should try to make this ID unique among your machines. You can
generate a random 32-bit ID using the following commands:

<literal>cksum /etc/machine-id | while read c rest; do printf "%x" $c; done</literal>
<literal>cksum /etc/machine-id | while read c rest; do printf "%08x" $c; done</literal>
Copy link
Member

Choose a reason for hiding this comment

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

I agree head -c 8 /etc/machine-id makes more sense.

1. Simplify the command by reading directly from /etc/machine-id which
is already a random, lower-case hex string
2. Previously, the command output could be too short because of missing
leading digits. This is now fixed.
@erikarvstedt
Copy link
Member Author

I've updated the patch to use head -c ...

@Mic92 Mic92 merged commit b60ddaf into NixOS:master Sep 11, 2018
@Mic92
Copy link
Member

Mic92 commented Sep 11, 2018

backport: c1713a1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 0 This PR does not cause any packages to rebuild
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants