summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2020-09-23 10:46:02 +0200
committerJörg Thalheim <joerg@thalheim.io>2020-09-23 10:50:57 +0200
commitf072d4dadcee0b616927f14baf3feb18591a1d68 (patch)
tree0625997fde4d7dbb468e6c9156647bb0180f810e
parent52bdb3eb7bc853873d68187494c2a683ce3084bc (diff)
downloadnixpkgs-f072d4dadcee0b616927f14baf3feb18591a1d68.tar
nixpkgs-f072d4dadcee0b616927f14baf3feb18591a1d68.tar.gz
nixpkgs-f072d4dadcee0b616927f14baf3feb18591a1d68.tar.bz2
nixpkgs-f072d4dadcee0b616927f14baf3feb18591a1d68.tar.lz
nixpkgs-f072d4dadcee0b616927f14baf3feb18591a1d68.tar.xz
nixpkgs-f072d4dadcee0b616927f14baf3feb18591a1d68.tar.zst
nixpkgs-f072d4dadcee0b616927f14baf3feb18591a1d68.zip
nixos/update-users-groups: fix encoding of json database
The issue here is that updateFile expects a unicode string while
encode_json returns a binary string unlike to_json.
-rw-r--r--nixos/modules/config/update-users-groups.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/config/update-users-groups.pl b/nixos/modules/config/update-users-groups.pl
index 979f6464f08..ddd7efd82f7 100644
--- a/nixos/modules/config/update-users-groups.pl
+++ b/nixos/modules/config/update-users-groups.pl
@@ -174,7 +174,7 @@ foreach my $name (keys %groupsCur) {
 # Rewrite /etc/group. FIXME: acquire lock.
 my @lines = map { join(":", $_->{name}, $_->{password}, $_->{gid}, $_->{members}) . "\n" }
     (sort { $a->{gid} <=> $b->{gid} } values(%groupsOut));
-updateFile($gidMapFile, encode_json($gidMap));
+updateFile($gidMapFile, to_json($gidMap));
 updateFile("/etc/group", \@lines);
 system("nscd --invalidate group");
 
@@ -250,7 +250,7 @@ foreach my $name (keys %usersCur) {
 # Rewrite /etc/passwd. FIXME: acquire lock.
 @lines = map { join(":", $_->{name}, $_->{fakePassword}, $_->{uid}, $_->{gid}, $_->{description}, $_->{home}, $_->{shell}) . "\n" }
     (sort { $a->{uid} <=> $b->{uid} } (values %usersOut));
-updateFile($uidMapFile, encode_json($uidMap));
+updateFile($uidMapFile, to_json($uidMap));
 updateFile("/etc/passwd", \@lines);
 system("nscd --invalidate passwd");