lol

Merge remote-tracking branch 'origin/staging'

Conflicts:
pkgs/applications/version-management/subversion/default.nix

+3310 -523
+1 -1
lib/platforms.nix
··· 7 freebsd = ["i686-freebsd" "x86_64-freebsd"]; 8 openbsd = ["i686-openbsd" "x86_64-openbsd"]; 9 netbsd = ["i686-netbsd" "x86_64-netbsd"]; 10 - cygwin = ["i686-cygwin"]; 11 unix = linux ++ darwin ++ freebsd ++ openbsd; 12 all = linux ++ darwin ++ cygwin ++ freebsd ++ openbsd; 13 none = [];
··· 7 freebsd = ["i686-freebsd" "x86_64-freebsd"]; 8 openbsd = ["i686-openbsd" "x86_64-openbsd"]; 9 netbsd = ["i686-netbsd" "x86_64-netbsd"]; 10 + cygwin = ["i686-cygwin" "x86_64-cygwin"]; 11 unix = linux ++ darwin ++ freebsd ++ openbsd; 12 all = linux ++ darwin ++ cygwin ++ freebsd ++ openbsd; 13 none = [];
+1 -7
nixos/doc/manual/configuration/user-mgmt.xml
··· 13 14 <programlisting> 15 users.extraUsers.alice = 16 - { createHome = true; 17 home = "/home/alice"; 18 description = "Alice Foobar"; 19 extraGroups = [ "wheel" "networkmanager" ]; 20 - useDefaultShell = true; 21 openssh.authorizedKeys.keys = [ "ssh-dss AAAAB3Nza... alice@foobar" ]; 22 }; 23 </programlisting> ··· 57 58 As with users, the group ID (gid) is optional and will be assigned 59 automatically if it’s missing.</para> 60 - 61 - <warning><para>Currently declarative user management is not perfect: 62 - <command>nixos-rebuild</command> does not know how to realise certain 63 - configuration changes. This includes removing a user or group, and 64 - removing group membership from a user.</para></warning> 65 66 <para>In the imperative style, users and groups are managed by 67 commands such as <command>useradd</command>,
··· 13 14 <programlisting> 15 users.extraUsers.alice = 16 + { isNormalUser = true; 17 home = "/home/alice"; 18 description = "Alice Foobar"; 19 extraGroups = [ "wheel" "networkmanager" ]; 20 openssh.authorizedKeys.keys = [ "ssh-dss AAAAB3Nza... alice@foobar" ]; 21 }; 22 </programlisting> ··· 56 57 As with users, the group ID (gid) is optional and will be assigned 58 automatically if it’s missing.</para> 59 60 <para>In the imperative style, users and groups are managed by 61 commands such as <command>useradd</command>,
+239
nixos/modules/config/update-users-groups.pl
···
··· 1 + use strict; 2 + use File::Path qw(make_path); 3 + use File::Slurp; 4 + use JSON; 5 + 6 + make_path("/var/lib/nixos", { mode => 0755 }); 7 + 8 + 9 + # Functions for allocating free GIDs/UIDs. FIXME: respect ID ranges in 10 + # /etc/login.defs. 11 + sub allocId { 12 + my ($used, $idMin, $idMax, $up, $getid) = @_; 13 + my $id = $up ? $idMin : $idMax; 14 + while ($id >= $idMin && $id <= $idMax) { 15 + if (!$used->{$id} && !defined &$getid($id)) { 16 + $used->{$id} = 1; 17 + return $id; 18 + } 19 + $used->{$id} = 1; 20 + if ($up) { $id++; } else { $id--; } 21 + } 22 + die "$0: out of free UIDs or GIDs\n"; 23 + } 24 + 25 + my (%gidsUsed, %uidsUsed); 26 + 27 + sub allocGid { 28 + return allocId(\%gidsUsed, 400, 499, 0, sub { my ($gid) = @_; getgrgid($gid) }); 29 + } 30 + 31 + sub allocUid { 32 + my ($isSystemUser) = @_; 33 + my ($min, $max, $up) = $isSystemUser ? (400, 499, 0) : (1000, 29999, 1); 34 + return allocId(\%uidsUsed, $min, $max, $up, sub { my ($uid) = @_; getpwuid($uid) }); 35 + } 36 + 37 + 38 + # Read the declared users/groups. 39 + my $spec = decode_json(read_file($ARGV[0])); 40 + 41 + # Don't allocate UIDs/GIDs that are already in use. 42 + foreach my $g (@{$spec->{groups}}) { 43 + $gidsUsed{$g->{gid}} = 1 if defined $g->{gid}; 44 + } 45 + 46 + foreach my $u (@{$spec->{groups}}) { 47 + $uidsUsed{$u->{u}} = 1 if defined $u->{uid}; 48 + } 49 + 50 + # Read the current /etc/group. 51 + sub parseGroup { 52 + chomp; 53 + my @f = split(':', $_, -4); 54 + my $gid = $f[2] eq "" ? undef : int($f[2]); 55 + $gidsUsed{$gid} = 1 if defined $gid; 56 + return ($f[0], { name => $f[0], password => $f[1], gid => $gid, members => $f[3] }); 57 + } 58 + 59 + my %groupsCur = -f "/etc/group" ? map { parseGroup } read_file("/etc/group") : (); 60 + 61 + # Read the current /etc/passwd. 62 + sub parseUser { 63 + chomp; 64 + my @f = split(':', $_, -7); 65 + my $uid = $f[2] eq "" ? undef : int($f[2]); 66 + $uidsUsed{$uid} = 1 if defined $uid; 67 + return ($f[0], { name => $f[0], fakePassword => $f[1], uid => $uid, 68 + gid => $f[3], description => $f[4], home => $f[5], shell => $f[6] }); 69 + } 70 + 71 + my %usersCur = -f "/etc/passwd" ? map { parseUser } read_file("/etc/passwd") : (); 72 + 73 + # Read the groups that were created declaratively (i.e. not by groups) 74 + # in the past. These must be removed if they are no longer in the 75 + # current spec. 76 + my $declGroupsFile = "/var/lib/nixos/declarative-groups"; 77 + my %declGroups; 78 + $declGroups{$_} = 1 foreach split / /, -e $declGroupsFile ? read_file($declGroupsFile) : ""; 79 + 80 + # Idem for the users. 81 + my $declUsersFile = "/var/lib/nixos/declarative-users"; 82 + my %declUsers; 83 + $declUsers{$_} = 1 foreach split / /, -e $declUsersFile ? read_file($declUsersFile) : ""; 84 + 85 + 86 + # Generate a new /etc/group containing the declared groups. 87 + my %groupsOut; 88 + foreach my $g (@{$spec->{groups}}) { 89 + my $name = $g->{name}; 90 + my $existing = $groupsCur{$name}; 91 + 92 + my %members = map { ($_, 1) } @{$g->{members}}; 93 + 94 + if (defined $existing) { 95 + $g->{gid} = $existing->{gid} if !defined $g->{gid}; 96 + if ($g->{gid} != $existing->{gid}) { 97 + warn "warning: not applying GID change of group ‘$name’\n"; 98 + $g->{gid} = $existing->{gid}; 99 + } 100 + $g->{password} = $existing->{password}; # do we want this? 101 + if ($spec->{mutableUsers}) { 102 + # Merge in non-declarative group members. 103 + foreach my $uname (split /,/, $existing->{members} // "") { 104 + $members{$uname} = 1 if !defined $declUsers{$uname}; 105 + } 106 + } 107 + } else { 108 + $g->{gid} = allocGid if !defined $g->{gid}; 109 + $g->{password} = "x"; 110 + } 111 + 112 + $g->{members} = join ",", sort(keys(%members)); 113 + $groupsOut{$name} = $g; 114 + } 115 + 116 + # Update the persistent list of declarative groups. 117 + write_file($declGroupsFile, join(" ", sort(keys %groupsOut))); 118 + 119 + # Merge in the existing /etc/group. 120 + foreach my $name (keys %groupsCur) { 121 + my $g = $groupsCur{$name}; 122 + next if defined $groupsOut{$name}; 123 + if (!$spec->{mutableUsers} || defined $declGroups{$name}) { 124 + print STDERR "removing group ‘$name’\n"; 125 + } else { 126 + $groupsOut{$name} = $g; 127 + } 128 + } 129 + 130 + 131 + # Rewrite /etc/group. FIXME: acquire lock. 132 + my @lines = map { join(":", $_->{name}, $_->{password}, $_->{gid}, $_->{members}) . "\n" } 133 + (sort { $a->{gid} <=> $b->{gid} } values(%groupsOut)); 134 + write_file("/etc/group.tmp", @lines); 135 + rename("/etc/group.tmp", "/etc/group") or die; 136 + system("nscd --invalidate group"); 137 + 138 + # Generate a new /etc/passwd containing the declared users. 139 + my %usersOut; 140 + foreach my $u (@{$spec->{users}}) { 141 + my $name = $u->{name}; 142 + 143 + # Resolve the gid of the user. 144 + if ($u->{group} =~ /^[0-9]$/) { 145 + $u->{gid} = $u->{group}; 146 + } elsif (defined $groupsOut{$u->{group}}) { 147 + $u->{gid} = $groupsOut{$u->{group}}->{gid} // die; 148 + } else { 149 + warn "warning: user ‘$name’ has unknown group ‘$u->{group}’\n"; 150 + $u->{gid} = 65534; 151 + } 152 + 153 + my $existing = $usersCur{$name}; 154 + if (defined $existing) { 155 + $u->{uid} = $existing->{uid} if !defined $u->{uid}; 156 + if ($u->{uid} != $existing->{uid}) { 157 + warn "warning: not applying UID change of user ‘$name’\n"; 158 + $u->{uid} = $existing->{uid}; 159 + } 160 + } else { 161 + $u->{uid} = allocUid($u->{isSystemUser}) if !defined $u->{uid}; 162 + 163 + # Create a home directory. 164 + if ($u->{createHome}) { 165 + make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home}; 166 + chown $u->{uid}, $u->{gid}, $u->{home}; 167 + } 168 + } 169 + 170 + if (defined $u->{passwordFile}) { 171 + if (-e $u->{passwordFile}) { 172 + $u->{hashedPassword} = read_file($u->{passwordFile}); 173 + chomp $u->{hashedPassword}; 174 + } else { 175 + warn "warning: password file ‘$u->{passwordFile}’ does not exist\n"; 176 + } 177 + } 178 + 179 + $u->{fakePassword} = $existing->{fakePassword} // "x"; 180 + $usersOut{$name} = $u; 181 + } 182 + 183 + # Update the persistent list of declarative users. 184 + write_file($declUsersFile, join(" ", sort(keys %usersOut))); 185 + 186 + # Merge in the existing /etc/passwd. 187 + foreach my $name (keys %usersCur) { 188 + my $u = $usersCur{$name}; 189 + next if defined $usersOut{$name}; 190 + if (!$spec->{mutableUsers} || defined $declUsers{$name}) { 191 + print STDERR "removing user ‘$name’\n"; 192 + } else { 193 + $usersOut{$name} = $u; 194 + } 195 + } 196 + 197 + # Rewrite /etc/passwd. FIXME: acquire lock. 198 + @lines = map { join(":", $_->{name}, $_->{fakePassword}, $_->{uid}, $_->{gid}, $_->{description}, $_->{home}, $_->{shell}) . "\n" } 199 + (sort { $a->{uid} <=> $b->{uid} } (values %usersOut)); 200 + write_file("/etc/passwd.tmp", @lines); 201 + rename("/etc/passwd.tmp", "/etc/passwd") or die; 202 + system("nscd --invalidate passwd"); 203 + 204 + 205 + # Rewrite /etc/shadow to add new accounts or remove dead ones. 206 + my @shadowNew; 207 + my %shadowSeen; 208 + 209 + foreach my $line (-f "/etc/shadow" ? read_file("/etc/shadow") : ()) { 210 + chomp $line; 211 + my ($name, $password, @rest) = split(':', $line, -9); 212 + my $u = $usersOut{$name};; 213 + next if !defined $u; 214 + $password = $u->{hashedPassword} if defined $u->{hashedPassword} && !$spec->{mutableUsers}; # FIXME 215 + push @shadowNew, join(":", $name, $password, @rest) . "\n"; 216 + $shadowSeen{$name} = 1; 217 + } 218 + 219 + foreach my $u (values %usersOut) { 220 + next if defined $shadowSeen{$u->{name}}; 221 + my $password = "!"; 222 + $password = $u->{hashedPassword} if defined $u->{hashedPassword}; 223 + # FIXME: set correct value for sp_lstchg. 224 + push @shadowNew, join(":", $u->{name}, $password, "1::::::") . "\n"; 225 + } 226 + 227 + write_file("/etc/shadow.tmp", { perms => 0600 }, @shadowNew); 228 + rename("/etc/shadow.tmp", "/etc/shadow") or die; 229 + 230 + 231 + # Call chpasswd to apply password. FIXME: generate the hashes directly 232 + # and merge into the /etc/shadow updating above. 233 + foreach my $u (@{$spec->{users}}) { 234 + if (defined $u->{password}) { 235 + my $pid = open(PW, "| chpasswd") or die; 236 + print PW "$u->{name}:$u->{password}\n"; 237 + close PW or die "unable to change password of user ‘$u->{name}’: $?\n"; 238 + } 239 + }
+57 -178
nixos/modules/config/users-groups.nix
··· 7 ids = config.ids; 8 cfg = config.users; 9 10 - nonUidUsers = filterAttrs (n: u: u.createUser && u.uid == null) cfg.extraUsers; 11 - nonGidGroups = filterAttrs (n: g: g.gid == null) cfg.extraGroups; 12 - 13 passwordDescription = '' 14 The options <literal>hashedPassword</literal>, 15 <literal>password</literal> and <literal>passwordFile</literal> ··· 55 type = with types; nullOr int; 56 default = null; 57 description = '' 58 - The account UID. If the <option>mutableUsers</option> option 59 - is false, the UID cannot be null. Otherwise, the UID might be 60 - null, in which case a free UID is picked on activation (by the 61 - useradd command). 62 ''; 63 }; 64 ··· 67 default = false; 68 description = '' 69 Indicates if the user is a system user or not. This option 70 - only has an effect if <option>mutableUsers</option> is 71 - <literal>true</literal> and <option>uid</option> is 72 <option>null</option>, in which case it determines whether 73 the user's UID is allocated in the range for system users 74 (below 500) or in the range for normal users (starting at 75 1000). 76 ''; 77 }; 78 ··· 182 ${passwordDescription} 183 ''; 184 }; 185 - 186 - createUser = mkOption { 187 - type = types.bool; 188 - default = true; 189 - description = '' 190 - Indicates if the user should be created automatically as a local user. 191 - Set this to false if the user for instance is an LDAP user. NixOS will 192 - then not modify any of the basic properties for the user account. 193 - ''; 194 - }; 195 }; 196 197 - config = { 198 - name = mkDefault name; 199 - shell = mkIf config.useDefaultShell (mkDefault cfg.defaultUserShell); 200 - }; 201 202 }; 203 ··· 217 type = with types; nullOr int; 218 default = null; 219 description = '' 220 - The group GID. If the <literal>mutableUsers</literal> option 221 - is false, the GID cannot be null. Otherwise, the GID might be 222 - null, in which case a free GID is picked on activation (by the 223 - groupadd command). 224 ''; 225 }; 226 ··· 271 }; 272 }; 273 274 - getGroup = gname: 275 - let 276 - groups = mapAttrsToList (n: g: g) ( 277 - filterAttrs (n: g: g.name == gname) cfg.extraGroups 278 - ); 279 - in 280 - if length groups == 1 then head groups 281 - else if groups == [] then throw "Group ${gname} not defined" 282 - else throw "Group ${gname} has multiple definitions"; 283 - 284 - getUser = uname: 285 - let 286 - users = mapAttrsToList (n: u: u) ( 287 - filterAttrs (n: u: u.name == uname) cfg.extraUsers 288 - ); 289 - in 290 - if length users == 1 then head users 291 - else if users == [] then throw "User ${uname} not defined" 292 - else throw "User ${uname} has multiple definitions"; 293 - 294 - mkGroupEntry = gname: 295 - let 296 - g = getGroup gname; 297 - users = mapAttrsToList (n: u: u.name) ( 298 - filterAttrs (n: u: elem g.name u.extraGroups) cfg.extraUsers 299 - ); 300 - in concatStringsSep ":" [ 301 - g.name "x" (toString g.gid) 302 - (concatStringsSep "," (users ++ (filter (u: !(elem u users)) g.members))) 303 - ]; 304 - 305 - mkPasswdEntry = uname: let u = getUser uname; in 306 - concatStringsSep ":" [ 307 - u.name "x" (toString u.uid) 308 - (toString (getGroup u.group).gid) 309 - u.description u.home u.shell 310 - ]; 311 - 312 - filterNull = a: filter (x: hasAttr a x && getAttr a x != null); 313 - 314 - sortOn = a: sort (as1: as2: lessThan (getAttr a as1) (getAttr a as2)); 315 - 316 - groupFile = pkgs.writeText "group" ( 317 - concatStringsSep "\n" (map (g: mkGroupEntry g.name) ( 318 - sortOn "gid" (filterNull "gid" (attrValues cfg.extraGroups)) 319 - )) 320 - ); 321 - 322 - passwdFile = pkgs.writeText "passwd" ( 323 - concatStringsSep "\n" (map (u: mkPasswdEntry u.name) ( 324 - sortOn "uid" (filterNull "uid" (attrValues cfg.extraUsers)) 325 - )) 326 - ); 327 - 328 mkSubuidEntry = user: concatStrings ( 329 map (range: "${user.name}:${toString range.startUid}:${toString range.count}\n") 330 - user.subUidRanges); 331 332 - subuidFile = concatStrings (map mkSubuidEntry ( 333 - sortOn "uid" (filterNull "uid" (attrValues cfg.extraUsers)))); 334 335 mkSubgidEntry = user: concatStrings ( 336 map (range: "${user.name}:${toString range.startGid}:${toString range.count}\n") 337 user.subGidRanges); 338 339 - subgidFile = concatStrings (map mkSubgidEntry ( 340 - sortOn "uid" (filterNull "uid" (attrValues cfg.extraUsers)))); 341 - 342 - # If mutableUsers is true, this script adds all users/groups defined in 343 - # users.extra{Users,Groups} to /etc/{passwd,group} iff there isn't any 344 - # existing user/group with the same name in those files. 345 - # If mutableUsers is false, the /etc/{passwd,group} files will simply be 346 - # replaced with the users/groups defined in the NixOS configuration. 347 - # The merging procedure could certainly be improved, and instead of just 348 - # keeping the lines as-is from /etc/{passwd,group} they could be combined 349 - # in some way with the generated content from the NixOS configuration. 350 - merger = src: pkgs.writeScript "merger" '' 351 - #!${pkgs.bash}/bin/bash 352 - 353 - PATH=${pkgs.gawk}/bin:${pkgs.gnugrep}/bin:$PATH 354 - 355 - ${if !cfg.mutableUsers 356 - then ''cp ${src} $1.tmp'' 357 - else ''awk -F: '{ print "^"$1":.*" }' $1 | egrep -vf - ${src} | cat $1 - > $1.tmp'' 358 - } 359 - 360 - # set mtime to +1, otherwise change might go unnoticed (vipw/vigr only looks at mtime) 361 - touch -m -t $(date -d @$(($(stat -c %Y $1)+1)) +%Y%m%d%H%M.%S) $1.tmp 362 - 363 - mv -f $1.tmp $1 364 - ''; 365 366 idsAreUnique = set: idAttr: !(fold (name: args@{ dup, acc }: 367 let ··· 375 376 uidsAreUnique = idsAreUnique (filterAttrs (n: u: u.uid != null) cfg.extraUsers) "uid"; 377 gidsAreUnique = idsAreUnique (filterAttrs (n: g: g.gid != null) cfg.extraGroups) "gid"; 378 379 in { 380 ··· 512 grsecurity.gid = ids.gids.grsecurity; 513 }; 514 515 - system.activationScripts.users = 516 - let 517 - mkhomeUsers = filterAttrs (n: u: u.createHome) cfg.extraUsers; 518 - setpwUsers = filterAttrs (n: u: u.createUser) cfg.extraUsers; 519 - pwFile = u: if !(isNull u.hashedPassword) 520 - then pkgs.writeTextFile { name = "password-file"; text = u.hashedPassword; } 521 - else if !(isNull u.password) 522 - then pkgs.runCommand "password-file" { pw = u.password; } '' 523 - echo -n "$pw" | ${pkgs.mkpasswd}/bin/mkpasswd -s > $out 524 - '' else u.passwordFile; 525 - setpw = n: u: '' 526 - setpw=yes 527 - ${optionalString cfg.mutableUsers '' 528 - test "$(getent shadow '${u.name}' | cut -d: -f2)" != "x" && setpw=no 529 - ''} 530 - if [ "$setpw" == "yes" ]; then 531 - ${if !(isNull (pwFile u)) 532 - then '' 533 - echo -n "${u.name}:" | cat - "${pwFile u}" | \ 534 - ${pkgs.shadow}/sbin/chpasswd -e 535 - '' 536 - else "passwd -l '${u.name}' &>/dev/null" 537 - } 538 - fi 539 - ''; 540 - mkhome = n: u: '' 541 - uid="$(id -u ${u.name})" 542 - gid="$(id -g ${u.name})" 543 - h="${u.home}" 544 - test -a "$h" || mkdir -p "$h" || true 545 - test "$(stat -c %u "$h")" = $uid || chown $uid "$h" || true 546 - test "$(stat -c %g "$h")" = $gid || chgrp $gid "$h" || true 547 - ''; 548 - groupadd = n: g: '' 549 - if [ -z "$(getent group "${g.name}")" ]; then 550 - ${pkgs.shadow}/sbin/groupadd "${g.name}" 551 - fi 552 - ''; 553 - useradd = n: u: '' 554 - if ! id "${u.name}" &>/dev/null; then 555 - ${pkgs.shadow}/sbin/useradd \ 556 - -g "${u.group}" \ 557 - -G "${concatStringsSep "," u.extraGroups}" \ 558 - -s "${u.shell}" \ 559 - -d "${u.home}" \ 560 - ${optionalString u.isSystemUser "--system"} \ 561 - "${u.name}" 562 - echo "${u.name}:x" | ${pkgs.shadow}/sbin/chpasswd -e 563 - fi 564 - ''; 565 - in stringAfter [ "etc" ] '' 566 - touch /etc/group 567 - touch /etc/passwd 568 - VISUAL=${merger groupFile} ${pkgs.shadow}/sbin/vigr &>/dev/null 569 - VISUAL=${merger passwdFile} ${pkgs.shadow}/sbin/vipw &>/dev/null 570 - ${pkgs.shadow}/sbin/grpconv 571 - ${pkgs.shadow}/sbin/pwconv 572 - ${concatStrings (mapAttrsToList groupadd nonGidGroups)} 573 - ${concatStrings (mapAttrsToList useradd nonUidUsers)} 574 - ${concatStrings (mapAttrsToList mkhome mkhomeUsers)} 575 - ${concatStrings (mapAttrsToList setpw setpwUsers)} 576 ''; 577 578 # for backwards compatibility ··· 589 590 assertions = [ 591 { assertion = !cfg.enforceIdUniqueness || (uidsAreUnique && gidsAreUnique); 592 - message = "uids and gids must be unique!"; 593 - } 594 - { assertion = cfg.mutableUsers || (nonUidUsers == {}); 595 - message = "When mutableUsers is false, no uid can be null: ${toString (attrNames nonUidUsers)}"; 596 - } 597 - { assertion = cfg.mutableUsers || (nonGidGroups == {}); 598 - message = "When mutableUsers is false, no gid can be null"; 599 } 600 ]; 601
··· 7 ids = config.ids; 8 cfg = config.users; 9 10 passwordDescription = '' 11 The options <literal>hashedPassword</literal>, 12 <literal>password</literal> and <literal>passwordFile</literal> ··· 52 type = with types; nullOr int; 53 default = null; 54 description = '' 55 + The account UID. If the UID is null, a free UID is picked on 56 + activation. 57 ''; 58 }; 59 ··· 62 default = false; 63 description = '' 64 Indicates if the user is a system user or not. This option 65 + only has an effect if <option>uid</option> is 66 <option>null</option>, in which case it determines whether 67 the user's UID is allocated in the range for system users 68 (below 500) or in the range for normal users (starting at 69 1000). 70 + ''; 71 + }; 72 + 73 + isNormalUser = mkOption { 74 + type = types.bool; 75 + default = false; 76 + description = '' 77 + Indicates whether this is an account for a “real” user. This 78 + automatically sets <option>group</option> to 79 + <literal>users</literal>, <option>createHome</option> to 80 + <literal>true</literal>, <option>home</option> to 81 + <filename>/home/<replaceable>username</replaceable></filename>, 82 + <option>useDefaultShell</option> to <literal>true</literal>, 83 + and <option>isSystemUser</option> to 84 + <literal>false</literal>. 85 ''; 86 }; 87 ··· 191 ${passwordDescription} 192 ''; 193 }; 194 }; 195 196 + config = mkMerge 197 + [ { name = mkDefault name; 198 + shell = mkIf config.useDefaultShell (mkDefault cfg.defaultUserShell); 199 + } 200 + (mkIf config.isNormalUser { 201 + group = mkDefault "users"; 202 + createHome = mkDefault true; 203 + home = mkDefault "/home/${name}"; 204 + useDefaultShell = mkDefault true; 205 + isSystemUser = mkDefault false; 206 + }) 207 + ]; 208 209 }; 210 ··· 224 type = with types; nullOr int; 225 default = null; 226 description = '' 227 + The group GID. If the GID is null, a free GID is picked on 228 + activation. 229 ''; 230 }; 231 ··· 276 }; 277 }; 278 279 mkSubuidEntry = user: concatStrings ( 280 map (range: "${user.name}:${toString range.startUid}:${toString range.count}\n") 281 + user.subUidRanges); 282 283 + subuidFile = concatStrings (map mkSubuidEntry (attrValues cfg.extraUsers)); 284 285 mkSubgidEntry = user: concatStrings ( 286 map (range: "${user.name}:${toString range.startGid}:${toString range.count}\n") 287 user.subGidRanges); 288 289 + subgidFile = concatStrings (map mkSubgidEntry (attrValues cfg.extraUsers)); 290 291 idsAreUnique = set: idAttr: !(fold (name: args@{ dup, acc }: 292 let ··· 300 301 uidsAreUnique = idsAreUnique (filterAttrs (n: u: u.uid != null) cfg.extraUsers) "uid"; 302 gidsAreUnique = idsAreUnique (filterAttrs (n: g: g.gid != null) cfg.extraGroups) "gid"; 303 + 304 + spec = builtins.toFile "users-groups.json" (builtins.toJSON { 305 + inherit (cfg) mutableUsers; 306 + users = mapAttrsToList (n: u: 307 + { inherit (u) 308 + name uid group description home shell createHome isSystemUser 309 + password passwordFile hashedPassword; 310 + }) cfg.extraUsers; 311 + groups = mapAttrsToList (n: g: 312 + { inherit (g) name gid; 313 + members = mapAttrsToList (n: u: u.name) ( 314 + filterAttrs (n: u: elem g.name u.extraGroups) cfg.extraUsers 315 + ); 316 + }) cfg.extraGroups; 317 + }); 318 319 in { 320 ··· 452 grsecurity.gid = ids.gids.grsecurity; 453 }; 454 455 + system.activationScripts.users = stringAfter [ "etc" ] 456 + '' 457 + ${pkgs.perl}/bin/perl -w \ 458 + -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl \ 459 + -I${pkgs.perlPackages.JSON}/lib/perl5/site_perl \ 460 + ${./update-users-groups.pl} ${spec} 461 ''; 462 463 # for backwards compatibility ··· 474 475 assertions = [ 476 { assertion = !cfg.enforceIdUniqueness || (uidsAreUnique && gidsAreUnique); 477 + message = "UIDs and GIDs must be unique!"; 478 } 479 ]; 480
+1 -5
nixos/modules/installer/tools/nixos-generate-config.pl
··· 525 526 # Define a user account. Don't forget to set a password with ‘passwd’. 527 # users.extraUsers.guest = { 528 - # name = "guest"; 529 - # group = "users"; 530 # uid = 1000; 531 - # createHome = true; 532 - # home = "/home/guest"; 533 - # shell = "/run/current-system/sw/bin/bash"; 534 # }; 535 536 }
··· 525 526 # Define a user account. Don't forget to set a password with ‘passwd’. 527 # users.extraUsers.guest = { 528 + # isNormalUser = true; 529 # uid = 1000; 530 # }; 531 532 }
+2 -5
nixos/modules/profiles/demo.nix
··· 4 imports = [ ./graphical.nix ]; 5 6 users.extraUsers.demo = 7 - { description = "Demo user account"; 8 - group = "users"; 9 extraGroups = [ "wheel" ]; 10 - home = "/home/demo"; 11 - createHome = true; 12 - useDefaultShell = true; 13 password = "demo"; 14 uid = 1000; 15 };
··· 4 imports = [ ./graphical.nix ]; 5 6 users.extraUsers.demo = 7 + { isNormalUser = true; 8 + description = "Demo user account"; 9 extraGroups = [ "wheel" ]; 10 password = "demo"; 11 uid = 1000; 12 };
+11
nixos/modules/virtualisation/containers.nix
··· 177 if [ "$PRIVATE_NETWORK" = 1 ]; then 178 ip link del dev "ve-$INSTANCE" 2> /dev/null || true 179 fi 180 ''; 181 182 script = ··· 240 ip route add $LOCAL_ADDRESS dev $ifaceHost 241 fi 242 fi 243 ''; 244 245 preStop =
··· 177 if [ "$PRIVATE_NETWORK" = 1 ]; then 178 ip link del dev "ve-$INSTANCE" 2> /dev/null || true 179 fi 180 + 181 + 182 + if [ "$PRIVATE_NETWORK" = 1 ]; then 183 + ip link del dev "ve-$INSTANCE" 2> /dev/null || true 184 + fi 185 ''; 186 187 script = ··· 245 ip route add $LOCAL_ADDRESS dev $ifaceHost 246 fi 247 fi 248 + 249 + # This blocks until the container-startup-done service 250 + # writes something to this pipe. FIXME: it also hangs 251 + # until the start timeout expires if systemd-nspawn exits. 252 + read x < $root/var/lib/startup-done 253 + rm -f $root/var/lib/startup-done 254 ''; 255 256 preStop =
+2 -4
nixos/tests/common/user-account.nix
··· 1 { pkgs, ... }: 2 3 { users.extraUsers = pkgs.lib.singleton 4 - { name = "alice"; 5 description = "Alice Foobar"; 6 - home = "/home/alice"; 7 - createHome = true; 8 - useDefaultShell = true; 9 password = "foobar"; 10 uid = 1000; 11 };
··· 1 { pkgs, ... }: 2 3 { users.extraUsers = pkgs.lib.singleton 4 + { isNormalUser = true; 5 + name = "alice"; 6 description = "Alice Foobar"; 7 password = "foobar"; 8 uid = 1000; 9 };
+6 -3
pkgs/applications/editors/ed/default.nix
··· 1 { fetchurl, stdenv }: 2 3 stdenv.mkDerivation rec { 4 - name = "ed-1.9"; 5 6 src = fetchurl { 7 - url = "mirror://gnu/ed/${name}.tar.gz"; 8 - sha256 = "122syihsx2hwzj75mkf5a9ssiky2xby748kp4cc00wzhmp7p5cym"; 9 }; 10 11 /* FIXME: Tests currently fail on Darwin:
··· 1 { fetchurl, stdenv }: 2 3 stdenv.mkDerivation rec { 4 + name = "ed-1.10"; 5 6 src = fetchurl { 7 + # gnu only provides *.lz tarball, which is unfriendly for stdenv bootstrapping 8 + #url = "mirror://gnu/ed/${name}.tar.gz"; 9 + url = "http://pkgs.fedoraproject.org/repo/extras/ed/${name}.tar.bz2" 10 + + "/38204d4c690a17a989e802ba01b45e98/${name}.tar.bz2"; 11 + sha256 = "16qvshl8470f3znjfrrci3lzllqkzc6disk5kygzsg9hh4f6wysq"; 12 }; 13 14 /* FIXME: Tests currently fail on Darwin:
+1 -1
pkgs/applications/networking/instant-messengers/twinkle/default.nix
··· 29 30 NIX_CFLAGS_LINK = "-Wl,--as-needed -lboost_regex -lasound -lzrtpcpp -lspeex -lspeexdsp"; 31 32 - enableParallelBuilding = true; 33 34 meta = with stdenv.lib; { 35 homepage = http://www.twinklephone.com/;
··· 29 30 NIX_CFLAGS_LINK = "-Wl,--as-needed -lboost_regex -lasound -lzrtpcpp -lspeex -lspeexdsp"; 31 32 + #enableParallelBuilding = true; # fatal error: messageform.h: No such file or directory 33 34 meta = with stdenv.lib; { 35 homepage = http://www.twinklephone.com/;
-1
pkgs/applications/networking/newsreaders/liferea/default.nix
··· 33 for f in "$out"/bin/*; do 34 wrapProgram "$f" \ 35 --prefix PYTHONPATH : "$(toPythonPath $out):$(toPythonPath ${pygobject3})" \ 36 - --prefix LD_LIBRARY_PATH : "${gnome3.libgnome_keyring}/lib" \ 37 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 38 --prefix GIO_EXTRA_MODULES : "${gnome3.dconf}/lib/gio/modules:${glib_networking}/lib/gio/modules" \ 39 --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gnome3.gnome_icon_theme}/share:${gnome3.gtk}/share:$out/share:$GSETTINGS_SCHEMAS_PATH"
··· 33 for f in "$out"/bin/*; do 34 wrapProgram "$f" \ 35 --prefix PYTHONPATH : "$(toPythonPath $out):$(toPythonPath ${pygobject3})" \ 36 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 37 --prefix GIO_EXTRA_MODULES : "${gnome3.dconf}/lib/gio/modules:${glib_networking}/lib/gio/modules" \ 38 --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gnome3.gnome_icon_theme}/share:${gnome3.gtk}/share:$out/share:$GSETTINGS_SCHEMAS_PATH"
-1
pkgs/applications/virtualization/virt-manager/default.nix
··· 51 --prefix GI_TYPELIB_PATH : $GI_TYPELIB_PATH \ 52 --prefix GIO_EXTRA_MODULES : "${dconf}/lib/gio/modules" \ 53 --prefix GSETTINGS_SCHEMA_DIR : $out/share/glib-2.0/schemas \ 54 - --prefix LD_LIBRARY_PATH : ${gtk3}/lib/:${libvirt-glib}/lib/:${vte}/lib:${gtkvnc}/lib${optionalString spiceSupport ":${spice_gtk}/lib"} \ 55 --prefix XDG_DATA_DIRS : "$out/share:${gsettings_desktop_schemas}/share:${gtk3}/share:$GSETTINGS_SCHEMAS_PATH:\$XDG_DATA_DIRS" 56 done 57
··· 51 --prefix GI_TYPELIB_PATH : $GI_TYPELIB_PATH \ 52 --prefix GIO_EXTRA_MODULES : "${dconf}/lib/gio/modules" \ 53 --prefix GSETTINGS_SCHEMA_DIR : $out/share/glib-2.0/schemas \ 54 --prefix XDG_DATA_DIRS : "$out/share:${gsettings_desktop_schemas}/share:${gtk3}/share:$GSETTINGS_SCHEMAS_PATH:\$XDG_DATA_DIRS" 55 done 56
-1
pkgs/build-support/gcc-wrapper/gcc-wrapper.sh
··· 77 n=$((n + 1)) 78 done 79 params=("${rest[@]}") 80 - NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE --sysroot=/var/empty" 81 fi 82 83
··· 77 n=$((n + 1)) 78 done 79 params=("${rest[@]}") 80 fi 81 82
-1
pkgs/desktops/gnome-3/3.10/apps/gedit/default.nix
··· 25 wrapProgram "$out/bin/gedit" \ 26 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ 27 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 28 - --prefix LD_LIBRARY_PATH : "${gnome3.libpeas}/lib:${gnome3.gtksourceview}/lib" \ 29 --prefix XDG_DATA_DIRS : "${gnome3.gtksourceview}/share:${gnome3.gnome_themes_standard}/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" 30 ''; 31
··· 25 wrapProgram "$out/bin/gedit" \ 26 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ 27 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 28 --prefix XDG_DATA_DIRS : "${gnome3.gtksourceview}/share:${gnome3.gnome_themes_standard}/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" 29 ''; 30
+1 -7
pkgs/desktops/gnome-3/3.10/apps/gnome-documents/default.nix
··· 28 29 enableParallelBuilding = true; 30 31 - preFixup = 32 - let 33 - libPath = stdenv.lib.makeLibraryPath 34 - [ evince gtk3 gnome3.tracker gnome3.gnome_online_accounts ]; 35 - in 36 - '' 37 substituteInPlace $out/bin/gnome-documents --replace gapplication "${glib}/bin/gapplication" 38 wrapProgram "$out/bin/gnome-documents" \ 39 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ 40 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 41 - --prefix LD_LIBRARY_PATH ":" "${libPath}" \ 42 --prefix XDG_DATA_DIRS : "${gnome3.gnome_themes_standard}/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \ 43 --run "if [ -z \"\$XDG_CACHE_DIR\" ]; then XDG_CACHE_DIR=\$HOME/.cache; fi; if [ -w \"\$XDG_CACHE_DIR/..\" ]; then mkdir -p \"\$XDG_CACHE_DIR/gnome-documents\"; fi" 44 rm $out/share/icons/hicolor/icon-theme.cache
··· 28 29 enableParallelBuilding = true; 30 31 + preFixup = '' 32 substituteInPlace $out/bin/gnome-documents --replace gapplication "${glib}/bin/gapplication" 33 wrapProgram "$out/bin/gnome-documents" \ 34 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ 35 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 36 --prefix XDG_DATA_DIRS : "${gnome3.gnome_themes_standard}/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \ 37 --run "if [ -z \"\$XDG_CACHE_DIR\" ]; then XDG_CACHE_DIR=\$HOME/.cache; fi; if [ -w \"\$XDG_CACHE_DIR/..\" ]; then mkdir -p \"\$XDG_CACHE_DIR/gnome-documents\"; fi" 38 rm $out/share/icons/hicolor/icon-theme.cache
+1 -9
pkgs/desktops/gnome-3/3.10/apps/gnome-music/default.nix
··· 24 25 enableParallelBuilding = true; 26 27 - preFixup = 28 - let 29 - libPath = stdenv.lib.makeLibraryPath 30 - [ glib gtk3 libnotify tracker gnome3.grilo cairo 31 - gst_all_1.gstreamer gst_all_1.gst-plugins-base 32 - gst_all_1.gst-plugins-good gst_all_1.gst-plugins-bad ]; 33 - in 34 - '' 35 wrapProgram "$out/bin/gnome-music" \ 36 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ 37 --prefix XDG_DATA_DIRS : "${gnome3.gnome_themes_standard}/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \ 38 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 39 - --prefix LD_LIBRARY_PATH : "${libPath}" \ 40 --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0" \ 41 --prefix GRL_PLUGIN_PATH : "${gnome3.grilo-plugins}/lib/grilo-0.2" \ 42 --prefix PYTHONPATH : "$PYTHONPATH"
··· 24 25 enableParallelBuilding = true; 26 27 + preFixup = '' 28 wrapProgram "$out/bin/gnome-music" \ 29 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ 30 --prefix XDG_DATA_DIRS : "${gnome3.gnome_themes_standard}/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \ 31 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 32 --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0" \ 33 --prefix GRL_PLUGIN_PATH : "${gnome3.grilo-plugins}/lib/grilo-0.2" \ 34 --prefix PYTHONPATH : "$PYTHONPATH"
-1
pkgs/desktops/gnome-3/3.12/core/gnome-shell/default.nix
··· 35 wrapProgram "$out/bin/gnome-shell" \ 36 --prefix PATH : "${unzip}/bin" \ 37 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 38 - --prefix LD_LIBRARY_PATH : "${accountsservice}/lib:${ibus}/lib:${gdm}/lib" \ 39 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ 40 --prefix XDG_DATA_DIRS : "${gnome_themes_standard}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" 41
··· 35 wrapProgram "$out/bin/gnome-shell" \ 36 --prefix PATH : "${unzip}/bin" \ 37 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 38 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ 39 --prefix XDG_DATA_DIRS : "${gnome_themes_standard}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" 40
-1
pkgs/desktops/gnome-3/3.12/misc/gnome-tweak-tool/default.nix
··· 30 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ 31 --prefix XDG_DATA_DIRS : "${gtk3}/share:${gnome3.gnome_themes_standard}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \ 32 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 33 - --prefix LD_LIBRARY_PATH ":" "${libsoup}/lib:${gnome3.gnome_desktop}/lib:${libnotify}/lib:${gtk3}/lib:${atk}/lib" \ 34 --prefix PYTHONPATH : "$PYTHONPATH:$(toPythonPath $out)" 35 ''; 36
··· 30 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ 31 --prefix XDG_DATA_DIRS : "${gtk3}/share:${gnome3.gnome_themes_standard}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \ 32 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 33 --prefix PYTHONPATH : "$PYTHONPATH:$(toPythonPath $out)" 34 ''; 35
+1 -2
pkgs/desktops/gnome-3/3.12/misc/gpaste/default.nix
··· 30 for i in $out/libexec/gpaste/*; do 31 wrapProgram $i \ 32 --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \ 33 - --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 34 - --prefix LD_LIBRARY_PATH : "${libPath}" 35 done 36 ''; 37
··· 30 for i in $out/libexec/gpaste/*; do 31 wrapProgram $i \ 32 --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \ 33 + --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" 34 done 35 ''; 36
+10 -2
pkgs/desktops/kde-4.12/kdelibs/kdelibs.nix
··· 4 , automoc4, soprano, qca2, attica, enchant, libdbusmenu_qt, grantlee 5 , docbook_xml_dtd_42, docbook_xsl, polkit_qt_1, acl, attr, libXtst 6 , udev, herqq, phonon, libjpeg, xz, ilmbase, libxslt 7 - , pkgconfig 8 }: 9 10 kde { ··· 28 # There are a few hardcoded paths. 29 # Split plugins from libs? 30 31 - patches = [ ../files/polkit-install.patch ]; 32 33 cmakeFlags = [ 34 "-DDOCBOOKXML_CURRENTDTD_DIR=${docbook_xml_dtd_42}/xml/dtd/docbook"
··· 4 , automoc4, soprano, qca2, attica, enchant, libdbusmenu_qt, grantlee 5 , docbook_xml_dtd_42, docbook_xsl, polkit_qt_1, acl, attr, libXtst 6 , udev, herqq, phonon, libjpeg, xz, ilmbase, libxslt 7 + , pkgconfig, fetchpatch 8 }: 9 10 kde { ··· 28 # There are a few hardcoded paths. 29 # Split plugins from libs? 30 31 + patches = [ 32 + ../files/polkit-install.patch 33 + (fetchpatch { 34 + name = "CVE-2014-5033.patch"; 35 + url = "http://quickgit.kde.org/?p=kdelibs.git" 36 + + "&a=commit&h=e4e7b53b71e2659adaf52691d4accc3594203b23"; 37 + sha256 = "0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73"; 38 + }) 39 + ]; 40 41 cmakeFlags = [ 42 "-DDOCBOOKXML_CURRENTDTD_DIR=${docbook_xml_dtd_42}/xml/dtd/docbook"
+4 -18
pkgs/development/compilers/gcc/4.8/default.nix
··· 13 , perl ? null # optional, for texi2pod (then pod2man); required for Java 14 , gmp, mpfr, mpc, gettext, which 15 , libelf # optional, for link-time optimizations (LTO) 16 - , ppl ? null, cloog ? null, isl ? null # optional, for the Graphite optimization framework. 17 , zlib ? null, boehmgc ? null 18 , zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null 19 , libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null ··· 59 # Whether building a cross-compiler for GNU/Hurd. 60 crossGNU = cross != null && cross.config == "i586-pc-gnu"; 61 62 - /* gccinstall.info says that "parallel make is currently not supported since 63 - collisions in profile collecting may occur". 64 - */ 65 - enableParallelBuilding = !profiledCompiler; 66 67 patches = [] 68 ++ optional enableParallelBuilding ./parallel-bconfig.patch 69 ++ optional (cross != null) ./libstdc++-target.patch 70 # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its 71 # target libraries and tools. 72 ++ optional langAda ./gnat-cflags.patch ··· 278 ++ (optional javaAwtGtk pkgconfig); 279 280 buildInputs = [ gmp mpfr mpc libelf ] 281 - ++ (optional (ppl != null) ppl) 282 ++ (optional (cloog != null) cloog) 283 ++ (optional (isl != null) isl) 284 ++ (optional (zlib != null) zlib) ··· 295 296 NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; 297 298 - preConfigure = '' 299 - configureFlagsArray=( 300 - ${stdenv.lib.optionalString (ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic) 301 - "'--with-host-libstdcxx=-lstdc++ -lgcc_s'"} 302 - ${stdenv.lib.optionalString (ppl != null && stdenv.isSunOS) 303 - "\"--with-host-libstdcxx=-Wl,-rpath,\$prefix/lib/amd64 -lstdc++\" 304 - \"--with-boot-ldflags=-L../prev-x86_64-pc-solaris2.11/libstdc++-v3/src/.libs\""} 305 - ); 306 - '' + stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) '' 307 export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g` 308 export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET" 309 export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET" ··· 331 ${if enableMultilib then "--disable-libquadmath" else "--disable-multilib"} 332 ${if enableShared then "" else "--disable-shared"} 333 ${if enablePlugin then "--enable-plugin" else "--disable-plugin"} 334 - ${if ppl != null then "--with-ppl=${ppl} --disable-ppl-version-check" else ""} 335 ${optionalString (isl != null) "--with-isl=${isl}"} 336 ${optionalString (cloog != null) "--with-cloog=${cloog} --disable-cloog-version-check --enable-cloog-backend=isl"} 337 ${if langJava then ··· 414 configureFlags = '' 415 ${if enableMultilib then "" else "--disable-multilib"} 416 ${if enableShared then "" else "--disable-shared"} 417 - ${if ppl != null then "--with-ppl=${ppl.crossDrv}" else ""} 418 ${if cloog != null then "--with-cloog=${cloog.crossDrv} --enable-cloog-backend=isl" else ""} 419 ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} 420 ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} ··· 523 524 maintainers = with stdenv.lib.maintainers; [ ludo viric shlevy simons ]; 525 526 - # Volunteers needed for the {Cyg,Dar}win ports of *PPL. 527 # gnatboot is not available out of linux platforms, so we disable the darwin build 528 # for the gnat (ada compiler). 529 platforms =
··· 13 , perl ? null # optional, for texi2pod (then pod2man); required for Java 14 , gmp, mpfr, mpc, gettext, which 15 , libelf # optional, for link-time optimizations (LTO) 16 + , cloog ? null, isl ? null # optional, for the Graphite optimization framework. 17 , zlib ? null, boehmgc ? null 18 , zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null 19 , libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null ··· 59 # Whether building a cross-compiler for GNU/Hurd. 60 crossGNU = cross != null && cross.config == "i586-pc-gnu"; 61 62 + enableParallelBuilding = true; 63 64 patches = [] 65 ++ optional enableParallelBuilding ./parallel-bconfig.patch 66 ++ optional (cross != null) ./libstdc++-target.patch 67 + ++ optional noSysDirs ./no-sys-dirs.patch 68 # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its 69 # target libraries and tools. 70 ++ optional langAda ./gnat-cflags.patch ··· 276 ++ (optional javaAwtGtk pkgconfig); 277 278 buildInputs = [ gmp mpfr mpc libelf ] 279 ++ (optional (cloog != null) cloog) 280 ++ (optional (isl != null) isl) 281 ++ (optional (zlib != null) zlib) ··· 292 293 NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; 294 295 + preConfigure = stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) '' 296 export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g` 297 export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET" 298 export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET" ··· 320 ${if enableMultilib then "--disable-libquadmath" else "--disable-multilib"} 321 ${if enableShared then "" else "--disable-shared"} 322 ${if enablePlugin then "--enable-plugin" else "--disable-plugin"} 323 ${optionalString (isl != null) "--with-isl=${isl}"} 324 ${optionalString (cloog != null) "--with-cloog=${cloog} --disable-cloog-version-check --enable-cloog-backend=isl"} 325 ${if langJava then ··· 402 configureFlags = '' 403 ${if enableMultilib then "" else "--disable-multilib"} 404 ${if enableShared then "" else "--disable-shared"} 405 ${if cloog != null then "--with-cloog=${cloog.crossDrv} --enable-cloog-backend=isl" else ""} 406 ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} 407 ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} ··· 510 511 maintainers = with stdenv.lib.maintainers; [ ludo viric shlevy simons ]; 512 513 # gnatboot is not available out of linux platforms, so we disable the darwin build 514 # for the gnat (ada compiler). 515 platforms =
+28
pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch
···
··· 1 + diff -ru -x '*~' gcc-4.8.3-orig/gcc/cppdefault.c gcc-4.8.3/gcc/cppdefault.c 2 + --- gcc-4.8.3-orig/gcc/cppdefault.c 2013-01-10 21:38:27.000000000 +0100 3 + +++ gcc-4.8.3/gcc/cppdefault.c 2014-08-18 16:20:32.893944536 +0200 4 + @@ -35,6 +35,8 @@ 5 + # undef CROSS_INCLUDE_DIR 6 + #endif 7 + 8 + +#undef LOCAL_INCLUDE_DIR 9 + + 10 + const struct default_include cpp_include_defaults[] 11 + #ifdef INCLUDE_DEFAULTS 12 + = INCLUDE_DEFAULTS; 13 + diff -ru -x '*~' gcc-4.8.3-orig/gcc/gcc.c gcc-4.8.3/gcc/gcc.c 14 + --- gcc-4.8.3-orig/gcc/gcc.c 2014-03-23 12:30:57.000000000 +0100 15 + +++ gcc-4.8.3/gcc/gcc.c 2014-08-18 13:19:32.689201690 +0200 16 + @@ -1162,10 +1162,10 @@ 17 + /* Default prefixes to attach to command names. */ 18 + 19 + #ifndef STANDARD_STARTFILE_PREFIX_1 20 + -#define STANDARD_STARTFILE_PREFIX_1 "/lib/" 21 + +#define STANDARD_STARTFILE_PREFIX_1 "" 22 + #endif 23 + #ifndef STANDARD_STARTFILE_PREFIX_2 24 + -#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/" 25 + +#define STANDARD_STARTFILE_PREFIX_2 "" 26 + #endif 27 + 28 + #ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
+2 -16
pkgs/development/compilers/gcc/4.9/default.nix
··· 11 , perl ? null # optional, for texi2pod (then pod2man); required for Java 12 , gmp, mpfr, mpc, gettext, which 13 , libelf # optional, for link-time optimizations (LTO) 14 - , ppl ? null, cloog ? null, isl ? null # optional, for the Graphite optimization framework. 15 , zlib ? null, boehmgc ? null 16 , zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null 17 , libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null ··· 57 # Whether building a cross-compiler for GNU/Hurd. 58 crossGNU = cross != null && cross.config == "i586-pc-gnu"; 59 60 - /* gccinstall.info says that "parallel make is currently not supported since 61 - collisions in profile collecting may occur". 62 - */ 63 - enableParallelBuilding = !profiledCompiler; 64 65 patches = [ ] 66 ++ optional enableParallelBuilding ./parallel-bconfig.patch ··· 276 ++ (optional javaAwtGtk pkgconfig); 277 278 buildInputs = [ gmp mpfr mpc libelf ] 279 - ++ (optional (ppl != null) ppl) 280 ++ (optional (cloog != null) cloog) 281 ++ (optional (isl != null) isl) 282 ++ (optional (zlib != null) zlib) ··· 294 NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; 295 296 preConfigure = '' 297 - configureFlagsArray=( 298 - ${stdenv.lib.optionalString (ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic) 299 - "'--with-host-libstdcxx=-lstdc++ -lgcc_s'"} 300 - ${stdenv.lib.optionalString (ppl != null && stdenv.isSunOS) 301 - "\"--with-host-libstdcxx=-Wl,-rpath,\$prefix/lib/amd64 -lstdc++\" 302 - \"--with-boot-ldflags=-L../prev-x86_64-pc-solaris2.11/libstdc++-v3/src/.libs\""} 303 - ); 304 ${stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) 305 '' 306 export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g` ··· 322 ${if enableMultilib then "--disable-libquadmath" else "--disable-multilib"} 323 ${if enableShared then "" else "--disable-shared"} 324 ${if enablePlugin then "--enable-plugin" else "--disable-plugin"} 325 - ${if ppl != null then "--with-ppl=${ppl} --disable-ppl-version-check" else ""} 326 ${optionalString (isl != null) "--with-isl=${isl}"} 327 ${optionalString (cloog != null) "--with-cloog=${cloog} --disable-cloog-version-check --enable-cloog-backend=isl"} 328 ${if langJava then ··· 403 configureFlags = '' 404 ${if enableMultilib then "" else "--disable-multilib"} 405 ${if enableShared then "" else "--disable-shared"} 406 - ${if ppl != null then "--with-ppl=${ppl.crossDrv}" else ""} 407 ${if cloog != null then "--with-cloog=${cloog.crossDrv} --enable-cloog-backend=isl" else ""} 408 ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} 409 ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} ··· 510 511 maintainers = with stdenv.lib.maintainers; [ ludo viric shlevy simons ]; 512 513 - # Volunteers needed for the {Cyg,Dar}win ports of *PPL. 514 # gnatboot is not available out of linux platforms, so we disable the darwin build 515 # for the gnat (ada compiler). 516 platforms =
··· 11 , perl ? null # optional, for texi2pod (then pod2man); required for Java 12 , gmp, mpfr, mpc, gettext, which 13 , libelf # optional, for link-time optimizations (LTO) 14 + , cloog ? null, isl ? null # optional, for the Graphite optimization framework. 15 , zlib ? null, boehmgc ? null 16 , zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null 17 , libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null ··· 57 # Whether building a cross-compiler for GNU/Hurd. 58 crossGNU = cross != null && cross.config == "i586-pc-gnu"; 59 60 + enableParallelBuilding = true; 61 62 patches = [ ] 63 ++ optional enableParallelBuilding ./parallel-bconfig.patch ··· 273 ++ (optional javaAwtGtk pkgconfig); 274 275 buildInputs = [ gmp mpfr mpc libelf ] 276 ++ (optional (cloog != null) cloog) 277 ++ (optional (isl != null) isl) 278 ++ (optional (zlib != null) zlib) ··· 290 NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; 291 292 preConfigure = '' 293 ${stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) 294 '' 295 export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g` ··· 311 ${if enableMultilib then "--disable-libquadmath" else "--disable-multilib"} 312 ${if enableShared then "" else "--disable-shared"} 313 ${if enablePlugin then "--enable-plugin" else "--disable-plugin"} 314 ${optionalString (isl != null) "--with-isl=${isl}"} 315 ${optionalString (cloog != null) "--with-cloog=${cloog} --disable-cloog-version-check --enable-cloog-backend=isl"} 316 ${if langJava then ··· 391 configureFlags = '' 392 ${if enableMultilib then "" else "--disable-multilib"} 393 ${if enableShared then "" else "--disable-shared"} 394 ${if cloog != null then "--with-cloog=${cloog.crossDrv} --enable-cloog-backend=isl" else ""} 395 ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""} 396 ${if javaAwtGtk then "--enable-java-awt=gtk" else ""} ··· 497 498 maintainers = with stdenv.lib.maintainers; [ ludo viric shlevy simons ]; 499 500 # gnatboot is not available out of linux platforms, so we disable the darwin build 501 # for the gnat (ada compiler). 502 platforms =
+4 -4
pkgs/development/compilers/orc/default.nix
··· 1 { stdenv, fetchurl }: 2 3 stdenv.mkDerivation rec { 4 - name = "orc-0.4.19"; 5 6 src = fetchurl { 7 - url = "http://gstreamer.freedesktop.org/src/orc/${name}.tar.gz"; 8 - sha256 = "17mmgwll2waz44m908lcxc5fd6n44yysh7p4pdw33hr138r507z2"; 9 }; 10 11 - doCheck = true; 12 13 meta = { 14 description = "The Oil Runtime Compiler";
··· 1 { stdenv, fetchurl }: 2 3 stdenv.mkDerivation rec { 4 + name = "orc-0.4.21"; 5 6 src = fetchurl { 7 + url = "http://gstreamer.freedesktop.org/src/orc/${name}.tar.xz"; 8 + sha256 = "187wrnq0ficwjj4y3yqci5fxcdkiazfs6k5js26k5b26hipzmham"; 9 }; 10 11 + doCheck = stdenv.is64bit; # see https://bugzilla.gnome.org/show_bug.cgi?id=728129#c7 12 13 meta = { 14 description = "The Oil Runtime Compiler";
+6
pkgs/development/interpreters/perl/5.16/default.nix
··· 54 ${optionalString stdenv.isArm '' 55 configureFlagsArray=(-Dldflags="-lm -lrt") 56 ''} 57 ''; 58 59 preBuild = optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
··· 54 ${optionalString stdenv.isArm '' 55 configureFlagsArray=(-Dldflags="-lm -lrt") 56 ''} 57 + 58 + ${optionalString stdenv.isCygwin '' 59 + cp cygwin/cygwin.c{,.bak} 60 + echo "#define PERLIO_NOT_STDIO 0" > tmp 61 + cat tmp cygwin/cygwin.c.bak > cygwin/cygwin.c 62 + ''} 63 ''; 64 65 preBuild = optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
+2
pkgs/development/libraries/cloog/default.nix
··· 14 15 configureFlags = [ "--with-isl=system" ]; 16 17 doCheck = true; 18 19 meta = {
··· 14 15 configureFlags = [ "--with-isl=system" ]; 16 17 + enableParallelBuilding = true; 18 + 19 doCheck = true; 20 21 meta = {
+6 -4
pkgs/development/libraries/glew/default.nix
··· 3 with stdenv.lib; 4 5 stdenv.mkDerivation rec { 6 - name = "glew-1.10.0"; 7 8 src = fetchurl { 9 url = "mirror://sourceforge/glew/${name}.tgz"; 10 - sha256 = "01zki46dr5khzlyywr3cg615bcal32dazfazkf360s1znqh17i4r"; 11 }; 12 13 nativeBuildInputs = [ x11 libXmu libXi ]; ··· 42 ] ++ optional (stdenv.cross.libc == "msvcrt") "SYSTEM=mingw" 43 ++ optional (stdenv.cross.libc == "libSystem") "SYSTEM=darwin"; 44 45 - meta = { 46 description = "An OpenGL extension loading library for C(++)"; 47 homepage = http://glew.sourceforge.net/; 48 - license = ["BSD" "GLX" "SGI-B" "GPL2"]; # License description copied from gentoo-1.4.0 49 }; 50 }
··· 3 with stdenv.lib; 4 5 stdenv.mkDerivation rec { 6 + name = "glew-1.11.0"; 7 8 src = fetchurl { 9 url = "mirror://sourceforge/glew/${name}.tgz"; 10 + sha256 = "1mhkllxz49l1x680dmzrv2i82qjrq017sykah3xc90f2d8qcxfv9"; 11 }; 12 13 nativeBuildInputs = [ x11 libXmu libXi ]; ··· 42 ] ++ optional (stdenv.cross.libc == "msvcrt") "SYSTEM=mingw" 43 ++ optional (stdenv.cross.libc == "libSystem") "SYSTEM=darwin"; 44 45 + meta = with stdenv.lib; { 46 description = "An OpenGL extension loading library for C(++)"; 47 homepage = http://glew.sourceforge.net/; 48 + license = licenses.free; # different files under different licenses 49 + #["BSD" "GLX" "SGI-B" "GPL2"] 50 + platforms = platforms.mesaPlatforms; 51 }; 52 }
+1
pkgs/development/libraries/glibc/2.19/common.nix
··· 60 ./fix-math.patch 61 62 ./cve-2014-0475.patch 63 ]; 64 65 postPatch = ''
··· 60 ./fix-math.patch 61 62 ./cve-2014-0475.patch 63 + ./cve-2014-5119.patch 64 ]; 65 66 postPatch = ''
+206
pkgs/development/libraries/glibc/2.19/cve-2014-5119.patch
···
··· 1 + http://anonscm.debian.org/viewvc/pkg-glibc/glibc-package/trunk/debian/patches/any/cvs-CVE-2014-5119.diff?revision=6248&view=co 2 + 3 + commit a1a6a401ab0a3c9f15fb7eaebbdcee24192254e8 4 + Author: Florian Weimer <fweimer@redhat.com> 5 + Date: Tue Aug 26 19:38:59 2014 +0200 6 + 7 + __gconv_translit_find: Disable function [BZ #17187] 8 + 9 + This functionality has never worked correctly, and the implementation 10 + contained a security vulnerability (CVE-2014-5119). 11 + 12 + 2014-08-26 Florian Weimer <fweimer@redhat.com> 13 + 14 + [BZ #17187] 15 + * iconv/gconv_trans.c (struct known_trans, search_tree, lock, 16 + trans_compare, open_translit, __gconv_translit_find): 17 + Remove module loading code. 18 + 19 + --- a/iconv/gconv_trans.c 20 + +++ b/iconv/gconv_trans.c 21 + @@ -238,181 +238,12 @@ __gconv_transliterate (struct __gconv_step *step, 22 + return __GCONV_ILLEGAL_INPUT; 23 + } 24 + 25 + - 26 + -/* Structure to represent results of found (or not) transliteration 27 + - modules. */ 28 + -struct known_trans 29 + -{ 30 + - /* This structure must remain the first member. */ 31 + - struct trans_struct info; 32 + - 33 + - char *fname; 34 + - void *handle; 35 + - int open_count; 36 + -}; 37 + - 38 + - 39 + -/* Tree with results of previous calls to __gconv_translit_find. */ 40 + -static void *search_tree; 41 + - 42 + -/* We modify global data. */ 43 + -__libc_lock_define_initialized (static, lock); 44 + - 45 + - 46 + -/* Compare two transliteration entries. */ 47 + -static int 48 + -trans_compare (const void *p1, const void *p2) 49 + -{ 50 + - const struct known_trans *s1 = (const struct known_trans *) p1; 51 + - const struct known_trans *s2 = (const struct known_trans *) p2; 52 + - 53 + - return strcmp (s1->info.name, s2->info.name); 54 + -} 55 + - 56 + - 57 + -/* Open (maybe reopen) the module named in the struct. Get the function 58 + - and data structure pointers we need. */ 59 + -static int 60 + -open_translit (struct known_trans *trans) 61 + -{ 62 + - __gconv_trans_query_fct queryfct; 63 + - 64 + - trans->handle = __libc_dlopen (trans->fname); 65 + - if (trans->handle == NULL) 66 + - /* Not available. */ 67 + - return 1; 68 + - 69 + - /* Find the required symbol. */ 70 + - queryfct = __libc_dlsym (trans->handle, "gconv_trans_context"); 71 + - if (queryfct == NULL) 72 + - { 73 + - /* We cannot live with that. */ 74 + - close_and_out: 75 + - __libc_dlclose (trans->handle); 76 + - trans->handle = NULL; 77 + - return 1; 78 + - } 79 + - 80 + - /* Get the context. */ 81 + - if (queryfct (trans->info.name, &trans->info.csnames, &trans->info.ncsnames) 82 + - != 0) 83 + - goto close_and_out; 84 + - 85 + - /* Of course we also have to have the actual function. */ 86 + - trans->info.trans_fct = __libc_dlsym (trans->handle, "gconv_trans"); 87 + - if (trans->info.trans_fct == NULL) 88 + - goto close_and_out; 89 + - 90 + - /* Now the optional functions. */ 91 + - trans->info.trans_init_fct = 92 + - __libc_dlsym (trans->handle, "gconv_trans_init"); 93 + - trans->info.trans_context_fct = 94 + - __libc_dlsym (trans->handle, "gconv_trans_context"); 95 + - trans->info.trans_end_fct = 96 + - __libc_dlsym (trans->handle, "gconv_trans_end"); 97 + - 98 + - trans->open_count = 1; 99 + - 100 + - return 0; 101 + -} 102 + - 103 + - 104 + int 105 + internal_function 106 + __gconv_translit_find (struct trans_struct *trans) 107 + { 108 + - struct known_trans **found; 109 + - const struct path_elem *runp; 110 + - int res = 1; 111 + - 112 + - /* We have to have a name. */ 113 + - assert (trans->name != NULL); 114 + - 115 + - /* Acquire the lock. */ 116 + - __libc_lock_lock (lock); 117 + - 118 + - /* See whether we know this module already. */ 119 + - found = __tfind (trans, &search_tree, trans_compare); 120 + - if (found != NULL) 121 + - { 122 + - /* Is this module available? */ 123 + - if ((*found)->handle != NULL) 124 + - { 125 + - /* Maybe we have to reopen the file. */ 126 + - if ((*found)->handle != (void *) -1) 127 + - /* The object is not unloaded. */ 128 + - res = 0; 129 + - else if (open_translit (*found) == 0) 130 + - { 131 + - /* Copy the data. */ 132 + - *trans = (*found)->info; 133 + - (*found)->open_count++; 134 + - res = 0; 135 + - } 136 + - } 137 + - } 138 + - else 139 + - { 140 + - size_t name_len = strlen (trans->name) + 1; 141 + - int need_so = 0; 142 + - struct known_trans *newp; 143 + - 144 + - /* We have to continue looking for the module. */ 145 + - if (__gconv_path_elem == NULL) 146 + - __gconv_get_path (); 147 + - 148 + - /* See whether we have to append .so. */ 149 + - if (name_len <= 4 || memcmp (&trans->name[name_len - 4], ".so", 3) != 0) 150 + - need_so = 1; 151 + - 152 + - /* Create a new entry. */ 153 + - newp = (struct known_trans *) malloc (sizeof (struct known_trans) 154 + - + (__gconv_max_path_elem_len 155 + - + name_len + 3) 156 + - + name_len); 157 + - if (newp != NULL) 158 + - { 159 + - char *cp; 160 + - 161 + - /* Clear the struct. */ 162 + - memset (newp, '\0', sizeof (struct known_trans)); 163 + - 164 + - /* Store a copy of the module name. */ 165 + - newp->info.name = cp = (char *) (newp + 1); 166 + - cp = __mempcpy (cp, trans->name, name_len); 167 + - 168 + - newp->fname = cp; 169 + - 170 + - /* Search in all the directories. */ 171 + - for (runp = __gconv_path_elem; runp->name != NULL; ++runp) 172 + - { 173 + - cp = __mempcpy (__stpcpy ((char *) newp->fname, runp->name), 174 + - trans->name, name_len); 175 + - if (need_so) 176 + - memcpy (cp, ".so", sizeof (".so")); 177 + - 178 + - if (open_translit (newp) == 0) 179 + - { 180 + - /* We found a module. */ 181 + - res = 0; 182 + - break; 183 + - } 184 + - } 185 + - 186 + - if (res) 187 + - newp->fname = NULL; 188 + - 189 + - /* In any case we'll add the entry to our search tree. */ 190 + - if (__tsearch (newp, &search_tree, trans_compare) == NULL) 191 + - { 192 + - /* Yickes, this should not happen. Unload the object. */ 193 + - res = 1; 194 + - /* XXX unload here. */ 195 + - } 196 + - } 197 + - } 198 + - 199 + - __libc_lock_unlock (lock); 200 + - 201 + - return res; 202 + + /* Transliteration module loading has been removed because it never 203 + + worked as intended and suffered from a security vulnerability. 204 + + Consequently, this function always fails. */ 205 + + return 1; 206 + }
+25
pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch
···
··· 1 + --- ./giscanner/utils.py.orig 2014-08-14 22:05:05.055334080 +0200 2 + +++ ./giscanner/utils.py 2014-08-14 22:05:24.687497334 +0200 3 + @@ -110,17 +110,11 @@ 4 + if dlname is None: 5 + return None 6 + 7 + - # Darwin uses absolute paths where possible; since the libtool files never 8 + - # contain absolute paths, use the libdir field 9 + - if platform.system() == 'Darwin': 10 + - dlbasename = os.path.basename(dlname) 11 + - libdir = _extract_libdir_field(la_file) 12 + - if libdir is None: 13 + - return dlbasename 14 + - return libdir + '/' + dlbasename 15 + - # From the comments in extract_libtool(), older libtools had 16 + - # a path rather than the raw dlname 17 + - return os.path.basename(dlname) 18 + + dlbasename = os.path.basename(dlname) 19 + + libdir = _extract_libdir_field(la_file) 20 + + if libdir is None: 21 + + return dlbasename 22 + + return libdir + '/' + dlbasename 23 + 24 + 25 + def extract_libtool(la_file):
+2
pkgs/development/libraries/gobject-introspection/default.nix
··· 29 30 setupHook = ./setup-hook.sh; 31 32 meta = with stdenv.lib; { 33 description = "A middleware layer between C libraries and language bindings"; 34 homepage = http://live.gnome.org/GObjectIntrospection;
··· 29 30 setupHook = ./setup-hook.sh; 31 32 + patches = [ ./absolute_shlib_path.patch ]; 33 + 34 meta = with stdenv.lib; { 35 description = "A middleware layer between C libraries and language bindings"; 36 homepage = http://live.gnome.org/GObjectIntrospection;
+3 -3
pkgs/development/libraries/gstreamer/bad/default.nix
··· 1 { stdenv, fetchurl, pkgconfig, python, gst-plugins-base, orc 2 , faacSupport ? false, faac ? null 3 , faad2, libass, libkate, libmms 4 - , libmodplug, mpeg2dec, mpg123 5 , openjpeg, libopus, librsvg 6 , wildmidi, fluidsynth, libvdpau, wayland 7 , libwebp, xvidcore, gnutls ··· 10 assert faacSupport -> faac != null; 11 12 stdenv.mkDerivation rec { 13 - name = "gst-plugins-bad-1.4.0"; 14 15 meta = with stdenv.lib; { 16 description = "Gstreamer Bad Plugins"; ··· 28 29 src = fetchurl { 30 url = "${meta.homepage}/src/gst-plugins-bad/${name}.tar.xz"; 31 - sha256 = "1y821785rvr6s79cmdll66hg6h740qa2n036xid20nvjyxabfb7z"; 32 }; 33 34 nativeBuildInputs = [ pkgconfig python ];
··· 1 { stdenv, fetchurl, pkgconfig, python, gst-plugins-base, orc 2 , faacSupport ? false, faac ? null 3 , faad2, libass, libkate, libmms 4 + , libmodplug, mpeg2dec, mpg123 5 , openjpeg, libopus, librsvg 6 , wildmidi, fluidsynth, libvdpau, wayland 7 , libwebp, xvidcore, gnutls ··· 10 assert faacSupport -> faac != null; 11 12 stdenv.mkDerivation rec { 13 + name = "gst-plugins-bad-1.4.1"; 14 15 meta = with stdenv.lib; { 16 description = "Gstreamer Bad Plugins"; ··· 28 29 src = fetchurl { 30 url = "${meta.homepage}/src/gst-plugins-bad/${name}.tar.xz"; 31 + sha256 = "0268db2faaf0bb22e5b709a11633abbca4f3d289b1f513bb262d0bf3f53e19ae"; 32 }; 33 34 nativeBuildInputs = [ pkgconfig python ];
+2 -2
pkgs/development/libraries/gstreamer/base/default.nix
··· 4 }: 5 6 stdenv.mkDerivation rec { 7 - name = "gst-plugins-base-1.4.0"; 8 9 meta = { 10 description = "Base plugins and helper libraries"; ··· 16 17 src = fetchurl { 18 url = "${meta.homepage}/src/gst-plugins-base/${name}.tar.xz"; 19 - sha256 = "07jcs08hjyban0amls5s0g6i4a1hwiir1llwpqzlwkmnhfwx9bjx"; 20 }; 21 22 nativeBuildInputs = [
··· 4 }: 5 6 stdenv.mkDerivation rec { 7 + name = "gst-plugins-base-1.4.1"; 8 9 meta = { 10 description = "Base plugins and helper libraries"; ··· 16 17 src = fetchurl { 18 url = "${meta.homepage}/src/gst-plugins-base/${name}.tar.xz"; 19 + sha256 = "aea9e25be6691bd3cc0785d005b2b5d70ce313a2c897901680a3f7e7cab5a499"; 20 }; 21 22 nativeBuildInputs = [
+3 -3
pkgs/development/libraries/gstreamer/core/default.nix
··· 1 { stdenv, fetchurl, pkgconfig, perl, bison, flex, python, gobjectIntrospection 2 - , glib 3 }: 4 5 stdenv.mkDerivation rec { 6 - name = "gstreamer-1.4.0"; 7 8 meta = { 9 description = "Open source multimedia framework"; ··· 15 16 src = fetchurl { 17 url = "${meta.homepage}/src/gstreamer/${name}.tar.xz"; 18 - sha256 = "15f68pn2b47x543ih7hj59czgzl4af14j15bgjq8ky145gf9zhr3"; 19 }; 20 21 nativeBuildInputs = [
··· 1 { stdenv, fetchurl, pkgconfig, perl, bison, flex, python, gobjectIntrospection 2 + , glib 3 }: 4 5 stdenv.mkDerivation rec { 6 + name = "gstreamer-1.4.1"; 7 8 meta = { 9 description = "Open source multimedia framework"; ··· 15 16 src = fetchurl { 17 url = "${meta.homepage}/src/gstreamer/${name}.tar.xz"; 18 + sha256 = "5638f75003282135815c0077d491da11e9a884ad91d4ba6ab3cc78bae0fb452e"; 19 }; 20 21 nativeBuildInputs = [
+2 -2
pkgs/development/libraries/gstreamer/good/default.nix
··· 7 }: 8 9 stdenv.mkDerivation rec { 10 - name = "gst-plugins-good-1.4.0"; 11 12 meta = with stdenv.lib; { 13 description = "Gstreamer Good Plugins"; ··· 24 25 src = fetchurl { 26 url = "${meta.homepage}/src/gst-plugins-good/${name}.tar.xz"; 27 - sha256 = "11965w4zr0jvrsnw33rbcc8d20dlh368rz0x16d2iypzhxwjx9j8"; 28 }; 29 30 nativeBuildInputs = [ pkgconfig python ];
··· 7 }: 8 9 stdenv.mkDerivation rec { 10 + name = "gst-plugins-good-1.4.1"; 11 12 meta = with stdenv.lib; { 13 description = "Gstreamer Good Plugins"; ··· 24 25 src = fetchurl { 26 url = "${meta.homepage}/src/gst-plugins-good/${name}.tar.xz"; 27 + sha256 = "8559d4270065b30ed5c49b826e1b7a3a2bd5ee9a340ae745a2ae3f9718e4c637"; 28 }; 29 30 nativeBuildInputs = [ pkgconfig python ];
+2 -2
pkgs/development/libraries/gstreamer/libav/default.nix
··· 6 assert withSystemLibav -> libav != null; 7 8 stdenv.mkDerivation rec { 9 - name = "gst-libav-1.4.0"; 10 11 meta = { 12 homepage = "http://gstreamer.freedesktop.org"; ··· 17 18 src = fetchurl { 19 url = "${meta.homepage}/src/gst-libav/${name}.tar.xz"; 20 - sha256 = "1073p7xdpr3pwyx37fnldfni908apnq3k9fbqmxf5wk3g1jplb68"; 21 }; 22 23 configureFlags = stdenv.lib.optionalString withSystemLibav
··· 6 assert withSystemLibav -> libav != null; 7 8 stdenv.mkDerivation rec { 9 + name = "gst-libav-1.4.1"; 10 11 meta = { 12 homepage = "http://gstreamer.freedesktop.org"; ··· 17 18 src = fetchurl { 19 url = "${meta.homepage}/src/gst-libav/${name}.tar.xz"; 20 + sha256 = "fc125521187fa84f3210269a0eecc51f8a856802f1ca4bb251f118dab90c5a9d"; 21 }; 22 23 configureFlags = stdenv.lib.optionalString withSystemLibav
+2 -2
pkgs/development/libraries/gstreamer/ugly/default.nix
··· 5 }: 6 7 stdenv.mkDerivation rec { 8 - name = "gst-plugins-ugly-1.4.0"; 9 10 meta = with stdenv.lib; { 11 description = "Gstreamer Ugly Plugins"; ··· 23 24 src = fetchurl { 25 url = "${meta.homepage}/src/gst-plugins-ugly/${name}.tar.xz"; 26 - sha256 = "0kblc5f4n0mh2sw8dhf7c9dg3wzm7a0p7pqpcff7n6ixy5hbn52k"; 27 }; 28 29 nativeBuildInputs = [ pkgconfig python ];
··· 5 }: 6 7 stdenv.mkDerivation rec { 8 + name = "gst-plugins-ugly-1.4.1"; 9 10 meta = with stdenv.lib; { 11 description = "Gstreamer Ugly Plugins"; ··· 23 24 src = fetchurl { 25 url = "${meta.homepage}/src/gst-plugins-ugly/${name}.tar.xz"; 26 + sha256 = "25440435ac4ed795d213f2420a0e7355e4a2e2e76d1f9d020b2073f815e8b071"; 27 }; 28 29 nativeBuildInputs = [ pkgconfig python ];
+2 -2
pkgs/development/libraries/harfbuzz/default.nix
··· 8 # (icu is a ~30 MB dependency, the rest is very small in comparison) 9 10 stdenv.mkDerivation rec { 11 - name = "harfbuzz-0.9.33"; 12 13 src = fetchurl { 14 url = "http://www.freedesktop.org/software/harfbuzz/release/${name}.tar.bz2"; 15 - sha256 = "1iql2ghlndqgx9q6p098xf253rjz5rnrv5qniwgd1b5q0jzwa4yk"; 16 }; 17 18 configureFlags = [
··· 8 # (icu is a ~30 MB dependency, the rest is very small in comparison) 9 10 stdenv.mkDerivation rec { 11 + name = "harfbuzz-0.9.35"; 12 13 src = fetchurl { 14 url = "http://www.freedesktop.org/software/harfbuzz/release/${name}.tar.bz2"; 15 + sha256 = "1v86596994bnb9hx7laykhw4ipixqz9ckwzyyqf340pmlsmsi88a"; 16 }; 17 18 configureFlags = [
+2
pkgs/development/libraries/isl/0.12.2.nix
··· 10 11 buildInputs = [ gmp ]; 12 13 meta = { 14 homepage = http://www.kotnet.org/~skimo/isl/; 15 license = stdenv.lib.licenses.lgpl21;
··· 10 11 buildInputs = [ gmp ]; 12 13 + enableParallelBuilding = true; 14 + 15 meta = { 16 homepage = http://www.kotnet.org/~skimo/isl/; 17 license = stdenv.lib.licenses.lgpl21;
+2
pkgs/development/libraries/isl/default.nix
··· 11 buildInputs = [ gmp ]; 12 patches = [ ./fix-gcc-build.diff ]; 13 14 meta = { 15 homepage = http://www.kotnet.org/~skimo/isl/; 16 license = stdenv.lib.licenses.lgpl21;
··· 11 buildInputs = [ gmp ]; 12 patches = [ ./fix-gcc-build.diff ]; 13 14 + enableParallelBuilding = true; 15 + 16 meta = { 17 homepage = http://www.kotnet.org/~skimo/isl/; 18 license = stdenv.lib.licenses.lgpl21;
+1 -1
pkgs/development/libraries/libav/default.nix
··· 28 result = { 29 libav_0_8 = libavFun "0.8.13" "1fr3rzykrlm1cla0csm9hqa3gcqp19hf5rgn70nyb9w92r67v685"; 30 libav_9 = libavFun "9.16" "18378gdgzqsxaacc9vl7ligwndbdvy95wbn50hs8xvdqn1rn916a"; 31 - libav_10 = libavFun "10.3" "1fq83rc5534fjqjlhkw5i9k54dmyqn2pgvyillm6pws8rkn9yb5r"; 32 }; 33 34 libavFun = version : sha256 : stdenv.mkDerivation rec {
··· 28 result = { 29 libav_0_8 = libavFun "0.8.13" "1fr3rzykrlm1cla0csm9hqa3gcqp19hf5rgn70nyb9w92r67v685"; 30 libav_9 = libavFun "9.16" "18378gdgzqsxaacc9vl7ligwndbdvy95wbn50hs8xvdqn1rn916a"; 31 + libav_10 = libavFun "10.4" "1zzvjfdlv9swhq7dzvli1pk8cn02q1076ax9m3cx9ipilbg21639"; 32 }; 33 34 libavFun = version : sha256 : stdenv.mkDerivation rec {
+3 -3
pkgs/development/libraries/libpng/default.nix
··· 3 assert zlib != null; 4 5 let 6 - version = "1.6.12"; 7 - sha256 = "0pkcirbfzhqqsm3hr2alxprw5n22a836qk4df1jnns6jk79gcby3"; 8 patch_src = fetchurl { 9 url = "mirror://sourceforge/libpng-apng/libpng-${version}-apng.patch.gz"; 10 - sha256 = "0r2vmsc4cvxisjr7jqw2vjf66isb2fhs4nnssz3l3jgdangj8wz0"; 11 }; 12 whenPatched = stdenv.lib.optionalString apngSupport; 13
··· 3 assert zlib != null; 4 5 let 6 + version = "1.6.13"; 7 + sha256 = "09g631h1f1xvrdiy36mh1034r9w46damp9jcg7nm507wlmacxj6r"; 8 patch_src = fetchurl { 9 url = "mirror://sourceforge/libpng-apng/libpng-${version}-apng.patch.gz"; 10 + sha256 = "017pnxp3zhhlh6mg2yqn5xrb6dcxc5p3dp1kr46p8xx052i0hzqb"; 11 }; 12 whenPatched = stdenv.lib.optionalString apngSupport; 13
+2 -2
pkgs/development/libraries/mesa/default.nix
··· 24 */ 25 26 let 27 - version = "10.2.5"; 28 # this is the default search path for DRI drivers 29 driverLink = "/run/opengl-driver" + stdenv.lib.optionalString stdenv.isi686 "-32"; 30 in ··· 35 36 src = fetchurl { 37 url = "ftp://ftp.freedesktop.org/pub/mesa/${version}/MesaLib-${version}.tar.bz2"; 38 - sha256 = "039is15p8pkhf8m0yiyb72zybl63xb9ckqzcg3xwi8zlyw5ryidl"; 39 }; 40 41 prePatch = "patchShebangs .";
··· 24 */ 25 26 let 27 + version = "10.2.6"; 28 # this is the default search path for DRI drivers 29 driverLink = "/run/opengl-driver" + stdenv.lib.optionalString stdenv.isi686 "-32"; 30 in ··· 35 36 src = fetchurl { 37 url = "ftp://ftp.freedesktop.org/pub/mesa/${version}/MesaLib-${version}.tar.bz2"; 38 + sha256 = "01n8ib190s12m8hiiyi4wfm9jhkbqjd769npjwvf965smp918cqr"; 39 }; 40 41 prePatch = "patchShebangs .";
+6 -1
pkgs/development/libraries/openssl/default.nix
··· 60 else "./config"; 61 62 configureFlags = "shared --libdir=lib --openssldir=etc/ssl" + 63 - stdenv.lib.optionalString withCryptodev " -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS"; 64 65 makeFlags = "MANDIR=$(out)/share/man"; 66
··· 60 else "./config"; 61 62 configureFlags = "shared --libdir=lib --openssldir=etc/ssl" + 63 + stdenv.lib.optionalString withCryptodev " -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS" + 64 + stdenv.lib.optionalString (stdenv.system == "x86_64-cygwin") " no-asm"; 65 + 66 + preBuild = stdenv.lib.optionalString (stdenv.system == "x86_64-cygwin") '' 67 + sed -i -e "s|-march=i486|-march=x86-64|g" Makefile 68 + ''; 69 70 makeFlags = "MANDIR=$(out)/share/man"; 71
+2 -2
pkgs/development/libraries/pcre/default.nix
··· 5 with stdenv.lib; 6 7 stdenv.mkDerivation rec { 8 - name = "pcre-8.34"; 9 10 src = fetchurl { 11 url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${name}.tar.bz2"; 12 - sha256 = "0gsqmsp0q0n3q0ba32gkjvgcsdy6nwidqa7sbxkbw817zzhkl15n"; 13 }; 14 15 # The compiler on Darwin crashes with an internal error while building the
··· 5 with stdenv.lib; 6 7 stdenv.mkDerivation rec { 8 + name = "pcre-8.35"; 9 10 src = fetchurl { 11 url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${name}.tar.bz2"; 12 + sha256 = "0nw66r92dr24vy9k4lw17bkv8x5nlzn6wx9hq4y2dvzgig3w2qd9"; 13 }; 14 15 # The compiler on Darwin crashes with an internal error while building the
-10
pkgs/development/libraries/readline/readline4.nix
··· 1 - { stdenv, fetchurl, ncurses }: 2 - 3 - stdenv.mkDerivation { 4 - name = "readline-4.3"; 5 - src = fetchurl { 6 - url = mirror://gnu/readline/readline-4.3.tar.gz; 7 - md5 = "f86f7cb717ab321fe15f1bbcb058c11e"; 8 - }; 9 - propagatedBuildInputs = [ncurses]; 10 - }
···
+4 -3
pkgs/development/libraries/readline/readline5.nix
··· 2 3 stdenv.mkDerivation { 4 name = "readline-5.2"; 5 - 6 src = fetchurl { 7 url = mirror://gnu/readline/readline-5.2.tar.gz; 8 sha256 = "0icz4hqqq8mlkwrpczyaha94kns0am9z0mh3a2913kg2msb8vs0j"; 9 }; 10 - 11 propagatedBuildInputs = [ncurses]; 12 - 13 patches = stdenv.lib.optional stdenv.isDarwin ./shobj-darwin.patch; 14 }
··· 2 3 stdenv.mkDerivation { 4 name = "readline-5.2"; 5 + 6 src = fetchurl { 7 url = mirror://gnu/readline/readline-5.2.tar.gz; 8 sha256 = "0icz4hqqq8mlkwrpczyaha94kns0am9z0mh3a2913kg2msb8vs0j"; 9 }; 10 + 11 propagatedBuildInputs = [ncurses]; 12 + 13 patches = stdenv.lib.optional stdenv.isDarwin ./shobj-darwin.patch; 14 } 15 +
+12 -8
pkgs/development/libraries/readline/readline6.3.nix
··· 1 - { fetchurl, stdenv, ncurses }: 2 3 stdenv.mkDerivation (rec { 4 - name = "readline-6.3"; 5 6 - src = fetchurl { 7 - url = "mirror://gnu/readline/${name}.tar.gz"; 8 - sha256 = "0hzxr9jxqqx5sxsv9vmlxdnvlr9vi4ih1avjb869hbs6p5qn1fjn"; 9 }; 10 11 propagatedBuildInputs = [ncurses]; ··· 17 ./no-arch_only-6.3.patch 18 ]; 19 20 - meta = { 21 description = "Library for interactive line editing"; 22 23 longDescription = '' ··· 37 38 homepage = http://savannah.gnu.org/projects/readline/; 39 40 - license = stdenv.lib.licenses.gpl3Plus; 41 42 - maintainers = [ stdenv.lib.maintainers.ludo ]; 43 }; 44 } 45
··· 1 + { fetchzip, stdenv, ncurses }: 2 3 stdenv.mkDerivation (rec { 4 + name = "readline-6.3p08"; 5 6 + src = fetchzip { 7 + #url = "mirror://gnu/readline/${name}.tar.gz"; 8 + url = "http://git.savannah.gnu.org/cgit/readline.git/snapshot/" 9 + + "readline-a73b98f779b388a5d0624e02e8bb187246e3e396.tar.gz"; 10 + sha256 = "19ji3wrv4fs79fd0nkacjy9q94pvy2cm66yb3aqysahg0cbrz5l1"; 11 }; 12 13 propagatedBuildInputs = [ncurses]; ··· 19 ./no-arch_only-6.3.patch 20 ]; 21 22 + meta = with stdenv.lib; { 23 description = "Library for interactive line editing"; 24 25 longDescription = '' ··· 39 40 homepage = http://savannah.gnu.org/projects/readline/; 41 42 + license = licenses.gpl3Plus; 43 44 + maintainers = [ maintainers.ludo ]; 45 + 46 + platforms = platforms.unix; 47 }; 48 } 49
+2 -6
pkgs/development/libraries/serf/default.nix
··· 1 { stdenv, fetchurl, apr, scons, openssl, aprutil, zlib, krb5, pkgconfig }: 2 3 stdenv.mkDerivation rec { 4 - version = "1.3.7"; 5 - name = "serf-${version}"; 6 7 src = fetchurl { 8 url = "http://serf.googlecode.com/svn/src_releases/${name}.tar.bz2"; ··· 28 29 meta = { 30 description = "HTTP client library based on APR"; 31 - license = stdenv.lib.licenses.asl20 ; 32 maintainers = [stdenv.lib.maintainers.raskin]; 33 hydraPlatforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin; 34 - inherit version; 35 - downloadPage = "http://serf.googlecode.com/svn/src_releases/"; 36 - updateWalker = true; 37 }; 38 }
··· 1 { stdenv, fetchurl, apr, scons, openssl, aprutil, zlib, krb5, pkgconfig }: 2 3 stdenv.mkDerivation rec { 4 + name = "serf-1.3.7"; 5 6 src = fetchurl { 7 url = "http://serf.googlecode.com/svn/src_releases/${name}.tar.bz2"; ··· 27 28 meta = { 29 description = "HTTP client library based on APR"; 30 + license = stdenv.lib.licenses.asl20; 31 maintainers = [stdenv.lib.maintainers.raskin]; 32 hydraPlatforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin; 33 }; 34 }
-1
pkgs/development/tools/misc/d-feet/default.nix
··· 26 wrapProgram $out/bin/d-feet \ 27 --prefix PYTHONPATH : "$(toPythonPath $out):$(toPythonPath ${pygobject3})" \ 28 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 29 - --prefix LD_LIBRARY_PATH : "${gtk3}/lib:${atk}/lib:${libwnck3}/lib" \ 30 --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$out/share" 31 32 rm $out/share/icons/hicolor/icon-theme.cache
··· 26 wrapProgram $out/bin/d-feet \ 27 --prefix PYTHONPATH : "$(toPythonPath $out):$(toPythonPath ${pygobject3})" \ 28 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ 29 --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$out/share" 30 31 rm $out/share/icons/hicolor/icon-theme.cache
+1 -1
pkgs/development/tools/misc/swig/default.nix
··· 12 # 'make check' uses boost and tcl 13 buildInputs = stdenv.lib.optionals doCheck [ boost tcl ]; 14 15 - configureFlags = stdenv.lib.optionalString stdenv.isDarwin "--disable-ccache"; 16 17 meta = { 18 description = "Interface compiler that connects C/C++ code to higher-level languages";
··· 12 # 'make check' uses boost and tcl 13 buildInputs = stdenv.lib.optionals doCheck [ boost tcl ]; 14 15 + configureFlags = "--disable-ccache"; 16 17 meta = { 18 description = "Interface compiler that connects C/C++ code to higher-level languages";
+2
pkgs/games/spring/default.nix
··· 28 # reported upstream http://springrts.com/mantis/view.php?id=4305 29 #enableParallelBuilding = true; # occasionally missing generated files on Hydra 30 31 postInstall = '' 32 wrapProgram "$out/bin/spring" \ 33 --prefix LD_LIBRARY_PATH : "${stdenv.gcc.gcc}/lib64:${stdenv.gcc.gcc}/lib::${systemd}/lib"
··· 28 # reported upstream http://springrts.com/mantis/view.php?id=4305 29 #enableParallelBuilding = true; # occasionally missing generated files on Hydra 30 31 + NIX_CFLAGS_COMPILE = "-fpermissive"; # GL header minor incompatibility 32 + 33 postInstall = '' 34 wrapProgram "$out/bin/spring" \ 35 --prefix LD_LIBRARY_PATH : "${stdenv.gcc.gcc}/lib64:${stdenv.gcc.gcc}/lib::${systemd}/lib"
+8 -4
pkgs/games/warzone2100/default.nix
··· 28 --replace "which %s" "${which}/bin/which %s" 29 ''; 30 configureFlags = "--with-backend=qt --with-distributor=NixOS"; 31 postInstall = [] 32 ++ stdenv.lib.optional withVideos "cp ${sequences_src} $out/share/warzone2100/sequences.wz"; 33 - meta = { 34 description = "A free RTS game, originally developed by Pumpkin Studios"; 35 longDescription = '' 36 Warzone 2100 is an open source real-time strategy and real-time tactics ··· 44 variety of possible units and tactics. 45 ''; 46 homepage = http://wz2100.net; 47 - license = [ "GPLv2+" ]; 48 - maintainers = with stdenv.lib.maintainers; [ astsmtl ]; 49 - platforms = with stdenv.lib.platforms; linux; 50 }; 51 }
··· 28 --replace "which %s" "${which}/bin/which %s" 29 ''; 30 configureFlags = "--with-backend=qt --with-distributor=NixOS"; 31 + 32 + NIX_CFLAGS_COMPILE = "-fpermissive"; # GL header minor incompatibility 33 + 34 postInstall = [] 35 ++ stdenv.lib.optional withVideos "cp ${sequences_src} $out/share/warzone2100/sequences.wz"; 36 + 37 + meta = with stdenv.lib; { 38 description = "A free RTS game, originally developed by Pumpkin Studios"; 39 longDescription = '' 40 Warzone 2100 is an open source real-time strategy and real-time tactics ··· 48 variety of possible units and tactics. 49 ''; 50 homepage = http://wz2100.net; 51 + license = licenses.gpl2Plus; 52 + maintainers = [ maintainers.astsmtl ]; 53 + platforms = platforms.linux; 54 }; 55 }
+2464 -12
pkgs/os-specific/linux/systemd/fixes.patch
··· 1 diff --git a/Makefile.am b/Makefile.am 2 - index 3d9e5c1..4d43cb4 100644 3 --- a/Makefile.am 4 +++ b/Makefile.am 5 @@ -1707,7 +1707,9 @@ dist_tmpfiles_DATA += \ 6 endif 7 ··· 13 systemd-tmpfiles-setup.service 14 15 dist_zshcompletion_DATA += \ 16 diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in 17 - index db72373..2fc12ca 100644 18 --- a/rules/99-systemd.rules.in 19 +++ b/rules/99-systemd.rules.in 20 @@ -14,10 +14,6 @@ KERNEL=="vport*", TAG+="systemd" ··· 28 # Ignore raid devices that are not yet assembled and started 29 SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", ENV{SYSTEMD_READY}="0" 30 SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0" 31 diff --git a/src/core/main.c b/src/core/main.c 32 - index 41605ee..8517369 100644 33 --- a/src/core/main.c 34 +++ b/src/core/main.c 35 - @@ -1883,7 +1883,7 @@ finish: 36 char_array_0(sfd); 37 38 i = 0; ··· 41 if (switch_root_dir) 42 args[i++] = "--switched-root"; 43 args[i++] = arg_running_as == SYSTEMD_SYSTEM ? "--system" : "--user"; 44 diff --git a/src/core/service.c b/src/core/service.c 45 index ae3695a..6b3aa45 100644 46 --- a/src/core/service.c ··· 58 log_error_unit(UNIT(s)->id, "%s is of type D-Bus but no D-Bus service name has been specified. Refusing.", UNIT(s)->id); 59 return -EINVAL; 60 diff --git a/src/core/socket.c b/src/core/socket.c 61 - index 7c18a2b..eba67d5 100644 62 --- a/src/core/socket.c 63 +++ b/src/core/socket.c 64 @@ -663,16 +663,25 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) { ··· 96 break; 97 } 98 99 diff --git a/src/core/umount.c b/src/core/umount.c 100 index d1258f0..0311812 100644 101 --- a/src/core/umount.c ··· 109 #ifndef HAVE_SPLIT_USR 110 || path_equal(m->path, "/usr") 111 #endif 112 diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c 113 index 18f2aca..2a2b1ea 100644 114 --- a/src/fsck/fsck.c ··· 131 cmdline[i++] = "-a"; 132 cmdline[i++] = "-T"; 133 cmdline[i++] = "-l"; 134 diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c 135 - index 9a9ed9d..9e46e18 100644 136 --- a/src/nspawn/nspawn.c 137 +++ b/src/nspawn/nspawn.c 138 - @@ -2667,6 +2667,7 @@ int main(int argc, char *argv[]) { 139 goto finish; 140 } 141 } else { ··· 143 const char *p; 144 145 p = strappenda(arg_directory, 146 - @@ -2676,6 +2677,7 @@ int main(int argc, char *argv[]) { 147 goto finish; 148 149 } ··· 151 } 152 } else { 153 char template[] = "/tmp/nspawn-root-XXXXXX"; 154 diff --git a/src/nss-myhostname/netlink.c b/src/nss-myhostname/netlink.c 155 index d61ecdf..228a3a4 100644 156 --- a/src/nss-myhostname/netlink.c ··· 166 if (ifaddrmsg->ifa_flags & IFA_F_DEPRECATED) 167 continue; 168 169 diff --git a/src/shared/generator.c b/src/shared/generator.c 170 index 6110303..e679cb1 100644 171 --- a/src/shared/generator.c ··· 179 r = access(checker, X_OK); 180 if (r < 0) { 181 log_warning("Checking was requested for %s, but %s cannot be used: %m", what, checker); 182 diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c 183 - index 0887bc3..6b502ce 100644 184 --- a/src/systemctl/systemctl.c 185 +++ b/src/systemctl/systemctl.c 186 @@ -2561,7 +2561,7 @@ static int start_unit_one( 187 188 log_debug("Adding %s to the set", p); ··· 192 return log_oom(); 193 } 194 195 diff --git a/units/console-getty.service.m4.in b/units/console-getty.service.m4.in 196 index 8ac51a4..cae9fb5 100644 197 --- a/units/console-getty.service.m4.in ··· 294 ExecStart=-/sbin/sulogin 295 ExecStopPost=-@SYSTEMCTL@ --fail --no-block default 296 diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4 297 - index 4ac51e7..86a3b59 100644 298 --- a/units/serial-getty@.service.m4 299 +++ b/units/serial-getty@.service.m4 300 - @@ -22,7 +22,6 @@ Before=getty.target 301 IgnoreOnIsolate=yes 302 303 [Service] 304 -ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM 305 Type=idle 306 Restart=always 307 - RestartSec=0 308 diff --git a/units/sysinit.target b/units/sysinit.target 309 index 8f4fb8f..e0f0147 100644 310 --- a/units/sysinit.target ··· 354 +# journald to stop logging (see 355 +# https://bugs.freedesktop.org/show_bug.cgi?id=56043). 356 +X-RestartIfChanged=no 357 diff --git a/units/systemd-random-seed.service.in b/units/systemd-random-seed.service.in 358 index 1879b2f..9b895b9 100644 359 --- a/units/systemd-random-seed.service.in
··· 1 diff --git a/Makefile.am b/Makefile.am 2 + index 3d9e5c1..46487f6 100644 3 --- a/Makefile.am 4 +++ b/Makefile.am 5 + @@ -1095,7 +1095,7 @@ BUILT_SOURCES += \ 6 + 7 + src/shared/errno-list.txt: 8 + $(AM_V_at)$(MKDIR_P) $(dir $@) 9 + - $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - < /dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+[0-9]/ { print $$2; }' > $@ 10 + + $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - < /dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' > $@ 11 + 12 + src/shared/errno-from-name.gperf: src/shared/errno-list.txt 13 + $(AM_V_at)$(MKDIR_P) $(dir $@) 14 + @@ -1107,7 +1107,7 @@ src/shared/errno-from-name.h: src/shared/errno-from-name.gperf 15 + 16 + src/shared/errno-to-name.h: src/shared/errno-list.txt 17 + $(AM_V_at)$(MKDIR_P) $(dir $@) 18 + - $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' < $< > $@ 19 + + $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' < $< > $@ 20 + 21 + src/shared/af-list.txt: 22 + $(AM_V_at)$(MKDIR_P) $(dir $@) 23 @@ -1707,7 +1707,9 @@ dist_tmpfiles_DATA += \ 24 endif 25 ··· 31 systemd-tmpfiles-setup.service 32 33 dist_zshcompletion_DATA += \ 34 + @@ -1961,6 +1963,7 @@ systemd_cgls_SOURCES = \ 35 + src/cgls/cgls.c 36 + 37 + systemd_cgls_LDADD = \ 38 + + libsystemd-internal.la \ 39 + libsystemd-shared.la 40 + 41 + # ------------------------------------------------------------------------------ 42 + diff --git a/TODO b/TODO 43 + index e2ca1e6..d7efdd5 100644 44 + --- a/TODO 45 + +++ b/TODO 46 + @@ -1,4 +1,6 @@ 47 + Bugfixes: 48 + +* Should systemctl status \* work on all unit types, not just .service? 49 + + 50 + * enabling an instance unit creates a pointless link, and 51 + the unit will be started with getty@getty.service: 52 + $ systemctl enable getty@.service 53 + diff --git a/rules/42-usb-hid-pm.rules b/rules/42-usb-hid-pm.rules 54 + index c675b5b..4c300da 100644 55 + --- a/rules/42-usb-hid-pm.rules 56 + +++ b/rules/42-usb-hid-pm.rules 57 + @@ -12,10 +12,6 @@ ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}!= 58 + ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto" 59 + ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto" 60 + 61 + -# Catch-all for Avocent HID devices. Keyed off interface in order to only 62 + -# trigger on HID class devices. 63 + -ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0624", ATTR{bInterfaceClass}=="03", TEST=="../power/control", ATTR{../power/control}="auto" 64 + - 65 + # Dell DRAC 4 66 + ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="413c", ATTR{idProduct}=="2500", TEST=="power/control", ATTR{power/control}="auto" 67 + 68 diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in 69 + index db72373..2875958 100644 70 --- a/rules/99-systemd.rules.in 71 +++ b/rules/99-systemd.rules.in 72 @@ -14,10 +14,6 @@ KERNEL=="vport*", TAG+="systemd" ··· 80 # Ignore raid devices that are not yet assembled and started 81 SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", ENV{SYSTEMD_READY}="0" 82 SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0" 83 + @@ -43,7 +39,7 @@ SUBSYSTEM=="net", KERNEL!="lo", TAG+="systemd", ENV{SYSTEMD_ALIAS}+="/sys/subsys 84 + SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_ALIAS}+="/sys/subsystem/bluetooth/devices/%k" 85 + 86 + SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_WANTS}+="bluetooth.target" 87 + -ENV{ID_SMARTCARD_READER}=="*?", TAG+="systemd", ENV{SYSTEMD_WANTS}+="smartcard.target" 88 + +ENV{ID_SMARTCARD_READER}=="?*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="smartcard.target" 89 + SUBSYSTEM=="sound", KERNEL=="card*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sound.target" 90 + 91 + SUBSYSTEM=="printer", TAG+="systemd", ENV{SYSTEMD_WANTS}+="printer.target" 92 + diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c 93 + index b8e275d..1840594 100644 94 + --- a/src/cgls/cgls.c 95 + +++ b/src/cgls/cgls.c 96 + @@ -35,6 +35,10 @@ 97 + #include "build.h" 98 + #include "output-mode.h" 99 + #include "fileio.h" 100 + +#include "sd-bus.h" 101 + +#include "bus-util.h" 102 + +#include "bus-error.h" 103 + +#include "unit-name.h" 104 + 105 + static bool arg_no_pager = false; 106 + static bool arg_kernel_threads = false; 107 + @@ -127,6 +131,7 @@ int main(int argc, char *argv[]) { 108 + int r = 0, retval = EXIT_FAILURE; 109 + int output_flags; 110 + char _cleanup_free_ *root = NULL; 111 + + _cleanup_bus_unref_ sd_bus *bus = NULL; 112 + 113 + log_parse_environment(); 114 + log_open(); 115 + @@ -151,6 +156,12 @@ int main(int argc, char *argv[]) { 116 + arg_all * OUTPUT_SHOW_ALL | 117 + (arg_full > 0) * OUTPUT_FULL_WIDTH; 118 + 119 + + r = bus_open_transport(BUS_TRANSPORT_LOCAL, NULL, false, &bus); 120 + + if (r < 0) { 121 + + log_error("Failed to create bus connection: %s", strerror(-r)); 122 + + goto finish; 123 + + } 124 + + 125 + if (optind < argc) { 126 + int i; 127 + 128 + @@ -189,8 +200,52 @@ int main(int argc, char *argv[]) { 129 + } else { 130 + if (arg_machine) { 131 + char *m; 132 + + const char *cgroup; 133 + + _cleanup_free_ char *scope = NULL; 134 + + _cleanup_free_ char *path = NULL; 135 + + _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; 136 + + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; 137 + + 138 + m = strappenda("/run/systemd/machines/", arg_machine); 139 + - r = parse_env_file(m, NEWLINE, "CGROUP", &root, NULL); 140 + + r = parse_env_file(m, NEWLINE, "SCOPE", &scope, NULL); 141 + + if (r < 0) { 142 + + log_error("Failed to get machine path: %s", strerror(-r)); 143 + + goto finish; 144 + + } 145 + + 146 + + path = unit_dbus_path_from_name(scope); 147 + + if (!path) { 148 + + r = log_oom(); 149 + + goto finish; 150 + + } 151 + + 152 + + r = sd_bus_get_property( 153 + + bus, 154 + + "org.freedesktop.systemd1", 155 + + path, 156 + + "org.freedesktop.systemd1.Scope", 157 + + "ControlGroup", 158 + + &error, 159 + + &reply, 160 + + "s"); 161 + + 162 + + if (r < 0) { 163 + + log_error("Failed to query ControlGroup: %s", bus_error_message(&error, -r)); 164 + + goto finish; 165 + + } 166 + + 167 + + r = sd_bus_message_read(reply, "s", &cgroup); 168 + + if (r < 0) { 169 + + bus_log_parse_error(r); 170 + + goto finish; 171 + + } 172 + + 173 + + root = strdup(cgroup); 174 + + if (!root) { 175 + + r = log_oom(); 176 + + goto finish; 177 + + } 178 + + 179 + } else 180 + r = cg_get_root_path(&root); 181 + if (r < 0) { 182 + diff --git a/src/core/cgroup.c b/src/core/cgroup.c 183 + index 3dd4c91..4201e1e 100644 184 + --- a/src/core/cgroup.c 185 + +++ b/src/core/cgroup.c 186 + @@ -871,7 +871,7 @@ int manager_setup_cgroup(Manager *m) { 187 + safe_close(m->pin_cgroupfs_fd); 188 + 189 + m->pin_cgroupfs_fd = open(path, O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOCTTY|O_NONBLOCK); 190 + - if (r < 0) { 191 + + if (m->pin_cgroupfs_fd < 0) { 192 + log_error("Failed to open pin file: %m"); 193 + return -errno; 194 + } 195 + diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c 196 + index 775825b..5b1c4e3 100644 197 + --- a/src/core/dbus-cgroup.c 198 + +++ b/src/core/dbus-cgroup.c 199 + @@ -173,6 +173,7 @@ int bus_cgroup_set_property( 200 + 201 + if (mode != UNIT_CHECK) { 202 + c->cpu_accounting = b; 203 + + u->cgroup_realized_mask &= ~CGROUP_CPUACCT; 204 + unit_write_drop_in_private(u, mode, name, b ? "CPUAccounting=yes" : "CPUAccounting=no"); 205 + } 206 + 207 + @@ -192,6 +193,7 @@ int bus_cgroup_set_property( 208 + 209 + if (mode != UNIT_CHECK) { 210 + c->cpu_shares = ul; 211 + + u->cgroup_realized_mask &= ~CGROUP_CPU; 212 + unit_write_drop_in_private_format(u, mode, name, "CPUShares=%lu", ul); 213 + } 214 + 215 + @@ -206,6 +208,7 @@ int bus_cgroup_set_property( 216 + 217 + if (mode != UNIT_CHECK) { 218 + c->blockio_accounting = b; 219 + + u->cgroup_realized_mask &= ~CGROUP_BLKIO; 220 + unit_write_drop_in_private(u, mode, name, b ? "BlockIOAccounting=yes" : "BlockIOAccounting=no"); 221 + } 222 + 223 + @@ -225,6 +228,7 @@ int bus_cgroup_set_property( 224 + 225 + if (mode != UNIT_CHECK) { 226 + c->blockio_weight = ul; 227 + + u->cgroup_realized_mask &= ~CGROUP_BLKIO; 228 + unit_write_drop_in_private_format(u, mode, name, "BlockIOWeight=%lu", ul); 229 + } 230 + 231 + @@ -294,6 +298,8 @@ int bus_cgroup_set_property( 232 + cgroup_context_free_blockio_device_bandwidth(c, a); 233 + } 234 + 235 + + u->cgroup_realized_mask &= ~CGROUP_BLKIO; 236 + + 237 + f = open_memstream(&buf, &size); 238 + if (!f) 239 + return -ENOMEM; 240 + @@ -375,6 +381,8 @@ int bus_cgroup_set_property( 241 + cgroup_context_free_blockio_device_weight(c, c->blockio_device_weights); 242 + } 243 + 244 + + u->cgroup_realized_mask &= ~CGROUP_BLKIO; 245 + + 246 + f = open_memstream(&buf, &size); 247 + if (!f) 248 + return -ENOMEM; 249 + @@ -398,6 +406,7 @@ int bus_cgroup_set_property( 250 + 251 + if (mode != UNIT_CHECK) { 252 + c->memory_accounting = b; 253 + + u->cgroup_realized_mask &= ~CGROUP_MEMORY; 254 + unit_write_drop_in_private(u, mode, name, b ? "MemoryAccounting=yes" : "MemoryAccounting=no"); 255 + } 256 + 257 + @@ -412,6 +421,7 @@ int bus_cgroup_set_property( 258 + 259 + if (mode != UNIT_CHECK) { 260 + c->memory_limit = limit; 261 + + u->cgroup_realized_mask &= ~CGROUP_MEMORY; 262 + unit_write_drop_in_private_format(u, mode, name, "%s=%" PRIu64, name, limit); 263 + } 264 + 265 + @@ -433,6 +443,7 @@ int bus_cgroup_set_property( 266 + char *buf; 267 + 268 + c->device_policy = p; 269 + + u->cgroup_realized_mask &= ~CGROUP_DEVICE; 270 + 271 + buf = strappenda("DevicePolicy=", policy); 272 + unit_write_drop_in_private(u, mode, name, buf); 273 + @@ -511,6 +522,8 @@ int bus_cgroup_set_property( 274 + cgroup_context_free_device_allow(c, c->device_allow); 275 + } 276 + 277 + + u->cgroup_realized_mask &= ~CGROUP_DEVICE; 278 + + 279 + f = open_memstream(&buf, &size); 280 + if (!f) 281 + return -ENOMEM; 282 + diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c 283 + index 13b3d0d..37d4154 100644 284 + --- a/src/core/dbus-execute.c 285 + +++ b/src/core/dbus-execute.c 286 + @@ -842,7 +842,7 @@ int bus_exec_context_set_transient_property( 287 + strv_free(c->environment); 288 + c->environment = e; 289 + 290 + - joined = strv_join(c->environment, " "); 291 + + joined = strv_join_quoted(c->environment); 292 + if (!joined) 293 + return -ENOMEM; 294 + 295 + diff --git a/src/core/job.c b/src/core/job.c 296 + index 35a9de6..dc4f441 100644 297 + --- a/src/core/job.c 298 + +++ b/src/core/job.c 299 + @@ -1060,6 +1060,9 @@ int job_coldplug(Job *j) { 300 + if (r < 0) 301 + return r; 302 + 303 + + if (j->state == JOB_WAITING) 304 + + job_add_to_run_queue(j); 305 + + 306 + if (j->begin_usec == 0 || j->unit->job_timeout == 0) 307 + return 0; 308 + 309 + diff --git a/src/core/killall.c b/src/core/killall.c 310 + index 57ed41c..eab48f7 100644 311 + --- a/src/core/killall.c 312 + +++ b/src/core/killall.c 313 + @@ -168,7 +168,7 @@ static int killall(int sig, Set *pids, bool send_sighup) { 314 + continue; 315 + 316 + if (sig == SIGKILL) { 317 + - _cleanup_free_ char *s; 318 + + _cleanup_free_ char *s = NULL; 319 + 320 + get_process_comm(pid, &s); 321 + log_notice("Sending SIGKILL to PID "PID_FMT" (%s).", pid, strna(s)); 322 + diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c 323 + index d459afe..2a58e48 100644 324 + --- a/src/core/machine-id-setup.c 325 + +++ b/src/core/machine-id-setup.c 326 + @@ -93,32 +93,9 @@ static int generate(char id[34], const char *root) { 327 + } 328 + } 329 + 330 + - /* If that didn't work, see if we are running in qemu/kvm and a 331 + - * machine ID was passed in via -uuid on the qemu/kvm command 332 + - * line */ 333 + - 334 + - r = detect_vm(&vm_id); 335 + - if (r > 0 && streq(vm_id, "kvm")) { 336 + - char uuid[37]; 337 + - 338 + - fd = open("/sys/class/dmi/id/product_uuid", O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW); 339 + - if (fd >= 0) { 340 + - k = loop_read(fd, uuid, 36, false); 341 + - safe_close(fd); 342 + - 343 + - if (k >= 36) { 344 + - r = shorten_uuid(id, uuid); 345 + - if (r >= 0) { 346 + - log_info("Initializing machine ID from KVM UUID."); 347 + - return 0; 348 + - } 349 + - } 350 + - } 351 + - } 352 + - 353 + - /* If that didn't work either, see if we are running in a 354 + - * container, and a machine ID was passed in via 355 + - * $container_uuid the way libvirt/LXC does it */ 356 + + /* If that didn't work, see if we are running in a container, 357 + + * and a machine ID was passed in via $container_uuid the way 358 + + * libvirt/LXC does it */ 359 + r = detect_container(NULL); 360 + if (r > 0) { 361 + _cleanup_free_ char *e = NULL; 362 + @@ -133,6 +110,30 @@ static int generate(char id[34], const char *root) { 363 + } 364 + } 365 + } 366 + + 367 + + } else { 368 + + /* If we are not running in a container, see if we are 369 + + * running in qemu/kvm and a machine ID was passed in 370 + + * via -uuid on the qemu/kvm command line */ 371 + + 372 + + r = detect_vm(&vm_id); 373 + + if (r > 0 && streq(vm_id, "kvm")) { 374 + + char uuid[37]; 375 + + 376 + + fd = open("/sys/class/dmi/id/product_uuid", O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW); 377 + + if (fd >= 0) { 378 + + k = loop_read(fd, uuid, 36, false); 379 + + safe_close(fd); 380 + + 381 + + if (k >= 36) { 382 + + r = shorten_uuid(id, uuid); 383 + + if (r >= 0) { 384 + + log_info("Initializing machine ID from KVM UUID."); 385 + + return 0; 386 + + } 387 + + } 388 + + } 389 + + } 390 + } 391 + 392 + /* If that didn't work, generate a random machine id */ 393 diff --git a/src/core/main.c b/src/core/main.c 394 + index 41605ee..c65701d 100644 395 --- a/src/core/main.c 396 +++ b/src/core/main.c 397 + @@ -1840,6 +1840,7 @@ finish: 398 + if (reexecute) { 399 + const char **args; 400 + unsigned i, args_size; 401 + + sigset_t ss; 402 + 403 + /* Close and disarm the watchdog, so that the new 404 + * instance can reinitialize it, but doesn't get 405 + @@ -1883,7 +1884,7 @@ finish: 406 char_array_0(sfd); 407 408 i = 0; ··· 411 if (switch_root_dir) 412 args[i++] = "--switched-root"; 413 args[i++] = arg_running_as == SYSTEMD_SYSTEM ? "--system" : "--user"; 414 + @@ -1923,6 +1924,13 @@ finish: 415 + args[i++] = NULL; 416 + assert(i <= args_size); 417 + 418 + + /* reenable any blocked signals, especially important 419 + + * if we switch from initial ramdisk to init=... */ 420 + + reset_all_signal_handlers(); 421 + + 422 + + assert_se(sigemptyset(&ss) == 0); 423 + + assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0); 424 + + 425 + if (switch_root_init) { 426 + args[0] = switch_root_init; 427 + execv(args[0], (char* const*) args); 428 + diff --git a/src/core/manager.c b/src/core/manager.c 429 + index 224106c..7342095 100644 430 + --- a/src/core/manager.c 431 + +++ b/src/core/manager.c 432 + @@ -422,7 +422,7 @@ int manager_new(SystemdRunningAs running_as, Manager **_m) { 433 + return -ENOMEM; 434 + 435 + #ifdef ENABLE_EFI 436 + - if (detect_container(NULL) <= 0) 437 + + if (running_as == SYSTEMD_SYSTEM && detect_container(NULL) <= 0) 438 + boot_timestamps(&m->userspace_timestamp, &m->firmware_timestamp, &m->loader_timestamp); 439 + #endif 440 + 441 + @@ -2129,9 +2129,6 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root) { 442 + if (u->id != t) 443 + continue; 444 + 445 + - if (!unit_can_serialize(u)) 446 + - continue; 447 + - 448 + /* Start marker */ 449 + fputs(u->id, f); 450 + fputc('\n', f); 451 + diff --git a/src/core/namespace.c b/src/core/namespace.c 452 + index 9f15211..e41cf5b 100644 453 + --- a/src/core/namespace.c 454 + +++ b/src/core/namespace.c 455 + @@ -42,6 +42,7 @@ 456 + #include "mkdir.h" 457 + #include "dev-setup.h" 458 + #include "def.h" 459 + +#include "label.h" 460 + 461 + typedef enum MountMode { 462 + /* This is ordered by priority! */ 463 + @@ -68,6 +69,7 @@ static int append_mounts(BindMount **p, char **strv, MountMode mode) { 464 + STRV_FOREACH(i, strv) { 465 + 466 + (*p)->ignore = false; 467 + + (*p)->done = false; 468 + 469 + if ((mode == INACCESSIBLE || mode == READONLY || mode == READWRITE) && (*i)[0] == '-') { 470 + (*p)->ignore = true; 471 + @@ -217,7 +219,10 @@ static int mount_dev(BindMount *m) { 472 + goto fail; 473 + } 474 + 475 + + label_context_set(d, st.st_mode); 476 + r = mknod(dn, st.st_mode, st.st_rdev); 477 + + label_context_clear(); 478 + + 479 + if (r < 0) { 480 + r = -errno; 481 + goto fail; 482 + @@ -350,7 +355,7 @@ int setup_namespace( 483 + private_dev; 484 + 485 + if (n > 0) { 486 + - m = mounts = (BindMount *) alloca(n * sizeof(BindMount)); 487 + + m = mounts = (BindMount *) alloca0(n * sizeof(BindMount)); 488 + r = append_mounts(&m, read_write_dirs, READWRITE); 489 + if (r < 0) 490 + return r; 491 diff --git a/src/core/service.c b/src/core/service.c 492 index ae3695a..6b3aa45 100644 493 --- a/src/core/service.c ··· 505 log_error_unit(UNIT(s)->id, "%s is of type D-Bus but no D-Bus service name has been specified. Refusing.", UNIT(s)->id); 506 return -EINVAL; 507 diff --git a/src/core/socket.c b/src/core/socket.c 508 + index 7c18a2b..1a560a6 100644 509 --- a/src/core/socket.c 510 +++ b/src/core/socket.c 511 @@ -663,16 +663,25 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) { ··· 543 break; 544 } 545 546 + @@ -1242,6 +1251,8 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) { 547 + NULL, 548 + s->exec_runtime, 549 + &pid); 550 + + if (r < 0) 551 + + goto fail; 552 + 553 + strv_free(argv); 554 + if (r < 0) 555 + @@ -1497,6 +1508,12 @@ static void socket_enter_running(Socket *s, int cfd) { 556 + } 557 + 558 + if (!pending) { 559 + + if (!UNIT_ISSET(s->service)) { 560 + + log_error_unit(UNIT(s)->id, "%s: service to activate vanished, refusing activation.", UNIT(s)->id); 561 + + r = -ENOENT; 562 + + goto fail; 563 + + } 564 + + 565 + r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT_DEREF(s->service), JOB_REPLACE, true, &error, NULL); 566 + if (r < 0) 567 + goto fail; 568 + diff --git a/src/core/timer.c b/src/core/timer.c 569 + index 6c85304..720b8af 100644 570 + --- a/src/core/timer.c 571 + +++ b/src/core/timer.c 572 + @@ -111,6 +111,23 @@ static int timer_add_default_dependencies(Timer *t) { 573 + return unit_add_two_dependencies_by_name(UNIT(t), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true); 574 + } 575 + 576 + +static void update_stampfile(Timer *t, usec_t timestamp) { 577 + + _cleanup_close_ int fd = -1; 578 + + 579 + + mkdir_parents_label(t->stamp_path, 0755); 580 + + 581 + + /* Update the file atime + mtime, if we can */ 582 + + fd = open(t->stamp_path, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644); 583 + + if (fd >= 0) { 584 + + struct timespec ts[2]; 585 + + 586 + + timespec_store(&ts[0], timestamp); 587 + + ts[1] = ts[0]; 588 + + 589 + + futimens(fd, ts); 590 + + } 591 + +} 592 + + 593 + static int timer_setup_persistent(Timer *t) { 594 + int r; 595 + 596 + @@ -131,7 +148,7 @@ static int timer_setup_persistent(Timer *t) { 597 + 598 + e = getenv("XDG_DATA_HOME"); 599 + if (e) 600 + - t->stamp_path = strjoin(e, "/systemd/timers/", UNIT(t)->id, NULL); 601 + + t->stamp_path = strjoin(e, "/systemd/timers/stamp-", UNIT(t)->id, NULL); 602 + else { 603 + 604 + _cleanup_free_ char *h = NULL; 605 + @@ -496,22 +513,8 @@ static void timer_enter_running(Timer *t) { 606 + 607 + dual_timestamp_get(&t->last_trigger); 608 + 609 + - if (t->stamp_path) { 610 + - _cleanup_close_ int fd = -1; 611 + - 612 + - mkdir_parents_label(t->stamp_path, 0755); 613 + - 614 + - /* Update the file atime + mtime, if we can */ 615 + - fd = open(t->stamp_path, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644); 616 + - if (fd >= 0) { 617 + - struct timespec ts[2]; 618 + - 619 + - timespec_store(&ts[0], t->last_trigger.realtime); 620 + - ts[1] = ts[0]; 621 + - 622 + - futimens(fd, ts); 623 + - } 624 + - } 625 + + if (t->stamp_path) 626 + + update_stampfile(t, t->last_trigger.realtime); 627 + 628 + timer_set_state(t, TIMER_RUNNING); 629 + return; 630 + @@ -539,6 +542,11 @@ static int timer_start(Unit *u) { 631 + 632 + if (stat(t->stamp_path, &st) >= 0) 633 + t->last_trigger.realtime = timespec_load(&st.st_atim); 634 + + else if (errno == ENOENT) 635 + + /* The timer has never run before, 636 + + * make sure a stamp file exists. 637 + + */ 638 + + update_stampfile(t, now(CLOCK_REALTIME)); 639 + } 640 + 641 + t->result = TIMER_SUCCESS; 642 + diff --git a/src/core/transaction.c b/src/core/transaction.c 643 + index d00f427..2befc32 100644 644 + --- a/src/core/transaction.c 645 + +++ b/src/core/transaction.c 646 + @@ -378,7 +378,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi 647 + "Found dependency on %s/%s", 648 + k->unit->id, job_type_to_string(k->type)); 649 + 650 + - if (!delete && 651 + + if (!delete && hashmap_get(tr->jobs, k->unit) && 652 + !unit_matters_to_anchor(k->unit, k)) { 653 + /* Ok, we can drop this one, so let's 654 + * do so. */ 655 diff --git a/src/core/umount.c b/src/core/umount.c 656 index d1258f0..0311812 100644 657 --- a/src/core/umount.c ··· 665 #ifndef HAVE_SPLIT_USR 666 || path_equal(m->path, "/usr") 667 #endif 668 + diff --git a/src/core/unit.c b/src/core/unit.c 669 + index 153b79b..ed52694 100644 670 + --- a/src/core/unit.c 671 + +++ b/src/core/unit.c 672 + @@ -2287,25 +2287,25 @@ bool unit_can_serialize(Unit *u) { 673 + } 674 + 675 + int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) { 676 + - ExecRuntime *rt; 677 + int r; 678 + 679 + assert(u); 680 + assert(f); 681 + assert(fds); 682 + 683 + - if (!unit_can_serialize(u)) 684 + - return 0; 685 + - 686 + - r = UNIT_VTABLE(u)->serialize(u, f, fds); 687 + - if (r < 0) 688 + - return r; 689 + + if (unit_can_serialize(u)) { 690 + + ExecRuntime *rt; 691 + 692 + - rt = unit_get_exec_runtime(u); 693 + - if (rt) { 694 + - r = exec_runtime_serialize(rt, u, f, fds); 695 + + r = UNIT_VTABLE(u)->serialize(u, f, fds); 696 + if (r < 0) 697 + return r; 698 + + 699 + + rt = unit_get_exec_runtime(u); 700 + + if (rt) { 701 + + r = exec_runtime_serialize(rt, u, f, fds); 702 + + if (r < 0) 703 + + return r; 704 + + } 705 + } 706 + 707 + dual_timestamp_serialize(f, "inactive-exit-timestamp", &u->inactive_exit_timestamp); 708 + @@ -2367,17 +2367,14 @@ void unit_serialize_item(Unit *u, FILE *f, const char *key, const char *value) { 709 + } 710 + 711 + int unit_deserialize(Unit *u, FILE *f, FDSet *fds) { 712 + - size_t offset; 713 + ExecRuntime **rt = NULL; 714 + + size_t offset; 715 + int r; 716 + 717 + assert(u); 718 + assert(f); 719 + assert(fds); 720 + 721 + - if (!unit_can_serialize(u)) 722 + - return 0; 723 + - 724 + offset = UNIT_VTABLE(u)->exec_runtime_offset; 725 + if (offset > 0) 726 + rt = (ExecRuntime**) ((uint8_t*) u + offset); 727 + @@ -2487,24 +2484,34 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) { 728 + if (!s) 729 + return -ENOMEM; 730 + 731 + - free(u->cgroup_path); 732 + - u->cgroup_path = s; 733 + + if (u->cgroup_path) { 734 + + void *p; 735 + 736 + + p = hashmap_remove(u->manager->cgroup_unit, u->cgroup_path); 737 + + log_info("Removing cgroup_path %s from hashmap (%p)", 738 + + u->cgroup_path, p); 739 + + free(u->cgroup_path); 740 + + } 741 + + 742 + + u->cgroup_path = s; 743 + assert(hashmap_put(u->manager->cgroup_unit, s, u) == 1); 744 + + 745 + continue; 746 + } 747 + 748 + - if (rt) { 749 + - r = exec_runtime_deserialize_item(rt, u, l, v, fds); 750 + + if (unit_can_serialize(u)) { 751 + + if (rt) { 752 + + r = exec_runtime_deserialize_item(rt, u, l, v, fds); 753 + + if (r < 0) 754 + + return r; 755 + + if (r > 0) 756 + + continue; 757 + + } 758 + + 759 + + r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds); 760 + if (r < 0) 761 + return r; 762 + - if (r > 0) 763 + - continue; 764 + } 765 + - 766 + - r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds); 767 + - if (r < 0) 768 + - return r; 769 + } 770 + } 771 + 772 + diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c 773 + index 75d56dd..be8fb2f 100644 774 + --- a/src/cryptsetup/cryptsetup-generator.c 775 + +++ b/src/cryptsetup/cryptsetup-generator.c 776 + @@ -29,6 +29,7 @@ 777 + #include "mkdir.h" 778 + #include "strv.h" 779 + #include "fileio.h" 780 + +#include "path-util.h" 781 + 782 + static const char *arg_dest = "/tmp"; 783 + static bool arg_enabled = true; 784 + @@ -144,16 +145,19 @@ static int create_disk( 785 + if (!uu) 786 + return log_oom(); 787 + 788 + - if (is_device_path(uu)) { 789 + - _cleanup_free_ char *dd; 790 + + if (!path_equal(uu, "/dev/null")) { 791 + 792 + - dd = unit_name_from_path(uu, ".device"); 793 + - if (!dd) 794 + - return log_oom(); 795 + + if (is_device_path(uu)) { 796 + + _cleanup_free_ char *dd; 797 + 798 + - fprintf(f, "After=%1$s\nRequires=%1$s\n", dd); 799 + - } else 800 + - fprintf(f, "RequiresMountsFor=%s\n", password); 801 + + dd = unit_name_from_path(uu, ".device"); 802 + + if (!dd) 803 + + return log_oom(); 804 + + 805 + + fprintf(f, "After=%1$s\nRequires=%1$s\n", dd); 806 + + } else 807 + + fprintf(f, "RequiresMountsFor=%s\n", password); 808 + + } 809 + } 810 + } 811 + 812 + @@ -287,7 +291,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value) { 813 + } else if (STR_IN_SET(key, "luks.key", "rd.luks.key") && value) { 814 + 815 + free(arg_keyfile); 816 + - arg_keyfile = strdup(key); 817 + + arg_keyfile = strdup(value); 818 + if (!arg_keyfile) 819 + return log_oom(); 820 + 821 + diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c 822 + index 9b9074c..ad6c76c 100644 823 + --- a/src/cryptsetup/cryptsetup.c 824 + +++ b/src/cryptsetup/cryptsetup.c 825 + @@ -88,6 +88,13 @@ static int parse_one_option(const char *option) { 826 + return 0; 827 + } 828 + 829 + + if (arg_key_size % 8) { 830 + + log_error("size= not a multiple of 8, ignoring."); 831 + + return 0; 832 + + } 833 + + 834 + + arg_key_size /= 8; 835 + + 836 + } else if (startswith(option, "key-slot=")) { 837 + 838 + arg_type = CRYPT_LUKS1; 839 + @@ -404,7 +411,7 @@ static int attach_luks_or_plain(struct crypt_device *cd, 840 + /* for CRYPT_PLAIN limit reads 841 + * from keyfile to key length, and 842 + * ignore keyfile-size */ 843 + - arg_keyfile_size = arg_key_size / 8; 844 + + arg_keyfile_size = arg_key_size; 845 + 846 + /* In contrast to what the name 847 + * crypt_setup() might suggest this 848 + @@ -567,7 +574,7 @@ int main(int argc, char *argv[]) { 849 + else 850 + until = 0; 851 + 852 + - arg_key_size = (arg_key_size > 0 ? arg_key_size : 256); 853 + + arg_key_size = (arg_key_size > 0 ? arg_key_size : (256 / 8)); 854 + 855 + if (key_file) { 856 + struct stat st; 857 diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c 858 index 18f2aca..2a2b1ea 100644 859 --- a/src/fsck/fsck.c ··· 876 cmdline[i++] = "-a"; 877 cmdline[i++] = "-T"; 878 cmdline[i++] = "-l"; 879 + diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c 880 + index 6a4aa2c..700e90a 100644 881 + --- a/src/getty-generator/getty-generator.c 882 + +++ b/src/getty-generator/getty-generator.c 883 + @@ -72,7 +72,7 @@ static int add_serial_getty(const char *tty) { 884 + 885 + log_debug("Automatically adding serial getty for /dev/%s.", tty); 886 + 887 + - n = unit_name_replace_instance("serial-getty@.service", tty); 888 + + n = unit_name_from_path_instance("serial-getty", tty, ".service"); 889 + if (!n) 890 + return log_oom(); 891 + 892 + @@ -86,7 +86,7 @@ static int add_container_getty(const char *tty) { 893 + 894 + log_debug("Automatically adding container getty for /dev/pts/%s.", tty); 895 + 896 + - n = unit_name_replace_instance("container-getty@.service", tty); 897 + + n = unit_name_from_path_instance("container-getty", tty, ".service"); 898 + if (!n) 899 + return log_oom(); 900 + 901 + diff --git a/src/journal/catalog.c b/src/journal/catalog.c 902 + index 3ed0b7e..02dedc4 100644 903 + --- a/src/journal/catalog.c 904 + +++ b/src/journal/catalog.c 905 + @@ -103,7 +103,7 @@ static int finish_item( 906 + const char *payload) { 907 + 908 + ssize_t offset; 909 + - CatalogItem *i; 910 + + _cleanup_free_ CatalogItem *i = NULL; 911 + int r; 912 + 913 + assert(h); 914 + @@ -126,13 +126,14 @@ static int finish_item( 915 + i->offset = htole64((uint64_t) offset); 916 + 917 + r = hashmap_put(h, i, i); 918 + - if (r == EEXIST) { 919 + + if (r == -EEXIST) { 920 + log_warning("Duplicate entry for " SD_ID128_FORMAT_STR ".%s, ignoring.", 921 + SD_ID128_FORMAT_VAL(id), language ? language : "C"); 922 + - free(i); 923 + return 0; 924 + - } 925 + + } else if (r < 0) 926 + + return r; 927 + 928 + + i = NULL; 929 + return 0; 930 + } 931 + 932 + @@ -383,8 +384,8 @@ error: 933 + int catalog_update(const char* database, const char* root, const char* const* dirs) { 934 + _cleanup_strv_free_ char **files = NULL; 935 + char **f; 936 + - Hashmap *h; 937 + struct strbuf *sb = NULL; 938 + + _cleanup_hashmap_free_free_ Hashmap *h = NULL; 939 + _cleanup_free_ CatalogItem *items = NULL; 940 + CatalogItem *i; 941 + Iterator j; 942 + @@ -406,13 +407,17 @@ int catalog_update(const char* database, const char* root, const char* const* di 943 + } 944 + 945 + STRV_FOREACH(f, files) { 946 + - log_debug("reading file '%s'", *f); 947 + - catalog_import_file(h, sb, *f); 948 + + log_debug("Reading file '%s'", *f); 949 + + r = catalog_import_file(h, sb, *f); 950 + + if (r < 0) { 951 + + log_error("Failed to import file '%s': %s.", 952 + + *f, strerror(-r)); 953 + + goto finish; 954 + + } 955 + } 956 + 957 + if (hashmap_size(h) <= 0) { 958 + log_info("No items in catalog."); 959 + - r = 0; 960 + goto finish; 961 + } else 962 + log_debug("Found %u items in catalog.", hashmap_size(h)); 963 + @@ -443,11 +448,7 @@ int catalog_update(const char* database, const char* root, const char* const* di 964 + log_debug("%s: wrote %u items, with %zu bytes of strings, %ld total size.", 965 + database, n, sb->len, r); 966 + 967 + - r = 0; 968 + - 969 + finish: 970 + - if (h) 971 + - hashmap_free_free(h); 972 + if (sb) 973 + strbuf_cleanup(sb); 974 + 975 + diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c 976 + index f2f1f35..fd9d2a8 100644 977 + --- a/src/journal/journal-file.c 978 + +++ b/src/journal/journal-file.c 979 + @@ -274,12 +274,6 @@ static int journal_file_verify_header(JournalFile *f) { 980 + !VALID64(le64toh(f->header->entry_array_offset))) 981 + return -ENODATA; 982 + 983 + - if (le64toh(f->header->data_hash_table_offset) < le64toh(f->header->header_size) || 984 + - le64toh(f->header->field_hash_table_offset) < le64toh(f->header->header_size) || 985 + - le64toh(f->header->tail_object_offset) < le64toh(f->header->header_size) || 986 + - le64toh(f->header->entry_array_offset) < le64toh(f->header->header_size)) 987 + - return -ENODATA; 988 + - 989 + if (f->writable) { 990 + uint8_t state; 991 + sd_id128_t machine_id; 992 + diff --git a/src/journal/journal-remote-parse.c b/src/journal/journal-remote-parse.c 993 + index 142de0e..239ff38 100644 994 + --- a/src/journal/journal-remote-parse.c 995 + +++ b/src/journal/journal-remote-parse.c 996 + @@ -40,7 +40,7 @@ void source_free(RemoteSource *source) { 997 + 998 + static int get_line(RemoteSource *source, char **line, size_t *size) { 999 + ssize_t n, remain; 1000 + - char *c; 1001 + + char *c = NULL; 1002 + char *newbuf = NULL; 1003 + size_t newsize = 0; 1004 + 1005 + @@ -49,7 +49,9 @@ static int get_line(RemoteSource *source, char **line, size_t *size) { 1006 + assert(source->filled <= source->size); 1007 + assert(source->buf == NULL || source->size > 0); 1008 + 1009 + - c = memchr(source->buf, '\n', source->filled); 1010 + + if (source->buf) 1011 + + c = memchr(source->buf, '\n', source->filled); 1012 + + 1013 + if (c != NULL) 1014 + goto docopy; 1015 + 1016 + diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c 1017 + index 35948ea..48725e4 100644 1018 + --- a/src/journal/journald-kmsg.c 1019 + +++ b/src/journal/journald-kmsg.c 1020 + @@ -152,7 +152,7 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) { 1021 + /* Did we lose any? */ 1022 + if (serial > *s->kernel_seqnum) 1023 + server_driver_message(s, SD_MESSAGE_JOURNAL_MISSED, "Missed %"PRIu64" kernel messages", 1024 + - serial - *s->kernel_seqnum - 1); 1025 + + serial - *s->kernel_seqnum); 1026 + 1027 + /* Make sure we never read this one again. Note that 1028 + * we always store the next message serial we expect 1029 + diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c 1030 + index 6da81e7..b6f8e7e 100644 1031 + --- a/src/journal/journald-server.c 1032 + +++ b/src/journal/journald-server.c 1033 + @@ -67,6 +67,7 @@ 1034 + #define DEFAULT_SYNC_INTERVAL_USEC (5*USEC_PER_MINUTE) 1035 + #define DEFAULT_RATE_LIMIT_INTERVAL (30*USEC_PER_SEC) 1036 + #define DEFAULT_RATE_LIMIT_BURST 1000 1037 + +#define DEFAULT_MAX_FILE_USEC USEC_PER_MONTH 1038 + 1039 + #define RECHECK_AVAILABLE_SPACE_USEC (30*USEC_PER_SEC) 1040 + 1041 + @@ -1473,6 +1474,8 @@ int server_init(Server *s) { 1042 + s->forward_to_syslog = true; 1043 + s->forward_to_wall = true; 1044 + 1045 + + s->max_file_usec = DEFAULT_MAX_FILE_USEC; 1046 + + 1047 + s->max_level_store = LOG_DEBUG; 1048 + s->max_level_syslog = LOG_DEBUG; 1049 + s->max_level_kmsg = LOG_NOTICE; 1050 + diff --git a/src/journal/microhttpd-util.c b/src/journal/microhttpd-util.c 1051 + index f693e0f..9a8d5c6 100644 1052 + --- a/src/journal/microhttpd-util.c 1053 + +++ b/src/journal/microhttpd-util.c 1054 + @@ -129,7 +129,7 @@ void log_func_gnutls(int level, const char *message) { 1055 + if (0 <= level && level < (int) ELEMENTSOF(log_level_map)) 1056 + ourlevel = log_level_map[level]; 1057 + else 1058 + - level = LOG_DEBUG; 1059 + + ourlevel = LOG_DEBUG; 1060 + 1061 + log_meta(ourlevel, NULL, 0, NULL, "gnutls: %s", message); 1062 + } 1063 + diff --git a/src/journal/test-catalog.c b/src/journal/test-catalog.c 1064 + index b087a8b..967ab67 100644 1065 + --- a/src/journal/test-catalog.c 1066 + +++ b/src/journal/test-catalog.c 1067 + @@ -157,7 +157,8 @@ int main(int argc, char *argv[]) { 1068 + 1069 + setlocale(LC_ALL, "de_DE.UTF-8"); 1070 + 1071 + - log_set_max_level(LOG_DEBUG); 1072 + + log_parse_environment(); 1073 + + log_open(); 1074 + 1075 + test_catalog_file_lang(); 1076 + 1077 + diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c 1078 + index 84a8ffa..e79b318 100644 1079 + --- a/src/libsystemd/sd-rtnl/rtnl-message.c 1080 + +++ b/src/libsystemd/sd-rtnl/rtnl-message.c 1081 + @@ -335,24 +335,28 @@ int sd_rtnl_message_link_get_flags(sd_rtnl_message *m, unsigned *flags) { 1082 + /* If successful the updated message will be correctly aligned, if 1083 + unsuccessful the old message is untouched. */ 1084 + static int add_rtattr(sd_rtnl_message *m, unsigned short type, const void *data, size_t data_length) { 1085 + - uint32_t rta_length, message_length; 1086 + + uint32_t rta_length; 1087 + + size_t message_length, padding_length; 1088 + struct nlmsghdr *new_hdr; 1089 + struct rtattr *rta; 1090 + char *padding; 1091 + unsigned i; 1092 + + int offset; 1093 + 1094 + assert(m); 1095 + assert(m->hdr); 1096 + assert(!m->sealed); 1097 + assert(NLMSG_ALIGN(m->hdr->nlmsg_len) == m->hdr->nlmsg_len); 1098 + - assert(!data || data_length > 0); 1099 + - assert(data || m->n_containers < RTNL_CONTAINER_DEPTH); 1100 + + assert(!data || data_length); 1101 + + 1102 + + /* get offset of the new attribute */ 1103 + + offset = m->hdr->nlmsg_len; 1104 + 1105 + /* get the size of the new rta attribute (with padding at the end) */ 1106 + rta_length = RTA_LENGTH(data_length); 1107 + 1108 + /* get the new message size (with padding at the end) */ 1109 + - message_length = m->hdr->nlmsg_len + RTA_ALIGN(rta_length); 1110 + + message_length = offset + RTA_ALIGN(rta_length); 1111 + 1112 + /* realloc to fit the new attribute */ 1113 + new_hdr = realloc(m->hdr, message_length); 1114 + @@ -361,32 +365,35 @@ static int add_rtattr(sd_rtnl_message *m, unsigned short type, const void *data, 1115 + m->hdr = new_hdr; 1116 + 1117 + /* get pointer to the attribute we are about to add */ 1118 + - rta = (struct rtattr *) ((uint8_t *) m->hdr + m->hdr->nlmsg_len); 1119 + + rta = (struct rtattr *) ((uint8_t *) m->hdr + offset); 1120 + 1121 + /* if we are inside containers, extend them */ 1122 + for (i = 0; i < m->n_containers; i++) 1123 + - GET_CONTAINER(m, i)->rta_len += message_length - m->hdr->nlmsg_len; 1124 + + GET_CONTAINER(m, i)->rta_len += message_length - offset; 1125 + 1126 + /* fill in the attribute */ 1127 + rta->rta_type = type; 1128 + rta->rta_len = rta_length; 1129 + - if (!data) { 1130 + - /* this is the start of a new container */ 1131 + - m->container_offsets[m->n_containers ++] = m->hdr->nlmsg_len; 1132 + - } else { 1133 + + if (data) 1134 + /* we don't deal with the case where the user lies about the type 1135 + * and gives us too little data (so don't do that) 1136 + - */ 1137 + + */ 1138 + padding = mempcpy(RTA_DATA(rta), data, data_length); 1139 + - /* make sure also the padding at the end of the message is initialized */ 1140 + - memzero(padding, 1141 + - (uint8_t *) m->hdr + message_length - (uint8_t *) padding); 1142 + + else { 1143 + + /* if no data was passed, make sure we still initialize the padding 1144 + + note that we can have data_length > 0 (used by some containers) */ 1145 + + padding = RTA_DATA(rta); 1146 + + data_length = 0; 1147 + } 1148 + 1149 + + /* make sure also the padding at the end of the message is initialized */ 1150 + + padding_length = (uint8_t*)m->hdr + message_length - (uint8_t*)padding; 1151 + + memzero(padding, padding_length); 1152 + + 1153 + /* update message size */ 1154 + m->hdr->nlmsg_len = message_length; 1155 + 1156 + - return 0; 1157 + + return offset; 1158 + } 1159 + 1160 + int sd_rtnl_message_append_string(sd_rtnl_message *m, unsigned short type, const char *data) { 1161 + @@ -761,22 +768,29 @@ int sd_rtnl_message_open_container(sd_rtnl_message *m, unsigned short type) { 1162 + 1163 + assert_return(m, -EINVAL); 1164 + assert_return(!m->sealed, -EPERM); 1165 + + assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -ERANGE); 1166 + 1167 + sd_rtnl_message_get_type(m, &rtm_type); 1168 + 1169 + + int r = -ENOTSUP; 1170 + + 1171 + if (rtnl_message_type_is_link(rtm_type)) { 1172 + 1173 + if ((type == IFLA_LINKINFO && m->n_containers == 0) || 1174 + (type == IFLA_INFO_DATA && m->n_containers == 1 && 1175 + GET_CONTAINER(m, 0)->rta_type == IFLA_LINKINFO)) 1176 + - return add_rtattr(m, type, NULL, 0); 1177 + + r = add_rtattr(m, type, NULL, 0); 1178 + else if (type == VETH_INFO_PEER && m->n_containers == 2 && 1179 + GET_CONTAINER(m, 1)->rta_type == IFLA_INFO_DATA && 1180 + GET_CONTAINER(m, 0)->rta_type == IFLA_LINKINFO) 1181 + - return add_rtattr(m, type, NULL, sizeof(struct ifinfomsg)); 1182 + + r= add_rtattr(m, type, NULL, sizeof(struct ifinfomsg)); 1183 + } 1184 + 1185 + - return -ENOTSUP; 1186 + + if (r < 0) return r; 1187 + + 1188 + + m->container_offsets[m->n_containers ++] = r; 1189 + + 1190 + + return 0; 1191 + } 1192 + 1193 + int sd_rtnl_message_close_container(sd_rtnl_message *m) { 1194 + diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c 1195 + index ba1b04d..85b1e40 100644 1196 + --- a/src/libudev/libudev-monitor.c 1197 + +++ b/src/libudev/libudev-monitor.c 1198 + @@ -108,15 +108,13 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) 1199 + 1200 + /* we consider udev running when /dev is on devtmpfs */ 1201 + static bool udev_has_devtmpfs(struct udev *udev) { 1202 + - struct file_handle *h; 1203 + + union file_handle_union h = { .handle.handle_bytes = MAX_HANDLE_SZ, }; 1204 + int mount_id; 1205 + _cleanup_fclose_ FILE *f = NULL; 1206 + char line[LINE_MAX], *e; 1207 + int r; 1208 + 1209 + - h = alloca(MAX_HANDLE_SZ); 1210 + - h->handle_bytes = MAX_HANDLE_SZ; 1211 + - r = name_to_handle_at(AT_FDCWD, "/dev", h, &mount_id, 0); 1212 + + r = name_to_handle_at(AT_FDCWD, "/dev", &h.handle, &mount_id, 0); 1213 + if (r < 0) 1214 + return false; 1215 + 1216 + diff --git a/src/login/70-uaccess.rules b/src/login/70-uaccess.rules 1217 + index e1cf897..57f619d 100644 1218 + --- a/src/login/70-uaccess.rules 1219 + +++ b/src/login/70-uaccess.rules 1220 + @@ -12,7 +12,7 @@ ENV{MAJOR}=="", GOTO="uaccess_end" 1221 + SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="uaccess" 1222 + 1223 + # Digicams with proprietary protocol 1224 + -ENV{ID_GPHOTO2}=="*?", TAG+="uaccess" 1225 + +ENV{ID_GPHOTO2}=="?*", TAG+="uaccess" 1226 + 1227 + # SCSI and USB scanners 1228 + ENV{libsane_matched}=="yes", TAG+="uaccess" 1229 + @@ -49,13 +49,13 @@ SUBSYSTEM=="drm", KERNEL=="card*|renderD*", TAG+="uaccess" 1230 + SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="uaccess" 1231 + 1232 + # smart-card readers 1233 + -ENV{ID_SMARTCARD_READER}=="*?", TAG+="uaccess" 1234 + +ENV{ID_SMARTCARD_READER}=="?*", TAG+="uaccess" 1235 + 1236 + # (USB) authentication devices 1237 + -ENV{ID_SECURITY_TOKEN}=="*?", TAG+="uaccess" 1238 + +ENV{ID_SECURITY_TOKEN}=="?*", TAG+="uaccess" 1239 + 1240 + # PDA devices 1241 + -ENV{ID_PDA}=="*?", TAG+="uaccess" 1242 + +ENV{ID_PDA}=="?*", TAG+="uaccess" 1243 + 1244 + # Programmable remote control 1245 + ENV{ID_REMOTE_CONTROL}=="1", TAG+="uaccess" 1246 + @@ -64,10 +64,10 @@ ENV{ID_REMOTE_CONTROL}=="1", TAG+="uaccess" 1247 + SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="uaccess" 1248 + 1249 + # color measurement devices 1250 + -ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="uaccess" 1251 + +ENV{COLOR_MEASUREMENT_DEVICE}=="?*", TAG+="uaccess" 1252 + 1253 + # DDC/CI device, usually high-end monitors such as the DreamColor 1254 + -ENV{DDC_DEVICE}=="*?", TAG+="uaccess" 1255 + +ENV{DDC_DEVICE}=="?*", TAG+="uaccess" 1256 + 1257 + # media player raw devices (for user-mode drivers, Android SDK, etc.) 1258 + SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="uaccess" 1259 + diff --git a/src/login/logind-acl.c b/src/login/logind-acl.c 1260 + index dc86f0f..4bbeb64 100644 1261 + --- a/src/login/logind-acl.c 1262 + +++ b/src/login/logind-acl.c 1263 + @@ -279,7 +279,9 @@ int devnode_acl_all(struct udev *udev, 1264 + 1265 + log_debug("Fixing up ACLs at %s for seat %s", n, seat); 1266 + k = devnode_acl(n, flush, del, old_uid, add, new_uid); 1267 + - if (k < 0) 1268 + + if (k == -ENOENT) 1269 + + log_debug("Device %s disappeared while setting ACLs", n); 1270 + + else if (k < 0) 1271 + r = k; 1272 + } 1273 + 1274 + diff --git a/src/login/logind-action.c b/src/login/logind-action.c 1275 + index 1928f43..d69c7ad 100644 1276 + --- a/src/login/logind-action.c 1277 + +++ b/src/login/logind-action.c 1278 + @@ -79,14 +79,12 @@ int manager_handle_action( 1279 + return 0; 1280 + } 1281 + 1282 + - /* If we have more than one or no displays connected, 1283 + - * don't react to lid closing. The no display case we 1284 + - * treat like this under the assumption that there is 1285 + - * no modern drm driver available. */ 1286 + + /* If we have more than one display connected, 1287 + + * don't react to lid closing. */ 1288 + n = manager_count_displays(m); 1289 + if (n < 0) 1290 + log_warning("Display counting failed: %s", strerror(-n)); 1291 + - else if (n != 1) { 1292 + + else if (n > 1) { 1293 + log_debug("Ignoring lid switch request, %i displays connected.", n); 1294 + return 0; 1295 + } 1296 + diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c 1297 + index 3f5efdc..1ee6ced 100644 1298 + --- a/src/login/logind-seat.c 1299 + +++ b/src/login/logind-seat.c 1300 + @@ -275,8 +275,13 @@ int seat_switch_to(Seat *s, unsigned int num) { 1301 + if (!num) 1302 + return -EINVAL; 1303 + 1304 + - if (num >= s->position_count || !s->positions[num]) 1305 + + if (num >= s->position_count || !s->positions[num]) { 1306 + + /* allow switching to unused VTs to trigger auto-activate */ 1307 + + if (seat_has_vts(s) && num < 64) 1308 + + return chvt(num); 1309 + + 1310 + return -EINVAL; 1311 + + } 1312 + 1313 + return session_activate(s->positions[num]); 1314 + } 1315 + diff --git a/src/login/logind-session.c b/src/login/logind-session.c 1316 + index 4ca6b5d..02a780d 100644 1317 + --- a/src/login/logind-session.c 1318 + +++ b/src/login/logind-session.c 1319 + @@ -213,7 +213,6 @@ int session_save(Session *s) { 1320 + 1321 + if (s->scope) 1322 + fprintf(f, "SCOPE=%s\n", s->scope); 1323 + - 1324 + if (s->scope_job) 1325 + fprintf(f, "SCOPE_JOB=%s\n", s->scope_job); 1326 + 1327 + @@ -229,17 +228,54 @@ int session_save(Session *s) { 1328 + if (s->display) 1329 + fprintf(f, "DISPLAY=%s\n", s->display); 1330 + 1331 + - if (s->remote_host) 1332 + - fprintf(f, "REMOTE_HOST=%s\n", s->remote_host); 1333 + + if (s->remote_host) { 1334 + + _cleanup_free_ char *escaped; 1335 + + 1336 + + escaped = cescape(s->remote_host); 1337 + + if (!escaped) { 1338 + + r = -ENOMEM; 1339 + + goto finish; 1340 + + } 1341 + + 1342 + + fprintf(f, "REMOTE_HOST=%s\n", escaped); 1343 + + } 1344 + + 1345 + + if (s->remote_user) { 1346 + + _cleanup_free_ char *escaped; 1347 + + 1348 + + escaped = cescape(s->remote_user); 1349 + + if (!escaped) { 1350 + + r = -ENOMEM; 1351 + + goto finish; 1352 + + } 1353 + + 1354 + + fprintf(f, "REMOTE_USER=%s\n", escaped); 1355 + + } 1356 + + 1357 + + if (s->service) { 1358 + + _cleanup_free_ char *escaped; 1359 + 1360 + - if (s->remote_user) 1361 + - fprintf(f, "REMOTE_USER=%s\n", s->remote_user); 1362 + + escaped = cescape(s->service); 1363 + + if (!escaped) { 1364 + + r = -ENOMEM; 1365 + + goto finish; 1366 + + } 1367 + + 1368 + + fprintf(f, "SERVICE=%s\n", escaped); 1369 + + } 1370 + 1371 + - if (s->service) 1372 + - fprintf(f, "SERVICE=%s\n", s->service); 1373 + + if (s->desktop) { 1374 + + _cleanup_free_ char *escaped; 1375 + 1376 + - if (s->desktop) 1377 + - fprintf(f, "DESKTOP=%s\n", s->desktop); 1378 + + 1379 + + escaped = cescape(s->desktop); 1380 + + if (!escaped) { 1381 + + r = -ENOMEM; 1382 + + goto finish; 1383 + + } 1384 + + 1385 + + fprintf(f, "DESKTOP=%s\n", escaped); 1386 + + } 1387 + 1388 + if (s->seat && seat_has_vts(s->seat)) 1389 + fprintf(f, "VTNR=%u\n", s->vtnr); 1390 + @@ -972,6 +1008,10 @@ void session_mute_vt(Session *s) { 1391 + if (vt < 0) 1392 + return; 1393 + 1394 + + r = fchown(vt, s->user->uid, -1); 1395 + + if (r < 0) 1396 + + goto error; 1397 + + 1398 + r = ioctl(vt, KDSKBMODE, K_OFF); 1399 + if (r < 0) 1400 + goto error; 1401 + @@ -1026,6 +1066,8 @@ void session_restore_vt(Session *s) { 1402 + mode.mode = VT_AUTO; 1403 + ioctl(vt, VT_SETMODE, &mode); 1404 + 1405 + + fchown(vt, 0, -1); 1406 + + 1407 + s->vtfd = safe_close(s->vtfd); 1408 + } 1409 + 1410 + diff --git a/src/login/org.freedesktop.login1.policy.in b/src/login/org.freedesktop.login1.policy.in 1411 + index b96d32d..b8e90f1 100644 1412 + --- a/src/login/org.freedesktop.login1.policy.in 1413 + +++ b/src/login/org.freedesktop.login1.policy.in 1414 + @@ -254,7 +254,7 @@ 1415 + <defaults> 1416 + <allow_any>auth_admin_keep</allow_any> 1417 + <allow_inactive>auth_admin_keep</allow_inactive> 1418 + - <allow_active>auth_admin_keep</allow_active> 1419 + + <allow_active>yes</allow_active> 1420 + </defaults> 1421 + <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.hibernate</annotate> 1422 + </action> 1423 + diff --git a/src/login/pam-module.c b/src/login/pam-module.c 1424 + index 9873dd5..1259457 100644 1425 + --- a/src/login/pam-module.c 1426 + +++ b/src/login/pam-module.c 1427 + @@ -475,7 +475,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( 1428 + } 1429 + 1430 + if (session_fd >= 0) { 1431 + - session_fd = dup(session_fd); 1432 + + session_fd = fcntl(session_fd, F_DUPFD_CLOEXEC, 3); 1433 + if (session_fd < 0) { 1434 + pam_syslog(handle, LOG_ERR, "Failed to dup session fd: %m"); 1435 + return PAM_SESSION_ERR; 1436 + diff --git a/src/machine/machine.c b/src/machine/machine.c 1437 + index 9a5cc9a..de701ad 100644 1438 + --- a/src/machine/machine.c 1439 + +++ b/src/machine/machine.c 1440 + @@ -123,17 +123,42 @@ int machine_save(Machine *m) { 1441 + "NAME=%s\n", 1442 + m->name); 1443 + 1444 + - if (m->unit) 1445 + - fprintf(f, "SCOPE=%s\n", m->unit); /* We continue to call this "SCOPE=" because it is internal only, and we want to stay compatible with old files */ 1446 + + if (m->unit) { 1447 + + _cleanup_free_ char *escaped; 1448 + + 1449 + + escaped = cescape(m->unit); 1450 + + if (!escaped) { 1451 + + r = -ENOMEM; 1452 + + goto finish; 1453 + + } 1454 + + 1455 + + fprintf(f, "SCOPE=%s\n", escaped); /* We continue to call this "SCOPE=" because it is internal only, and we want to stay compatible with old files */ 1456 + + } 1457 + 1458 + if (m->scope_job) 1459 + fprintf(f, "SCOPE_JOB=%s\n", m->scope_job); 1460 + 1461 + - if (m->service) 1462 + - fprintf(f, "SERVICE=%s\n", m->service); 1463 + + if (m->service) { 1464 + + _cleanup_free_ char *escaped; 1465 + 1466 + - if (m->root_directory) 1467 + - fprintf(f, "ROOT=%s\n", m->root_directory); 1468 + + escaped = cescape(m->service); 1469 + + if (!escaped) { 1470 + + r = -ENOMEM; 1471 + + goto finish; 1472 + + } 1473 + + fprintf(f, "SERVICE=%s\n", escaped); 1474 + + } 1475 + + 1476 + + if (m->root_directory) { 1477 + + _cleanup_free_ char *escaped; 1478 + + 1479 + + escaped = cescape(m->root_directory); 1480 + + if (!escaped) { 1481 + + r = -ENOMEM; 1482 + + goto finish; 1483 + + } 1484 + + fprintf(f, "ROOT=%s\n", escaped); 1485 + + } 1486 + 1487 + if (!sd_id128_equal(m->id, SD_ID128_NULL)) 1488 + fprintf(f, "ID=" SD_ID128_FORMAT_STR "\n", SD_ID128_FORMAT_VAL(m->id)); 1489 + @@ -330,16 +355,18 @@ static int machine_stop_scope(Machine *m) { 1490 + if (!m->unit) 1491 + return 0; 1492 + 1493 + - r = manager_stop_unit(m->manager, m->unit, &error, &job); 1494 + - if (r < 0) { 1495 + - log_error("Failed to stop machine scope: %s", bus_error_message(&error, r)); 1496 + - return r; 1497 + + if (!m->registered) { 1498 + + r = manager_stop_unit(m->manager, m->unit, &error, &job); 1499 + + if (r < 0) { 1500 + + log_error("Failed to stop machine scope: %s", bus_error_message(&error, r)); 1501 + + return r; 1502 + + } 1503 + } 1504 + 1505 + free(m->scope_job); 1506 + m->scope_job = job; 1507 + 1508 + - return r; 1509 + + return 0; 1510 + } 1511 + 1512 + int machine_stop(Machine *m) { 1513 + @@ -415,6 +442,8 @@ int machine_kill(Machine *m, KillWho who, int signo) { 1514 + 1515 + if (kill(m->leader, signo) < 0) 1516 + return -errno; 1517 + + 1518 + + return 0; 1519 + } 1520 + 1521 + /* Otherwise make PID 1 do it for us, for the entire cgroup */ 1522 + diff --git a/src/machine/machine.h b/src/machine/machine.h 1523 + index f4aefc5..de3536d 100644 1524 + --- a/src/machine/machine.h 1525 + +++ b/src/machine/machine.h 1526 + @@ -72,6 +72,7 @@ struct Machine { 1527 + 1528 + bool in_gc_queue:1; 1529 + bool started:1; 1530 + + bool registered:1; 1531 + 1532 + sd_bus_message *create_message; 1533 + 1534 + diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c 1535 + index 9473105..154a335 100644 1536 + --- a/src/machine/machined-dbus.c 1537 + +++ b/src/machine/machined-dbus.c 1538 + @@ -241,6 +241,7 @@ static int method_create_or_register_machine(Manager *manager, sd_bus_message *m 1539 + m->leader = leader; 1540 + m->class = c; 1541 + m->id = id; 1542 + + m->registered = true; 1543 + 1544 + if (!isempty(service)) { 1545 + m->service = strdup(service); 1546 diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c 1547 + index 9a9ed9d..c3e6d23 100644 1548 --- a/src/nspawn/nspawn.c 1549 +++ b/src/nspawn/nspawn.c 1550 + @@ -769,6 +769,15 @@ static int setup_resolv_conf(const char *dest) { 1551 + return 0; 1552 + } 1553 + 1554 + +static char* id128_format_as_uuid(sd_id128_t id, char s[37]) { 1555 + + 1556 + + snprintf(s, 37, 1557 + + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", 1558 + + SD_ID128_FORMAT_VAL(id)); 1559 + + 1560 + + return s; 1561 + +} 1562 + + 1563 + static int setup_boot_id(const char *dest) { 1564 + _cleanup_free_ char *from = NULL, *to = NULL; 1565 + sd_id128_t rnd = {}; 1566 + @@ -794,10 +803,7 @@ static int setup_boot_id(const char *dest) { 1567 + return r; 1568 + } 1569 + 1570 + - snprintf(as_uuid, sizeof(as_uuid), 1571 + - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", 1572 + - SD_ID128_FORMAT_VAL(rnd)); 1573 + - char_array_0(as_uuid); 1574 + + id128_format_as_uuid(rnd, as_uuid); 1575 + 1576 + r = write_string_file(from, as_uuid); 1577 + if (r < 0) { 1578 + @@ -2378,7 +2384,7 @@ static int change_uid_gid(char **_home) { 1579 + _cleanup_fclose_ FILE *f = NULL; 1580 + _cleanup_close_ int fd = -1; 1581 + unsigned n_uids = 0; 1582 + - size_t sz, l; 1583 + + size_t sz = 0, l; 1584 + uid_t uid; 1585 + gid_t gid; 1586 + pid_t pid; 1587 + @@ -2667,6 +2673,7 @@ int main(int argc, char *argv[]) { 1588 goto finish; 1589 } 1590 } else { ··· 1592 const char *p; 1593 1594 p = strappenda(arg_directory, 1595 + @@ -2676,6 +2683,7 @@ int main(int argc, char *argv[]) { 1596 goto finish; 1597 1598 } ··· 1600 } 1601 } else { 1602 char template[] = "/tmp/nspawn-root-XXXXXX"; 1603 + @@ -2748,8 +2756,6 @@ int main(int argc, char *argv[]) { 1604 + goto finish; 1605 + } 1606 + 1607 + - sd_notify(0, "READY=1"); 1608 + - 1609 + assert_se(sigemptyset(&mask) == 0); 1610 + sigset_add_many(&mask, SIGCHLD, SIGWINCH, SIGTERM, SIGINT, -1); 1611 + assert_se(sigprocmask(SIG_BLOCK, &mask, NULL) == 0); 1612 + @@ -2966,7 +2972,9 @@ int main(int argc, char *argv[]) { 1613 + } 1614 + 1615 + if (!sd_id128_equal(arg_uuid, SD_ID128_NULL)) { 1616 + - if (asprintf((char**)(envp + n_env++), "container_uuid=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(arg_uuid)) < 0) { 1617 + + char as_uuid[37]; 1618 + + 1619 + + if (asprintf((char**)(envp + n_env++), "container_uuid=%s", id128_format_as_uuid(arg_uuid, as_uuid)) < 0) { 1620 + log_oom(); 1621 + goto child_fail; 1622 + } 1623 + @@ -3086,6 +3094,8 @@ int main(int argc, char *argv[]) { 1624 + if (r < 0) 1625 + goto finish; 1626 + 1627 + + sd_notify(0, "READY=1"); 1628 + + 1629 + /* Notify the child that the parent is ready with all 1630 + * its setup, and thtat the child can now hand over 1631 + * control to the code to run inside the container. */ 1632 + @@ -3136,6 +3146,10 @@ int main(int argc, char *argv[]) { 1633 + 1634 + if (!arg_quiet) 1635 + log_info("Container %s is being rebooted.", arg_machine); 1636 + + if (getenv("EXIT_ON_REBOOT") != 0) { 1637 + + r = 10; 1638 + + break; 1639 + + } 1640 + continue; 1641 + } else if (status.si_code == CLD_KILLED || 1642 + status.si_code == CLD_DUMPED) { 1643 diff --git a/src/nss-myhostname/netlink.c b/src/nss-myhostname/netlink.c 1644 index d61ecdf..228a3a4 100644 1645 --- a/src/nss-myhostname/netlink.c ··· 1655 if (ifaddrmsg->ifa_flags & IFA_F_DEPRECATED) 1656 continue; 1657 1658 + diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c 1659 + index 059b904..9a19a10 100644 1660 + --- a/src/python-systemd/_reader.c 1661 + +++ b/src/python-systemd/_reader.c 1662 + @@ -902,7 +902,6 @@ static PyObject* get_catalog(PyObject *self, PyObject *args) { 1663 + sd_id128_t id; 1664 + _cleanup_free_ char *msg = NULL; 1665 + 1666 + - assert(!self); 1667 + assert(args); 1668 + 1669 + if (!PyArg_ParseTuple(args, "z:get_catalog", &id_)) 1670 + diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py 1671 + index 9c7e004..dd1f229 100644 1672 + --- a/src/python-systemd/journal.py 1673 + +++ b/src/python-systemd/journal.py 1674 + @@ -293,7 +293,7 @@ class Reader(_Reader): 1675 + monotonic = monotonic.totalseconds() 1676 + monotonic = int(monotonic * 1000000) 1677 + if isinstance(bootid, _uuid.UUID): 1678 + - bootid = bootid.get_hex() 1679 + + bootid = bootid.hex 1680 + return super(Reader, self).seek_monotonic(monotonic, bootid) 1681 + 1682 + def log_level(self, level): 1683 + @@ -314,7 +314,7 @@ class Reader(_Reader): 1684 + Equivalent to add_match(MESSAGE_ID=`messageid`). 1685 + """ 1686 + if isinstance(messageid, _uuid.UUID): 1687 + - messageid = messageid.get_hex() 1688 + + messageid = messageid.hex 1689 + self.add_match(MESSAGE_ID=messageid) 1690 + 1691 + def this_boot(self, bootid=None): 1692 + @@ -346,7 +346,7 @@ class Reader(_Reader): 1693 + 1694 + def get_catalog(mid): 1695 + if isinstance(mid, _uuid.UUID): 1696 + - mid = mid.get_hex() 1697 + + mid = mid.hex 1698 + return _get_catalog(mid) 1699 + 1700 + def _make_line(field, value): 1701 + diff --git a/src/readahead/readahead-common.c b/src/readahead/readahead-common.c 1702 + index 5ffa88b..49679fc 100644 1703 + --- a/src/readahead/readahead-common.c 1704 + +++ b/src/readahead/readahead-common.c 1705 + @@ -75,7 +75,7 @@ int fs_on_ssd(const char *p) { 1706 + if (major(st.st_dev) == 0) { 1707 + _cleanup_fclose_ FILE *f = NULL; 1708 + int mount_id; 1709 + - struct file_handle *h; 1710 + + union file_handle_union h = { .handle.handle_bytes = MAX_HANDLE_SZ, }; 1711 + 1712 + /* Might be btrfs, which exposes "ssd" as mount flag if it is on ssd. 1713 + * 1714 + @@ -83,9 +83,7 @@ int fs_on_ssd(const char *p) { 1715 + * and then lookup the mount ID in mountinfo to find 1716 + * the mount options. */ 1717 + 1718 + - h = alloca(MAX_HANDLE_SZ); 1719 + - h->handle_bytes = MAX_HANDLE_SZ; 1720 + - r = name_to_handle_at(AT_FDCWD, p, h, &mount_id, AT_SYMLINK_FOLLOW); 1721 + + r = name_to_handle_at(AT_FDCWD, p, &h.handle, &mount_id, AT_SYMLINK_FOLLOW); 1722 + if (r < 0) 1723 + return false; 1724 + 1725 + diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c 1726 + index d27b1b7..905a2e1 100644 1727 + --- a/src/shared/conf-parser.c 1728 + +++ b/src/shared/conf-parser.c 1729 + @@ -336,8 +336,8 @@ int config_parse(const char *unit, 1730 + if (!f) { 1731 + f = ours = fopen(filename, "re"); 1732 + if (!f) { 1733 + - log_error("Failed to open configuration file '%s': %m", filename); 1734 + - return -errno; 1735 + + log_full(errno == ENOENT ? LOG_DEBUG : LOG_ERR, "Failed to open configuration file '%s': %m", filename); 1736 + + return errno == ENOENT ? 0 : -errno; 1737 + } 1738 + } 1739 + 1740 diff --git a/src/shared/generator.c b/src/shared/generator.c 1741 index 6110303..e679cb1 100644 1742 --- a/src/shared/generator.c ··· 1750 r = access(checker, X_OK); 1751 if (r < 0) { 1752 log_warning("Checking was requested for %s, but %s cannot be used: %m", what, checker); 1753 + diff --git a/src/shared/install.c b/src/shared/install.c 1754 + index 7409046..4517c9c 100644 1755 + --- a/src/shared/install.c 1756 + +++ b/src/shared/install.c 1757 + @@ -560,7 +560,7 @@ int unit_file_mask( 1758 + unsigned *n_changes) { 1759 + 1760 + char **i; 1761 + - _cleanup_free_ char *prefix; 1762 + + _cleanup_free_ char *prefix = NULL; 1763 + int r; 1764 + 1765 + assert(scope >= 0); 1766 + diff --git a/src/shared/log.c b/src/shared/log.c 1767 + index a4b3b68..890a9fa 100644 1768 + --- a/src/shared/log.c 1769 + +++ b/src/shared/log.c 1770 + @@ -878,6 +878,9 @@ void log_parse_environment(void) { 1771 + if (l == 5 && startswith(w, "debug")) { 1772 + log_set_max_level(LOG_DEBUG); 1773 + break; 1774 + + } else if (l == 5 && startswith(w, "quiet")) { 1775 + + log_set_max_level(LOG_WARNING); 1776 + + break; 1777 + } 1778 + } 1779 + } 1780 + diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c 1781 + index 9d14933..b0b66f6 100644 1782 + --- a/src/shared/logs-show.c 1783 + +++ b/src/shared/logs-show.c 1784 + @@ -547,7 +547,9 @@ static int output_export( 1785 + startswith(data, "_BOOT_ID=")) 1786 + continue; 1787 + 1788 + - if (!utf8_is_printable(data, length)) { 1789 + + if (utf8_is_printable_newline(data, length, false)) 1790 + + fwrite(data, length, 1, f); 1791 + + else { 1792 + const char *c; 1793 + uint64_t le64; 1794 + 1795 + @@ -562,8 +564,7 @@ static int output_export( 1796 + le64 = htole64(length - (c - (const char*) data) - 1); 1797 + fwrite(&le64, sizeof(le64), 1, f); 1798 + fwrite(c + 1, length - (c - (const char*) data) - 1, 1, f); 1799 + - } else 1800 + - fwrite(data, length, 1, f); 1801 + + } 1802 + 1803 + fputc('\n', f); 1804 + } 1805 + diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c 1806 + index 6c167b4..d0e71f2 100644 1807 + --- a/src/shared/unit-name.c 1808 + +++ b/src/shared/unit-name.c 1809 + @@ -332,7 +332,7 @@ char *unit_name_path_unescape(const char *f) { 1810 + } 1811 + 1812 + bool unit_name_is_template(const char *n) { 1813 + - const char *p; 1814 + + const char *p, *e; 1815 + 1816 + assert(n); 1817 + 1818 + @@ -340,11 +340,15 @@ bool unit_name_is_template(const char *n) { 1819 + if (!p) 1820 + return false; 1821 + 1822 + - return p[1] == '.'; 1823 + + e = strrchr(p+1, '.'); 1824 + + if (!e) 1825 + + return false; 1826 + + 1827 + + return e == p + 1; 1828 + } 1829 + 1830 + bool unit_name_is_instance(const char *n) { 1831 + - const char *p; 1832 + + const char *p, *e; 1833 + 1834 + assert(n); 1835 + 1836 + @@ -352,7 +356,11 @@ bool unit_name_is_instance(const char *n) { 1837 + if (!p) 1838 + return false; 1839 + 1840 + - return p[1] != '.'; 1841 + + e = strrchr(p+1, '.'); 1842 + + if (!e) 1843 + + return false; 1844 + + 1845 + + return e > p + 1; 1846 + } 1847 + 1848 + char *unit_name_replace_instance(const char *f, const char *i) { 1849 + diff --git a/src/shared/utf8.c b/src/shared/utf8.c 1850 + index 0b524d8..c559c13 100644 1851 + --- a/src/shared/utf8.c 1852 + +++ b/src/shared/utf8.c 1853 + @@ -136,7 +136,7 @@ int utf8_encoded_to_unichar(const char *str) { 1854 + return unichar; 1855 + } 1856 + 1857 + -bool utf8_is_printable(const char* str, size_t length) { 1858 + +bool utf8_is_printable_newline(const char* str, size_t length, bool newline) { 1859 + const uint8_t *p; 1860 + 1861 + assert(str); 1862 + @@ -145,7 +145,8 @@ bool utf8_is_printable(const char* str, size_t length) { 1863 + int encoded_len = utf8_encoded_valid_unichar((const char *)p); 1864 + int val = utf8_encoded_to_unichar((const char*)p); 1865 + 1866 + - if (encoded_len < 0 || val < 0 || is_unicode_control(val)) 1867 + + if (encoded_len < 0 || val < 0 || is_unicode_control(val) || 1868 + + (!newline && val == '\n')) 1869 + return false; 1870 + 1871 + length -= encoded_len; 1872 + diff --git a/src/shared/utf8.h b/src/shared/utf8.h 1873 + index c0eb73a..c087995 100644 1874 + --- a/src/shared/utf8.h 1875 + +++ b/src/shared/utf8.h 1876 + @@ -31,7 +31,10 @@ const char *utf8_is_valid(const char *s) _pure_; 1877 + char *ascii_is_valid(const char *s) _pure_; 1878 + char *utf8_escape_invalid(const char *s); 1879 + 1880 + -bool utf8_is_printable(const char* str, size_t length) _pure_; 1881 + +bool utf8_is_printable_newline(const char* str, size_t length, bool newline) _pure_; 1882 + +_pure_ static inline bool utf8_is_printable(const char* str, size_t length) { 1883 + + return utf8_is_printable_newline(str, length, true); 1884 + +} 1885 + 1886 + char *utf16_to_utf8(const void *s, size_t length); 1887 + 1888 + diff --git a/src/shared/util.c b/src/shared/util.c 1889 + index ffe6624..2a2b2b2 100644 1890 + --- a/src/shared/util.c 1891 + +++ b/src/shared/util.c 1892 + @@ -166,19 +166,19 @@ int close_nointr(int fd) { 1893 + 1894 + assert(fd >= 0); 1895 + r = close(fd); 1896 + - 1897 + - /* Just ignore EINTR; a retry loop is the wrong 1898 + - * thing to do on Linux. 1899 + - * 1900 + - * http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html 1901 + - * https://bugzilla.gnome.org/show_bug.cgi?id=682819 1902 + - * http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR 1903 + - * https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain 1904 + - */ 1905 + - if (_unlikely_(r < 0 && errno == EINTR)) 1906 + - return 0; 1907 + - else if (r >= 0) 1908 + + if (r >= 0) 1909 + return r; 1910 + + else if (errno == EINTR) 1911 + + /* 1912 + + * Just ignore EINTR; a retry loop is the wrong 1913 + + * thing to do on Linux. 1914 + + * 1915 + + * http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html 1916 + + * https://bugzilla.gnome.org/show_bug.cgi?id=682819 1917 + + * http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR 1918 + + * https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain 1919 + + */ 1920 + + return 0; 1921 + else 1922 + return -errno; 1923 + } 1924 + @@ -195,7 +195,13 @@ int safe_close(int fd) { 1925 + 1926 + if (fd >= 0) { 1927 + PROTECT_ERRNO; 1928 + - assert_se(close_nointr(fd) == 0); 1929 + + 1930 + + /* The kernel might return pretty much any error code 1931 + + * via close(), but the fd will be closed anyway. The 1932 + + * only condition we want to check for here is whether 1933 + + * the fd was invalid at all... */ 1934 + + 1935 + + assert_se(close_nointr(fd) != -EBADF); 1936 + } 1937 + 1938 + return -1; 1939 + @@ -1365,7 +1371,7 @@ bool ignore_file(const char *filename) { 1940 + assert(filename); 1941 + 1942 + if (endswith(filename, "~")) 1943 + - return false; 1944 + + return true; 1945 + 1946 + return ignore_file_allow_backup(filename); 1947 + } 1948 + @@ -1495,6 +1501,7 @@ bool fstype_is_network(const char *fstype) { 1949 + static const char table[] = 1950 + "cifs\0" 1951 + "smbfs\0" 1952 + + "sshfs\0" 1953 + "ncpfs\0" 1954 + "ncp\0" 1955 + "nfs\0" 1956 + @@ -1581,8 +1588,9 @@ int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) { 1957 + if (fd_wait_for_event(fileno(f), POLLIN, t) <= 0) 1958 + return -ETIMEDOUT; 1959 + 1960 + + errno = 0; 1961 + if (!fgets(line, sizeof(line), f)) 1962 + - return -EIO; 1963 + + return errno ? -errno : -EIO; 1964 + 1965 + truncate_nl(line); 1966 + 1967 + @@ -5327,6 +5335,9 @@ bool string_is_safe(const char *p) { 1968 + if (*t > 0 && *t < ' ') 1969 + return false; 1970 + 1971 + + if (*t == 127) 1972 + + return false; 1973 + + 1974 + if (strchr("\\\"\'", *t)) 1975 + return false; 1976 + } 1977 + @@ -5343,10 +5354,14 @@ bool string_has_cc(const char *p) { 1978 + 1979 + assert(p); 1980 + 1981 + - for (t = p; *t; t++) 1982 + + for (t = p; *t; t++) { 1983 + if (*t > 0 && *t < ' ' && *t != '\t') 1984 + return true; 1985 + 1986 + + if (*t == 127) 1987 + + return true; 1988 + + } 1989 + + 1990 + return false; 1991 + } 1992 + 1993 + @@ -6391,3 +6406,19 @@ void hexdump(FILE *f, const void *p, size_t s) { 1994 + s -= 16; 1995 + } 1996 + } 1997 + + 1998 + +int update_reboot_param_file(const char *param) 1999 + +{ 2000 + + int r = 0; 2001 + + 2002 + + if (param) { 2003 + + 2004 + + r = write_string_file(REBOOT_PARAM_FILE, param); 2005 + + if (r < 0) 2006 + + log_error("Failed to write reboot param to " 2007 + + REBOOT_PARAM_FILE": %s", strerror(-r)); 2008 + + } else 2009 + + unlink(REBOOT_PARAM_FILE); 2010 + + 2011 + + return r; 2012 + +} 2013 + diff --git a/src/shared/util.h b/src/shared/util.h 2014 + index 90464c9..122ac91 100644 2015 + --- a/src/shared/util.h 2016 + +++ b/src/shared/util.h 2017 + @@ -22,6 +22,7 @@ 2018 + ***/ 2019 + 2020 + #include <alloca.h> 2021 + +#include <fcntl.h> 2022 + #include <inttypes.h> 2023 + #include <time.h> 2024 + #include <sys/time.h> 2025 + @@ -922,3 +923,10 @@ uint64_t physical_memory(void); 2026 + char* mount_test_option(const char *haystack, const char *needle); 2027 + 2028 + void hexdump(FILE *f, const void *p, size_t s); 2029 + + 2030 + +union file_handle_union { 2031 + + struct file_handle handle; 2032 + + char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ]; 2033 + +}; 2034 + + 2035 + +int update_reboot_param_file(const char *param); 2036 + diff --git a/src/shared/virt.c b/src/shared/virt.c 2037 + index ec2ddcf..f03e790 100644 2038 + --- a/src/shared/virt.c 2039 + +++ b/src/shared/virt.c 2040 + @@ -149,7 +149,7 @@ static int detect_vm_dmi(const char **_id) { 2041 + 2042 + /* Returns a short identifier for the various VM implementations */ 2043 + int detect_vm(const char **id) { 2044 + - _cleanup_free_ char *hvtype = NULL, *cpuinfo_contents = NULL; 2045 + + _cleanup_free_ char *domcap = NULL, *cpuinfo_contents = NULL; 2046 + static thread_local int cached_found = -1; 2047 + static thread_local const char *cached_id = NULL; 2048 + const char *_id = NULL; 2049 + @@ -163,17 +163,37 @@ int detect_vm(const char **id) { 2050 + return cached_found; 2051 + } 2052 + 2053 + - /* Try high-level hypervisor sysfs file first: 2054 + + /* Try xen capabilities file first, if not found try high-level hypervisor sysfs file: 2055 + * 2056 + - * https://bugs.freedesktop.org/show_bug.cgi?id=61491 */ 2057 + - r = read_one_line_file("/sys/hypervisor/type", &hvtype); 2058 + + * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */ 2059 + + r = read_one_line_file("/proc/xen/capabilities", &domcap); 2060 + if (r >= 0) { 2061 + - if (streq(hvtype, "xen")) { 2062 + + char *cap, *i = domcap; 2063 + + 2064 + + while ((cap = strsep(&i, ","))) 2065 + + if (streq(cap, "control_d")) 2066 + + break; 2067 + + 2068 + + if (!i) { 2069 + _id = "xen"; 2070 + r = 1; 2071 + - goto finish; 2072 + } 2073 + - } else if (r != -ENOENT) 2074 + + 2075 + + goto finish; 2076 + + 2077 + + } else if (r == -ENOENT) { 2078 + + _cleanup_free_ char *hvtype = NULL; 2079 + + 2080 + + r = read_one_line_file("/sys/hypervisor/type", &hvtype); 2081 + + if (r >= 0) { 2082 + + if (streq(hvtype, "xen")) { 2083 + + _id = "xen"; 2084 + + r = 1; 2085 + + goto finish; 2086 + + } 2087 + + } else if (r != -ENOENT) 2088 + + return r; 2089 + + } else 2090 + return r; 2091 + 2092 + /* this will set _id to "other" and return 0 for unknown hypervisors */ 2093 diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c 2094 + index 0887bc3..d02ee2b 100644 2095 --- a/src/systemctl/systemctl.c 2096 +++ b/src/systemctl/systemctl.c 2097 + @@ -461,7 +461,7 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) { 2098 + } 2099 + 2100 + if (circle_len > 0) 2101 + - printf("%s%s%s", on_circle, circle ? draw_special_char(DRAW_BLACK_CIRCLE) : " ", off_circle); 2102 + + printf("%s%s%s ", on_circle, circle ? draw_special_char(DRAW_BLACK_CIRCLE) : " ", off_circle); 2103 + 2104 + printf("%s%-*s%s %s%-*s%s %s%-*s %-*s%s %-*s", 2105 + on_active, id_len, id, off_active, 2106 @@ -2561,7 +2561,7 @@ static int start_unit_one( 2107 2108 log_debug("Adding %s to the set", p); ··· 2112 return log_oom(); 2113 } 2114 2115 + @@ -4240,7 +4240,7 @@ static int show_all( 2116 + _cleanup_free_ UnitInfo *unit_infos = NULL; 2117 + const UnitInfo *u; 2118 + unsigned c; 2119 + - int r; 2120 + + int r, ret = 0; 2121 + 2122 + r = get_unit_list(bus, NULL, NULL, &unit_infos, 0, &reply); 2123 + if (r < 0) 2124 + @@ -4262,9 +4262,11 @@ static int show_all( 2125 + r = show_one(verb, bus, p, show_properties, new_line, ellipsized); 2126 + if (r < 0) 2127 + return r; 2128 + + else if (r > 0 && ret == 0) 2129 + + ret = r; 2130 + } 2131 + 2132 + - return 0; 2133 + + return ret; 2134 + } 2135 + 2136 + static int show_system_status(sd_bus *bus) { 2137 + @@ -4386,7 +4388,12 @@ static int show(sd_bus *bus, char **args) { 2138 + } 2139 + } 2140 + 2141 + - show_one(args[0], bus, unit, show_properties, &new_line, &ellipsized); 2142 + + r = show_one(args[0], bus, unit, show_properties, 2143 + + &new_line, &ellipsized); 2144 + + if (r < 0) 2145 + + return r; 2146 + + else if (r > 0 && ret == 0) 2147 + + ret = r; 2148 + } 2149 + 2150 + if (!strv_isempty(patterns)) { 2151 + @@ -4403,7 +4410,12 @@ static int show(sd_bus *bus, char **args) { 2152 + if (!unit) 2153 + return log_oom(); 2154 + 2155 + - show_one(args[0], bus, unit, show_properties, &new_line, &ellipsized); 2156 + + r = show_one(args[0], bus, unit, show_properties, 2157 + + &new_line, &ellipsized); 2158 + + if (r < 0) 2159 + + return r; 2160 + + else if (r > 0 && ret == 0) 2161 + + ret = r; 2162 + } 2163 + } 2164 + } 2165 + @@ -5403,15 +5415,15 @@ static int systemctl_help(void) { 2166 + " otherwise restart if active\n" 2167 + " isolate NAME Start one unit and stop all others\n" 2168 + " kill NAME... Send signal to processes of a unit\n" 2169 + - " is-active NAME... Check whether units are active\n" 2170 + - " is-failed NAME... Check whether units are failed\n" 2171 + - " status [NAME...|PID...] Show runtime status of one or more units\n" 2172 + - " show [NAME...|JOB...] Show properties of one or more\n" 2173 + + " is-active PATTERN... Check whether units are active\n" 2174 + + " is-failed PATTERN... Check whether units are failed\n" 2175 + + " status [PATTERN...|PID...] Show runtime status of one or more units\n" 2176 + + " show [PATTERN...|JOB...] Show properties of one or more\n" 2177 + " units/jobs or the manager\n" 2178 + - " cat NAME... Show files and drop-ins of one or more units\n" 2179 + + " cat PATTERN... Show files and drop-ins of one or more units\n" 2180 + " set-property NAME ASSIGNMENT... Sets one or more properties of a unit\n" 2181 + - " help NAME...|PID... Show manual for one or more units\n" 2182 + - " reset-failed [NAME...] Reset failed state for all, one, or more\n" 2183 + + " help PATTERN...|PID... Show manual for one or more units\n" 2184 + + " reset-failed [PATTERN...] Reset failed state for all, one, or more\n" 2185 + " units\n" 2186 + " list-dependencies [NAME] Recursively show units which are required\n" 2187 + " or wanted by this unit or by which this\n" 2188 + @@ -5973,13 +5985,10 @@ static int halt_parse_argv(int argc, char *argv[]) { 2189 + } 2190 + } 2191 + 2192 + - if (arg_action == ACTION_REBOOT && argc == optind + 1) { 2193 + - r = write_string_file(REBOOT_PARAM_FILE, argv[optind]); 2194 + - if (r < 0) { 2195 + - log_error("Failed to write reboot param to " 2196 + - REBOOT_PARAM_FILE": %s", strerror(-r)); 2197 + + if (arg_action == ACTION_REBOOT && (argc == optind || argc == optind + 1)) { 2198 + + r = update_reboot_param_file(argc == optind + 1 ? argv[optind] : NULL); 2199 + + if (r < 0) 2200 + return r; 2201 + - } 2202 + } else if (optind < argc) { 2203 + log_error("Too many arguments."); 2204 + return -EINVAL; 2205 + diff --git a/src/test/test-udev.c b/src/test/test-udev.c 2206 + index b064744..b057cc8 100644 2207 + --- a/src/test/test-udev.c 2208 + +++ b/src/test/test-udev.c 2209 + @@ -155,9 +155,8 @@ int main(int argc, char *argv[]) { 2210 + } 2211 + } 2212 + 2213 + - err = udev_event_execute_rules(event, rules, &sigmask_orig); 2214 + - if (err == 0) 2215 + - udev_event_execute_run(event, NULL); 2216 + + udev_event_execute_rules(event, rules, &sigmask_orig); 2217 + + udev_event_execute_run(event, NULL); 2218 + out: 2219 + if (event != NULL && event->fd_signal >= 0) 2220 + close(event->fd_signal); 2221 + diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c 2222 + index 33e7cbc..04b472d 100644 2223 + --- a/src/tmpfiles/tmpfiles.c 2224 + +++ b/src/tmpfiles/tmpfiles.c 2225 + @@ -217,19 +217,16 @@ static bool unix_socket_alive(const char *fn) { 2226 + } 2227 + 2228 + static int dir_is_mount_point(DIR *d, const char *subdir) { 2229 + - struct file_handle *h; 2230 + + union file_handle_union h = { .handle.handle_bytes = MAX_HANDLE_SZ }; 2231 + int mount_id_parent, mount_id; 2232 + int r_p, r; 2233 + 2234 + - h = alloca(MAX_HANDLE_SZ); 2235 + - 2236 + - h->handle_bytes = MAX_HANDLE_SZ; 2237 + - r_p = name_to_handle_at(dirfd(d), ".", h, &mount_id_parent, 0); 2238 + + r_p = name_to_handle_at(dirfd(d), ".", &h.handle, &mount_id_parent, 0); 2239 + if (r_p < 0) 2240 + r_p = -errno; 2241 + 2242 + - h->handle_bytes = MAX_HANDLE_SZ; 2243 + - r = name_to_handle_at(dirfd(d), subdir, h, &mount_id, 0); 2244 + + h.handle.handle_bytes = MAX_HANDLE_SZ; 2245 + + r = name_to_handle_at(dirfd(d), subdir, &h.handle, &mount_id, 0); 2246 + if (r < 0) 2247 + r = -errno; 2248 + 2249 + diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c 2250 + index 1d067af..3203474 100644 2251 + --- a/src/tty-ask-password-agent/tty-ask-password-agent.c 2252 + +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c 2253 + @@ -432,7 +432,7 @@ static int wall_tty_block(void) { 2254 + 2255 + r = get_ctty_devnr(0, &devnr); 2256 + if (r < 0) 2257 + - return -r; 2258 + + return r; 2259 + 2260 + if (asprintf(&p, "/run/systemd/ask-password-block/%u:%u", major(devnr), minor(devnr)) < 0) 2261 + return -ENOMEM; 2262 + diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c 2263 + index 925d38d..32adf27 100644 2264 + --- a/src/udev/accelerometer/accelerometer.c 2265 + +++ b/src/udev/accelerometer/accelerometer.c 2266 + @@ -180,7 +180,7 @@ get_prev_orientation(struct udev_device *dev) 2267 + return string_to_orientation(value); 2268 + } 2269 + 2270 + -#define SET_AXIS(axis, code_) if (ev[i].code == code_) { if (got_##axis == 0) { axis = ev[i].value; got_##axis = true; } } 2271 + +#define READ_AXIS(axis, var) { memzero(&abs_info, sizeof(abs_info)); r = ioctl(fd, EVIOCGABS(axis), &abs_info); if (r < 0) return; var = abs_info.value; } 2272 + 2273 + /* accelerometers */ 2274 + static void test_orientation(struct udev *udev, 2275 + @@ -189,10 +189,9 @@ static void test_orientation(struct udev *udev, 2276 + { 2277 + OrientationUp old, new; 2278 + _cleanup_close_ int fd = -1; 2279 + - struct input_event ev[64]; 2280 + - bool got_syn = false; 2281 + - bool got_x = false, got_y = false, got_z = false; 2282 + + struct input_absinfo abs_info; 2283 + int x = 0, y = 0, z = 0; 2284 + + int r; 2285 + char text[64]; 2286 + 2287 + old = get_prev_orientation(dev); 2288 + @@ -201,30 +200,10 @@ static void test_orientation(struct udev *udev, 2289 + if (fd < 0) 2290 + return; 2291 + 2292 + - while (1) { 2293 + - int i, r; 2294 + - 2295 + - r = read(fd, ev, sizeof(struct input_event) * 64); 2296 + - 2297 + - if (r < (int) sizeof(struct input_event)) 2298 + - return; 2299 + - 2300 + - for (i = 0; i < r / (int) sizeof(struct input_event); i++) { 2301 + - if (got_syn) { 2302 + - if (ev[i].type == EV_ABS) { 2303 + - SET_AXIS(x, ABS_X); 2304 + - SET_AXIS(y, ABS_Y); 2305 + - SET_AXIS(z, ABS_Z); 2306 + - } 2307 + - } 2308 + - if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) 2309 + - got_syn = true; 2310 + - if (got_x && got_y && got_z) 2311 + - goto read_dev; 2312 + - } 2313 + - } 2314 + + READ_AXIS(ABS_X, x); 2315 + + READ_AXIS(ABS_Y, y); 2316 + + READ_AXIS(ABS_Z, z); 2317 + 2318 + -read_dev: 2319 + new = orientation_calc(old, x, y, z); 2320 + snprintf(text, sizeof(text), 2321 + "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new)); 2322 + diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c 2323 + index 5bb6b02..b31ad80 100644 2324 + --- a/src/udev/net/link-config.c 2325 + +++ b/src/udev/net/link-config.c 2326 + @@ -184,7 +184,7 @@ failure: 2327 + } 2328 + 2329 + static bool enable_name_policy(void) { 2330 + - _cleanup_free_ char *line; 2331 + + _cleanup_free_ char *line = NULL; 2332 + char *w, *state; 2333 + int r; 2334 + size_t l; 2335 + @@ -391,7 +391,9 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev 2336 + case MACPOLICY_PERSISTENT: 2337 + if (!mac_is_permanent(device)) { 2338 + r = get_mac(device, false, &generated_mac); 2339 + - if (r < 0) 2340 + + if (r == -ENOENT) 2341 + + break; 2342 + + else if (r < 0) 2343 + return r; 2344 + mac = &generated_mac; 2345 + } 2346 + @@ -399,7 +401,9 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev 2347 + case MACPOLICY_RANDOM: 2348 + if (!mac_is_random(device)) { 2349 + r = get_mac(device, true, &generated_mac); 2350 + - if (r < 0) 2351 + + if (r == -ENOENT) 2352 + + break; 2353 + + else if (r < 0) 2354 + return r; 2355 + mac = &generated_mac; 2356 + } 2357 + diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c 2358 + index 5998be2..5213a4a 100644 2359 + --- a/src/udev/udev-event.c 2360 + +++ b/src/udev/udev-event.c 2361 + @@ -771,18 +771,17 @@ static int rename_netif(struct udev_event *event) 2362 + log_error("error changing net interface name %s to %s: %s", 2363 + oldname, name, strerror(-r)); 2364 + else 2365 + - print_kmsg("renamed network interface %s to %s", oldname, name); 2366 + + print_kmsg("renamed network interface %s to %s\n", oldname, name); 2367 + 2368 + return r; 2369 + } 2370 + 2371 + -int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) 2372 + +void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) 2373 + { 2374 + struct udev_device *dev = event->dev; 2375 + - int err = 0; 2376 + 2377 + if (udev_device_get_subsystem(dev) == NULL) 2378 + - return -1; 2379 + + return; 2380 + 2381 + if (streq(udev_device_get_action(dev), "remove")) { 2382 + udev_device_read_db(dev, NULL); 2383 + @@ -816,9 +815,10 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, 2384 + event->name != NULL && !streq(event->name, udev_device_get_sysname(dev))) { 2385 + char syspath[UTIL_PATH_SIZE]; 2386 + char *pos; 2387 + + int r; 2388 + 2389 + - err = rename_netif(event); 2390 + - if (err == 0) { 2391 + + r = rename_netif(event); 2392 + + if (r >= 0) { 2393 + log_debug("renamed netif to '%s'", event->name); 2394 + 2395 + /* remember old name */ 2396 + @@ -881,7 +881,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, 2397 + udev_device_unref(event->dev_db); 2398 + event->dev_db = NULL; 2399 + } 2400 + - return err; 2401 + } 2402 + 2403 + void udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) 2404 + diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c 2405 + index 2630264..17f47f2 100644 2406 + --- a/src/udev/udev-rules.c 2407 + +++ b/src/udev/udev-rules.c 2408 + @@ -2555,10 +2555,15 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules) 2409 + struct stat stats; 2410 + 2411 + /* we assure, that the permissions tokens are sorted before the static token */ 2412 + + 2413 + if (mode == 0 && uid == 0 && gid == 0 && tags == NULL) 2414 + goto next; 2415 + 2416 + strscpyl(device_node, sizeof(device_node), "/dev/", rules_str(rules, cur->key.value_off), NULL); 2417 + + if (stat(device_node, &stats) != 0) 2418 + + break; 2419 + + if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) 2420 + + break; 2421 + 2422 + /* export the tags to a directory as symlinks, allowing otherwise dead nodes to be tagged */ 2423 + if (tags) { 2424 + @@ -2588,11 +2593,6 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules) 2425 + if (mode == 0 && uid == 0 && gid == 0) 2426 + break; 2427 + 2428 + - if (stat(device_node, &stats) != 0) 2429 + - break; 2430 + - if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) 2431 + - break; 2432 + - 2433 + if (mode == 0) { 2434 + if (gid > 0) 2435 + mode = 0660; 2436 + diff --git a/src/udev/udev.h b/src/udev/udev.h 2437 + index 936adfb..62538bc 100644 2438 + --- a/src/udev/udev.h 2439 + +++ b/src/udev/udev.h 2440 + @@ -84,7 +84,7 @@ int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, 2441 + int udev_event_spawn(struct udev_event *event, 2442 + const char *cmd, char **envp, const sigset_t *sigmask, 2443 + char *result, size_t ressize); 2444 + -int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); 2445 + +void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); 2446 + void udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); 2447 + int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); 2448 + 2449 + diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c 2450 + index 6cd311b..6a2f548 100644 2451 + --- a/src/udev/udevadm-test.c 2452 + +++ b/src/udev/udevadm-test.c 2453 + @@ -43,7 +43,6 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) 2454 + _cleanup_udev_device_unref_ struct udev_device *dev = NULL; 2455 + _cleanup_udev_event_unref_ struct udev_event *event = NULL; 2456 + sigset_t mask, sigmask_orig; 2457 + - int err; 2458 + int rc = 0, c; 2459 + 2460 + static const struct option options[] = { 2461 + @@ -139,18 +138,16 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) 2462 + goto out; 2463 + } 2464 + 2465 + - err = udev_event_execute_rules(event, rules, &sigmask_orig); 2466 + + udev_event_execute_rules(event, rules, &sigmask_orig); 2467 + 2468 + udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) 2469 + printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); 2470 + 2471 + - if (err == 0) { 2472 + - udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { 2473 + - char program[UTIL_PATH_SIZE]; 2474 + + udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { 2475 + + char program[UTIL_PATH_SIZE]; 2476 + 2477 + - udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); 2478 + - printf("run: '%s'\n", program); 2479 + - } 2480 + + udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); 2481 + + printf("run: '%s'\n", program); 2482 + } 2483 + out: 2484 + if (event != NULL && event->fd_signal >= 0) 2485 + diff --git a/src/udev/udevd.c b/src/udev/udevd.c 2486 + index f21c227..93afca1 100644 2487 + --- a/src/udev/udevd.c 2488 + +++ b/src/udev/udevd.c 2489 + @@ -288,10 +288,9 @@ static void worker_new(struct event *event) 2490 + udev_event->exec_delay = exec_delay; 2491 + 2492 + /* apply rules, create node, symlinks */ 2493 + - err = udev_event_execute_rules(udev_event, rules, &sigmask_orig); 2494 + + udev_event_execute_rules(udev_event, rules, &sigmask_orig); 2495 + 2496 + - if (err == 0) 2497 + - udev_event_execute_run(udev_event, &sigmask_orig); 2498 + + udev_event_execute_run(udev_event, &sigmask_orig); 2499 + 2500 + /* apply/restore inotify watch */ 2501 + if (err == 0 && udev_event->inotify_watch) { 2502 + diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c 2503 + index 0f2b706..645b1e6 100644 2504 + --- a/src/vconsole/vconsole-setup.c 2505 + +++ b/src/vconsole/vconsole-setup.c 2506 + @@ -180,6 +180,10 @@ static int font_load(const char *vc, const char *font, const char *map, const ch 2507 + */ 2508 + static void font_copy_to_all_vcs(int fd) { 2509 + struct vt_stat vcs = {}; 2510 + + unsigned char map8[E_TABSZ]; 2511 + + unsigned short map16[E_TABSZ]; 2512 + + struct unimapdesc unimapd; 2513 + + struct unipair unipairs[USHRT_MAX]; 2514 + int i, r; 2515 + 2516 + /* get active, and 16 bit mask of used VT numbers */ 2517 + @@ -209,17 +213,35 @@ static void font_copy_to_all_vcs(int fd) { 2518 + cfo.op = KD_FONT_OP_COPY; 2519 + cfo.height = vcs.v_active-1; /* tty1 == index 0 */ 2520 + ioctl(vcfd, KDFONTOP, &cfo); 2521 + + 2522 + + /* copy map of 8bit chars */ 2523 + + if (ioctl(fd, GIO_SCRNMAP, map8) >= 0) 2524 + + ioctl(vcfd, PIO_SCRNMAP, map8); 2525 + + 2526 + + /* copy map of 8bit chars -> 16bit Unicode values */ 2527 + + if (ioctl(fd, GIO_UNISCRNMAP, map16) >= 0) 2528 + + ioctl(vcfd, PIO_UNISCRNMAP, map16); 2529 + + 2530 + + /* copy unicode translation table */ 2531 + + /* unimapd is a ushort count and a pointer to an 2532 + + array of struct unipair { ushort, ushort } */ 2533 + + unimapd.entries = unipairs; 2534 + + unimapd.entry_ct = USHRT_MAX; 2535 + + if (ioctl(fd, GIO_UNIMAP, &unimapd) >= 0) { 2536 + + struct unimapinit adv = { 0, 0, 0 }; 2537 + + 2538 + + ioctl(vcfd, PIO_UNIMAPCLR, &adv); 2539 + + ioctl(vcfd, PIO_UNIMAP, &unimapd); 2540 + + } 2541 + } 2542 + } 2543 + 2544 + int main(int argc, char **argv) { 2545 + const char *vc; 2546 + - char *vc_keymap = NULL; 2547 + - char *vc_keymap_toggle = NULL; 2548 + - char *vc_font = NULL; 2549 + - char *vc_font_map = NULL; 2550 + - char *vc_font_unimap = NULL; 2551 + - int fd = -1; 2552 + + _cleanup_free_ char 2553 + + *vc_keymap = NULL, *vc_keymap_toggle = NULL, 2554 + + *vc_font = NULL, *vc_font_map = NULL, *vc_font_unimap = NULL; 2555 + + _cleanup_close_ int fd = -1; 2556 + bool utf8; 2557 + pid_t font_pid = 0, keymap_pid = 0; 2558 + bool font_copy = false; 2559 + @@ -241,12 +263,12 @@ int main(int argc, char **argv) { 2560 + fd = open_terminal(vc, O_RDWR|O_CLOEXEC); 2561 + if (fd < 0) { 2562 + log_error("Failed to open %s: %m", vc); 2563 + - goto finish; 2564 + + return EXIT_FAILURE; 2565 + } 2566 + 2567 + if (!is_vconsole(fd)) { 2568 + log_error("Device %s is not a virtual console.", vc); 2569 + - goto finish; 2570 + + return EXIT_FAILURE; 2571 + } 2572 + 2573 + utf8 = is_locale_utf8(); 2574 + @@ -281,27 +303,27 @@ int main(int argc, char **argv) { 2575 + else 2576 + disable_utf8(fd); 2577 + 2578 + - r = EXIT_FAILURE; 2579 + - if (keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) >= 0 && 2580 + - font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0) 2581 + - r = EXIT_SUCCESS; 2582 + - 2583 + -finish: 2584 + - if (keymap_pid > 0) 2585 + - wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid); 2586 + + r = font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid); 2587 + + if (r < 0) { 2588 + + log_error("Failed to start " KBD_SETFONT ": %s", strerror(-r)); 2589 + + return EXIT_FAILURE; 2590 + + } 2591 + 2592 + - if (font_pid > 0) { 2593 + + if (font_pid > 0) 2594 + wait_for_terminate_and_warn(KBD_SETFONT, font_pid); 2595 + - if (font_copy) 2596 + - font_copy_to_all_vcs(fd); 2597 + + 2598 + + r = keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid); 2599 + + if (r < 0) { 2600 + + log_error("Failed to start " KBD_LOADKEYS ": %s", strerror(-r)); 2601 + + return EXIT_FAILURE; 2602 + } 2603 + 2604 + - free(vc_keymap); 2605 + - free(vc_font); 2606 + - free(vc_font_map); 2607 + - free(vc_font_unimap); 2608 + + if (keymap_pid > 0) 2609 + + wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid); 2610 + 2611 + - safe_close(fd); 2612 + + /* Only copy the font when we started setfont successfully */ 2613 + + if (font_copy && font_pid > 0) 2614 + + font_copy_to_all_vcs(fd); 2615 + 2616 + - return r; 2617 + + return EXIT_SUCCESS; 2618 + } 2619 + diff --git a/tmpfiles.d/systemd.conf b/tmpfiles.d/systemd.conf 2620 + index 7c6d6b9..c470045 100644 2621 + --- a/tmpfiles.d/systemd.conf 2622 + +++ b/tmpfiles.d/systemd.conf 2623 + @@ -23,6 +23,6 @@ d /run/systemd/machines 0755 root root - 2624 + d /run/systemd/shutdown 0755 root root - 2625 + 2626 + m /var/log/journal 2755 root systemd-journal - - 2627 + -m /var/log/journal/%m 2755 root systemd-journal - - 2628 + +Z /var/log/journal/%m 2755 root systemd-journal - - 2629 + m /run/log/journal 2755 root systemd-journal - - 2630 + -m /run/log/journal/%m 2755 root systemd-journal - - 2631 + +Z /run/log/journal/%m 2755 root systemd-journal - - 2632 diff --git a/units/console-getty.service.m4.in b/units/console-getty.service.m4.in 2633 index 8ac51a4..cae9fb5 100644 2634 --- a/units/console-getty.service.m4.in ··· 2731 ExecStart=-/sbin/sulogin 2732 ExecStopPost=-@SYSTEMCTL@ --fail --no-block default 2733 diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4 2734 + index 4ac51e7..96daa5c 100644 2735 --- a/units/serial-getty@.service.m4 2736 +++ b/units/serial-getty@.service.m4 2737 + @@ -22,10 +22,8 @@ Before=getty.target 2738 IgnoreOnIsolate=yes 2739 2740 [Service] 2741 -ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM 2742 Type=idle 2743 Restart=always 2744 + -RestartSec=0 2745 + UtmpIdentifier=%I 2746 + TTYPath=/dev/%I 2747 + TTYReset=yes 2748 diff --git a/units/sysinit.target b/units/sysinit.target 2749 index 8f4fb8f..e0f0147 100644 2750 --- a/units/sysinit.target ··· 2794 +# journald to stop logging (see 2795 +# https://bugs.freedesktop.org/show_bug.cgi?id=56043). 2796 +X-RestartIfChanged=no 2797 + diff --git a/units/systemd-nspawn@.service.in b/units/systemd-nspawn@.service.in 2798 + index ff36e90..e373628 100644 2799 + --- a/units/systemd-nspawn@.service.in 2800 + +++ b/units/systemd-nspawn@.service.in 2801 + @@ -11,6 +11,7 @@ Documentation=man:systemd-nspawn(1) 2802 + 2803 + [Service] 2804 + ExecStart=@bindir@/systemd-nspawn --quiet --keep-unit --boot --link-journal=guest --directory=/var/lib/container/%i 2805 + +KillMode=mixed 2806 + Type=notify 2807 + 2808 + [Install] 2809 diff --git a/units/systemd-random-seed.service.in b/units/systemd-random-seed.service.in 2810 index 1879b2f..9b895b9 100644 2811 --- a/units/systemd-random-seed.service.in
+15 -15
pkgs/servers/x11/xorg/default.nix
··· 915 }) // {inherit ;}; 916 917 libxcb = (mkDerivation "libxcb" { 918 - name = "libxcb-1.10"; 919 builder = ./builder.sh; 920 src = fetchurl { 921 - url = http://xcb.freedesktop.org/dist/libxcb-1.10.tar.bz2; 922 - sha256 = "1dfmyb1zjx6n0zhr4y40mc1crlmj3bfjjhmn0f30ip9nnq2spncq"; 923 }; 924 buildInputs = [pkgconfig libxslt libpthreadstubs python libXau xcbproto libXdmcp ]; 925 }) // {inherit libxslt libpthreadstubs python libXau xcbproto libXdmcp ;}; ··· 1175 }) // {inherit ;}; 1176 1177 xcbproto = (mkDerivation "xcbproto" { 1178 - name = "xcb-proto-1.10"; 1179 builder = ./builder.sh; 1180 src = fetchurl { 1181 - url = http://xcb.freedesktop.org/dist/xcb-proto-1.10.tar.bz2; 1182 - sha256 = "01dgp802i4ic9wkmpa7g1wm50pp547d3b96jjz2hnxavhpfhvx3y"; 1183 }; 1184 buildInputs = [pkgconfig python ]; 1185 }) // {inherit python ;}; ··· 1405 }) // {inherit inputproto xorgserver xproto ;}; 1406 1407 xf86inputmouse = (mkDerivation "xf86inputmouse" { 1408 - name = "xf86-input-mouse-1.9.0"; 1409 builder = ./builder.sh; 1410 src = fetchurl { 1411 - url = mirror://xorg/individual/driver/xf86-input-mouse-1.9.0.tar.bz2; 1412 - sha256 = "12344w0cxac1ld54qqwynxwazbmmpvqh1mzcskmfkmakmr5iwq2x"; 1413 }; 1414 buildInputs = [pkgconfig inputproto xorgserver xproto ]; 1415 }) // {inherit inputproto xorgserver xproto ;}; ··· 1515 }) // {inherit fontsproto libpciaccess randrproto renderproto videoproto xorgserver xproto ;}; 1516 1517 xf86videogeode = (mkDerivation "xf86videogeode" { 1518 - name = "xf86-video-geode-2.11.15"; 1519 builder = ./builder.sh; 1520 src = fetchurl { 1521 - url = mirror://xorg/individual/driver/xf86-video-geode-2.11.15.tar.bz2; 1522 - sha256 = "1w4ghr2a41kaw4g9na8ws5fjbmy8zkbxpxa21vmqc8mkjzb3pnq0"; 1523 }; 1524 buildInputs = [pkgconfig fontsproto libpciaccess randrproto renderproto videoproto xextproto xorgserver xproto ]; 1525 }) // {inherit fontsproto libpciaccess randrproto renderproto videoproto xextproto xorgserver xproto ;}; ··· 2035 }) // {inherit ;}; 2036 2037 xrandr = (mkDerivation "xrandr" { 2038 - name = "xrandr-1.4.2"; 2039 builder = ./builder.sh; 2040 src = fetchurl { 2041 - url = mirror://xorg/individual/app/xrandr-1.4.2.tar.bz2; 2042 - sha256 = "1g4hnj53wknsjwiqivyy3jl4qw7jwrpncz7d5p2z29zq5zlnxrxj"; 2043 }; 2044 buildInputs = [pkgconfig libX11 xproto libXrandr libXrender ]; 2045 }) // {inherit libX11 xproto libXrandr libXrender ;};
··· 915 }) // {inherit ;}; 916 917 libxcb = (mkDerivation "libxcb" { 918 + name = "libxcb-1.11"; 919 builder = ./builder.sh; 920 src = fetchurl { 921 + url = http://xcb.freedesktop.org/dist/libxcb-1.11.tar.bz2; 922 + sha256 = "1xqgc81krx14f2c8yl5chzg5g2l26mhm2rwffy8dx7jv0iq5sqq3"; 923 }; 924 buildInputs = [pkgconfig libxslt libpthreadstubs python libXau xcbproto libXdmcp ]; 925 }) // {inherit libxslt libpthreadstubs python libXau xcbproto libXdmcp ;}; ··· 1175 }) // {inherit ;}; 1176 1177 xcbproto = (mkDerivation "xcbproto" { 1178 + name = "xcb-proto-1.11"; 1179 builder = ./builder.sh; 1180 src = fetchurl { 1181 + url = http://xcb.freedesktop.org/dist/xcb-proto-1.11.tar.bz2; 1182 + sha256 = "0bp3f53l9fy5x3mn1rkj1g81aiyzl90wacwvqdgy831aa3kfxb5l"; 1183 }; 1184 buildInputs = [pkgconfig python ]; 1185 }) // {inherit python ;}; ··· 1405 }) // {inherit inputproto xorgserver xproto ;}; 1406 1407 xf86inputmouse = (mkDerivation "xf86inputmouse" { 1408 + name = "xf86-input-mouse-1.9.1"; 1409 builder = ./builder.sh; 1410 src = fetchurl { 1411 + url = mirror://xorg/individual/driver/xf86-input-mouse-1.9.1.tar.bz2; 1412 + sha256 = "1kn5kx3qyn9qqvd6s24a2l1wfgck2pgfvzl90xpl024wfxsx719l"; 1413 }; 1414 buildInputs = [pkgconfig inputproto xorgserver xproto ]; 1415 }) // {inherit inputproto xorgserver xproto ;}; ··· 1515 }) // {inherit fontsproto libpciaccess randrproto renderproto videoproto xorgserver xproto ;}; 1516 1517 xf86videogeode = (mkDerivation "xf86videogeode" { 1518 + name = "xf86-video-geode-2.11.16"; 1519 builder = ./builder.sh; 1520 src = fetchurl { 1521 + url = mirror://xorg/individual/driver/xf86-video-geode-2.11.16.tar.bz2; 1522 + sha256 = "19y13xl7yfrgyis92rmxi0ld95ajgr5il0n9j1dridwzw9aizz1q"; 1523 }; 1524 buildInputs = [pkgconfig fontsproto libpciaccess randrproto renderproto videoproto xextproto xorgserver xproto ]; 1525 }) // {inherit fontsproto libpciaccess randrproto renderproto videoproto xextproto xorgserver xproto ;}; ··· 2035 }) // {inherit ;}; 2036 2037 xrandr = (mkDerivation "xrandr" { 2038 + name = "xrandr-1.4.3"; 2039 builder = ./builder.sh; 2040 src = fetchurl { 2041 + url = mirror://xorg/individual/app/xrandr-1.4.3.tar.bz2; 2042 + sha256 = "06xy0kr6ih7ilrwl6b5g6ay75vm2j4lxnv1d5xlj6sdqhqsaqm3i"; 2043 }; 2044 buildInputs = [pkgconfig libX11 xproto libXrandr libXrender ]; 2045 }) // {inherit libX11 xproto libXrandr libXrender ;};
+2 -2
pkgs/servers/x11/xorg/extra.list
··· 1 http://xcb.freedesktop.org/dist/libpthread-stubs-0.3.tar.bz2 2 - http://xcb.freedesktop.org/dist/libxcb-1.10.tar.bz2 3 - http://xcb.freedesktop.org/dist/xcb-proto-1.10.tar.bz2 4 http://xcb.freedesktop.org/dist/xcb-util-0.3.9.tar.bz2 5 http://xcb.freedesktop.org/dist/xcb-util-image-0.3.9.tar.bz2 6 http://xcb.freedesktop.org/dist/xcb-util-keysyms-0.3.9.tar.bz2
··· 1 http://xcb.freedesktop.org/dist/libpthread-stubs-0.3.tar.bz2 2 + http://xcb.freedesktop.org/dist/libxcb-1.11.tar.bz2 3 + http://xcb.freedesktop.org/dist/xcb-proto-1.11.tar.bz2 4 http://xcb.freedesktop.org/dist/xcb-util-0.3.9.tar.bz2 5 http://xcb.freedesktop.org/dist/xcb-util-image-0.3.9.tar.bz2 6 http://xcb.freedesktop.org/dist/xcb-util-keysyms-0.3.9.tar.bz2
+3 -3
pkgs/servers/x11/xorg/tarballs-7.7.list
··· 118 mirror://xorg/individual/driver/xf86-input-evdev-2.8.4.tar.bz2 119 mirror://xorg/individual/driver/xf86-input-joystick-1.6.2.tar.bz2 120 mirror://xorg/individual/driver/xf86-input-keyboard-1.8.0.tar.bz2 121 - mirror://xorg/individual/driver/xf86-input-mouse-1.9.0.tar.bz2 122 mirror://xorg/individual/driver/xf86-input-synaptics-1.7.6.tar.bz2 123 mirror://xorg/individual/driver/xf86-input-vmmouse-13.0.0.tar.bz2 124 mirror://xorg/individual/driver/xf86-input-void-1.4.0.tar.bz2 ··· 130 mirror://xorg/individual/driver/xf86-video-cirrus-1.5.2.tar.bz2 131 mirror://xorg/individual/driver/xf86-video-dummy-0.3.7.tar.bz2 132 mirror://xorg/individual/driver/xf86-video-fbdev-0.4.4.tar.bz2 133 - mirror://xorg/individual/driver/xf86-video-geode-2.11.15.tar.bz2 134 mirror://xorg/individual/driver/xf86-video-glide-1.2.2.tar.bz2 135 mirror://xorg/individual/driver/xf86-video-glint-1.2.8.tar.bz2 136 mirror://xorg/individual/driver/xf86-video-i128-1.3.6.tar.bz2 ··· 176 mirror://xorg/X11R7.7/src/everything/xpr-1.0.4.tar.bz2 177 mirror://xorg/individual/app/xprop-1.2.2.tar.bz2 178 mirror://xorg/individual/proto/xproto-7.0.26.tar.bz2 179 - mirror://xorg/individual/app/xrandr-1.4.2.tar.bz2 180 mirror://xorg/individual/app/xrdb-1.1.0.tar.bz2 181 mirror://xorg/individual/app/xrefresh-1.0.5.tar.bz2 182 mirror://xorg/individual/app/xset-1.2.3.tar.bz2
··· 118 mirror://xorg/individual/driver/xf86-input-evdev-2.8.4.tar.bz2 119 mirror://xorg/individual/driver/xf86-input-joystick-1.6.2.tar.bz2 120 mirror://xorg/individual/driver/xf86-input-keyboard-1.8.0.tar.bz2 121 + mirror://xorg/individual/driver/xf86-input-mouse-1.9.1.tar.bz2 122 mirror://xorg/individual/driver/xf86-input-synaptics-1.7.6.tar.bz2 123 mirror://xorg/individual/driver/xf86-input-vmmouse-13.0.0.tar.bz2 124 mirror://xorg/individual/driver/xf86-input-void-1.4.0.tar.bz2 ··· 130 mirror://xorg/individual/driver/xf86-video-cirrus-1.5.2.tar.bz2 131 mirror://xorg/individual/driver/xf86-video-dummy-0.3.7.tar.bz2 132 mirror://xorg/individual/driver/xf86-video-fbdev-0.4.4.tar.bz2 133 + mirror://xorg/individual/driver/xf86-video-geode-2.11.16.tar.bz2 134 mirror://xorg/individual/driver/xf86-video-glide-1.2.2.tar.bz2 135 mirror://xorg/individual/driver/xf86-video-glint-1.2.8.tar.bz2 136 mirror://xorg/individual/driver/xf86-video-i128-1.3.6.tar.bz2 ··· 176 mirror://xorg/X11R7.7/src/everything/xpr-1.0.4.tar.bz2 177 mirror://xorg/individual/app/xprop-1.2.2.tar.bz2 178 mirror://xorg/individual/proto/xproto-7.0.26.tar.bz2 179 + mirror://xorg/individual/app/xrandr-1.4.3.tar.bz2 180 mirror://xorg/individual/app/xrdb-1.1.0.tar.bz2 181 mirror://xorg/individual/app/xrefresh-1.0.5.tar.bz2 182 mirror://xorg/individual/app/xset-1.2.3.tar.bz2
+2 -1
pkgs/stdenv/generic/default.nix
··· 154 || system == "x86_64-kfreebsd-gnu"; 155 isSunOS = system == "i686-solaris" 156 || system == "x86_64-solaris"; 157 - isCygwin = system == "i686-cygwin"; 158 isFreeBSD = system == "i686-freebsd" 159 || system == "x86_64-freebsd"; 160 isOpenBSD = system == "i686-openbsd"
··· 154 || system == "x86_64-kfreebsd-gnu"; 155 isSunOS = system == "i686-solaris" 156 || system == "x86_64-solaris"; 157 + isCygwin = system == "i686-cygwin" 158 + || system == "x86_64-cygwin"; 159 isFreeBSD = system == "i686-freebsd" 160 || system == "x86_64-freebsd"; 161 isOpenBSD = system == "i686-openbsd"
+135 -153
pkgs/stdenv/linux/default.nix
··· 35 # The bootstrap process proceeds in several steps. 36 37 38 - # 1) Create a standard environment by downloading pre-built binaries 39 - # of coreutils, GCC, etc. 40 41 42 # Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...). ··· 46 builder = bootstrapFiles.sh; 47 48 args = 49 - if system == "armv5tel-linux" || system == "armv6l-linux" 50 || system == "armv7l-linux" 51 then [ ./scripts/unpack-bootstrap-tools-arm.sh ] 52 else [ ./scripts/unpack-bootstrap-tools.sh ]; ··· 66 }; 67 68 69 - # This function builds the various standard environments used during 70 - # the bootstrap. 71 - stdenvBootFun = 72 - {gcc, extraAttrs ? {}, overrides ? (pkgs: {}), extraPath ? [], fetchurl}: 73 74 - import ../generic { 75 - inherit system config; 76 - name = "stdenv-linux-boot"; 77 - preHook = 78 - '' 79 - # Don't patch #!/interpreter because it leads to retained 80 - # dependencies on the bootstrapTools in the final stdenv. 81 - dontPatchShebangs=1 82 - ${commonPreHook} 83 - ''; 84 - shell = "${bootstrapTools}/bin/sh"; 85 - initialPath = [bootstrapTools] ++ extraPath; 86 - fetchurlBoot = fetchurl; 87 - inherit gcc; 88 - # Having the proper 'platform' in all the stdenvs allows getting proper 89 - # linuxHeaders for example. 90 - extraAttrs = extraAttrs // { inherit platform; }; 91 - overrides = pkgs: (overrides pkgs) // { 92 - inherit fetchurl; 93 - }; 94 }; 95 96 - # Build a dummy stdenv with no GCC or working fetchurl. This is 97 - # because we need a stdenv to build the GCC wrapper and fetchurl. 98 - stdenvLinuxBoot0 = stdenvBootFun { 99 - gcc = "/no-such-path"; 100 - fetchurl = null; 101 - }; 102 103 104 - fetchurl = import ../../build-support/fetchurl { 105 - stdenv = stdenvLinuxBoot0; 106 - curl = bootstrapTools; 107 - }; 108 109 110 - # The Glibc include directory cannot have the same prefix as the GCC 111 - # include directory, since GCC gets confused otherwise (it will 112 - # search the Glibc headers before the GCC headers). So create a 113 - # dummy Glibc. 114 - bootstrapGlibc = stdenvLinuxBoot0.mkDerivation { 115 - name = "bootstrap-glibc"; 116 - buildCommand = '' 117 - mkdir -p $out 118 - ln -s ${bootstrapTools}/lib $out/lib 119 - ln -s ${bootstrapTools}/include-glibc $out/include 120 - ''; 121 - }; 122 123 124 - # A helper function to call gcc-wrapper. 125 - wrapGCC = 126 - { gcc ? bootstrapTools, libc, binutils, coreutils, shell ? "", name ? "bootstrap-gcc-wrapper" }: 127 128 - lib.makeOverridable (import ../../build-support/gcc-wrapper) { 129 - nativeTools = false; 130 - nativeLibc = false; 131 - inherit gcc binutils coreutils libc shell name; 132 - stdenv = stdenvLinuxBoot0; 133 }; 134 135 136 # Create the first "real" standard environment. This one consists 137 # of bootstrap tools only, and a minimal Glibc to keep the GCC 138 # configure script happy. 139 - stdenvLinuxBoot1 = stdenvBootFun { 140 gcc = wrapGCC { 141 - libc = bootstrapGlibc; 142 binutils = bootstrapTools; 143 coreutils = bootstrapTools; 144 }; 145 - inherit fetchurl; 146 - }; 147 - 148 - 149 - # 2) These are the packages that we can build with the first 150 - # stdenv. We only need binutils, because recent Glibcs 151 - # require recent Binutils, and those in bootstrap-tools may 152 - # be too old. 153 - stdenvLinuxBoot1Pkgs = allPackages { 154 - inherit system platform; 155 - bootStdenv = stdenvLinuxBoot1; 156 }; 157 158 - binutils1 = stdenvLinuxBoot1Pkgs.binutils.override { gold = false; }; 159 160 - 161 - # 3) 2nd stdenv that we will use to build only Glibc. 162 - stdenvLinuxBoot2 = stdenvBootFun { 163 gcc = wrapGCC { 164 - libc = bootstrapGlibc; 165 - binutils = binutils1; 166 coreutils = bootstrapTools; 167 }; 168 overrides = pkgs: { 169 - inherit (stdenvLinuxBoot1Pkgs) perl; 170 }; 171 - inherit fetchurl; 172 }; 173 174 175 - # 4) These are the packages that we can build with the 2nd 176 - # stdenv. 177 - stdenvLinuxBoot2Pkgs = allPackages { 178 - inherit system platform; 179 - bootStdenv = stdenvLinuxBoot2; 180 - }; 181 - 182 - 183 - # 5) Build Glibc with the bootstrap tools. The result is the full, 184 - # dynamically linked, final Glibc. 185 - stdenvLinuxGlibc = stdenvLinuxBoot2Pkgs.glibc; 186 - 187 - 188 - # 6) Construct a third stdenv identical to the 2nd, except that this 189 - # one uses the Glibc built in step 5. It still uses the recent 190 - # binutils and rest of the bootstrap tools, including GCC. 191 - stdenvLinuxBoot3 = stdenvBootFun { 192 gcc = wrapGCC { 193 - binutils = binutils1; 194 coreutils = bootstrapTools; 195 - libc = stdenvLinuxGlibc; 196 }; 197 overrides = pkgs: { 198 - glibc = stdenvLinuxGlibc; 199 - inherit (stdenvLinuxBoot1Pkgs) perl; 200 # Link GCC statically against GMP etc. This makes sense because 201 # these builds of the libraries are only used by GCC, so it 202 # reduces the size of the stdenv closure. ··· 208 ppl = pkgs.ppl.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; }; 209 }; 210 extraAttrs = { 211 - glibc = stdenvLinuxGlibc; # Required by gcc47 build 212 }; 213 - extraPath = [ stdenvLinuxBoot1Pkgs.paxctl ]; 214 - inherit fetchurl; 215 - }; 216 - 217 - 218 - # 7) The packages that can be built using the third stdenv. 219 - stdenvLinuxBoot3Pkgs = allPackages { 220 - inherit system platform; 221 - bootStdenv = stdenvLinuxBoot3; 222 }; 223 224 225 - # 8) Construct a fourth stdenv identical to the second, except that 226 - # this one uses the new GCC from step 7. The other tools 227 - # (e.g. coreutils) are still from the bootstrap tools. 228 - stdenvLinuxBoot4 = stdenvBootFun { 229 - gcc = wrapGCC rec { 230 - binutils = binutils1; 231 coreutils = bootstrapTools; 232 - libc = stdenvLinuxGlibc; 233 - gcc = stdenvLinuxBoot3Pkgs.gcc.gcc; 234 name = ""; 235 }; 236 - extraPath = [ stdenvLinuxBoot3Pkgs.xz ]; 237 overrides = pkgs: { 238 - inherit (stdenvLinuxBoot1Pkgs) perl; 239 - inherit (stdenvLinuxBoot3Pkgs) gettext gnum4 gmp; 240 }; 241 - inherit fetchurl; 242 }; 243 244 245 - # 9) The packages that can be built using the fourth stdenv. 246 - stdenvLinuxBoot4Pkgs = allPackages { 247 - inherit system platform; 248 - bootStdenv = stdenvLinuxBoot4; 249 - }; 250 - 251 - 252 - # 10) Construct the final stdenv. It uses the Glibc and GCC, and 253 - # adds in a new binutils that doesn't depend on bootstrap-tools, 254 - # as well as dynamically linked versions of all other tools. 255 # 256 - # When updating stdenvLinux, make sure that the result has no 257 - # dependency (`nix-store -qR') on bootstrapTools or the 258 - # first binutils built. 259 stdenvLinux = import ../generic rec { 260 inherit system config; 261 ··· 268 ''; 269 270 initialPath = 271 - ((import ../common-path.nix) {pkgs = stdenvLinuxBoot4Pkgs;}) 272 - ++ [stdenvLinuxBoot4Pkgs.patchelf stdenvLinuxBoot4Pkgs.paxctl ]; 273 274 - gcc = wrapGCC rec { 275 - inherit (stdenvLinuxBoot4Pkgs) binutils coreutils; 276 - libc = stdenvLinuxGlibc; 277 - gcc = stdenvLinuxBoot4.gcc.gcc; 278 - shell = stdenvLinuxBoot4Pkgs.bash + "/bin/bash"; 279 - name = ""; 280 - }; 281 282 - shell = stdenvLinuxBoot4Pkgs.bash + "/bin/bash"; 283 284 - fetchurlBoot = fetchurl; 285 286 extraAttrs = { 287 - inherit (stdenvLinuxBoot3Pkgs) glibc; 288 inherit platform bootstrapTools; 289 - shellPackage = stdenvLinuxBoot4Pkgs.bash; 290 }; 291 292 overrides = pkgs: { 293 inherit gcc; 294 - inherit (stdenvLinuxBoot3Pkgs) glibc; 295 - inherit (stdenvLinuxBoot4Pkgs) binutils; 296 - inherit (stdenvLinuxBoot4Pkgs) 297 - gzip bzip2 xz bash coreutils diffutils findutils gawk 298 - gnumake gnused gnutar gnugrep gnupatch patchelf 299 - attr acl paxctl; 300 }; 301 }; 302
··· 35 # The bootstrap process proceeds in several steps. 36 37 38 + # Create a standard environment by downloading pre-built binaries of 39 + # coreutils, GCC, etc. 40 41 42 # Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...). ··· 46 builder = bootstrapFiles.sh; 47 48 args = 49 + if system == "armv5tel-linux" || system == "armv6l-linux" 50 || system == "armv7l-linux" 51 then [ ./scripts/unpack-bootstrap-tools-arm.sh ] 52 else [ ./scripts/unpack-bootstrap-tools.sh ]; ··· 66 }; 67 68 69 + # A helper function to call gcc-wrapper. 70 + wrapGCC = 71 + { gcc, libc, binutils, coreutils, name }: 72 73 + lib.makeOverridable (import ../../build-support/gcc-wrapper) { 74 + nativeTools = false; 75 + nativeLibc = false; 76 + inherit gcc binutils coreutils libc name; 77 + stdenv = stage0.stdenv; 78 }; 79 80 81 + # This function builds the various standard environments used during 82 + # the bootstrap. In all stages, we build an stdenv and the package 83 + # set that can be built with that stdenv. 84 + stageFun = 85 + {gcc, extraAttrs ? {}, overrides ? (pkgs: {}), extraPath ? []}: 86 87 + let 88 89 + thisStdenv = import ../generic { 90 + inherit system config; 91 + name = "stdenv-linux-boot"; 92 + preHook = 93 + '' 94 + # Don't patch #!/interpreter because it leads to retained 95 + # dependencies on the bootstrapTools in the final stdenv. 96 + dontPatchShebangs=1 97 + ${commonPreHook} 98 + ''; 99 + shell = "${bootstrapTools}/bin/sh"; 100 + initialPath = [bootstrapTools] ++ extraPath; 101 + fetchurlBoot = import ../../build-support/fetchurl { 102 + stdenv = stage0.stdenv; 103 + curl = bootstrapTools; 104 + }; 105 + inherit gcc; 106 + # Having the proper 'platform' in all the stdenvs allows getting proper 107 + # linuxHeaders for example. 108 + extraAttrs = extraAttrs // { inherit platform; }; 109 + overrides = pkgs: (overrides pkgs) // { fetchurl = thisStdenv.fetchurlBoot; }; 110 + }; 111 112 + thisPkgs = allPackages { 113 + inherit system platform; 114 + bootStdenv = thisStdenv; 115 + }; 116 117 + in { stdenv = thisStdenv; pkgs = thisPkgs; }; 118 119 120 + # Build a dummy stdenv with no GCC or working fetchurl. This is 121 + # because we need a stdenv to build the GCC wrapper and fetchurl. 122 + stage0 = stageFun { 123 + gcc = "/no-such-path"; 124 + 125 + overrides = pkgs: { 126 + # The Glibc include directory cannot have the same prefix as the 127 + # GCC include directory, since GCC gets confused otherwise (it 128 + # will search the Glibc headers before the GCC headers). So 129 + # create a dummy Glibc here, which will be used in the stdenv of 130 + # stage1. 131 + glibc = stage0.stdenv.mkDerivation { 132 + name = "bootstrap-glibc"; 133 + buildCommand = '' 134 + mkdir -p $out 135 + ln -s ${bootstrapTools}/lib $out/lib 136 + ln -s ${bootstrapTools}/include-glibc $out/include 137 + ''; 138 + }; 139 }; 140 + }; 141 142 143 # Create the first "real" standard environment. This one consists 144 # of bootstrap tools only, and a minimal Glibc to keep the GCC 145 # configure script happy. 146 + # 147 + # For clarity, we only use the previous stage when specifying these 148 + # stages. So stageN should only ever have references for stage{N-1}. 149 + # 150 + # If we ever need to use a package from more than one stage back, we 151 + # simply re-export those packages in the middle stage(s) using the 152 + # overrides attribute and the inherit syntax. 153 + stage1 = stageFun { 154 gcc = wrapGCC { 155 + gcc = bootstrapTools; 156 + libc = stage0.pkgs.glibc; 157 binutils = bootstrapTools; 158 coreutils = bootstrapTools; 159 + name = "bootstrap-gcc-wrapper"; 160 }; 161 + # Rebuild binutils to use from stage2 onwards. 162 + overrides = pkgs: { 163 + binutils = pkgs.binutils.override { gold = false; }; 164 + inherit (stage0.pkgs) glibc; 165 + }; 166 }; 167 168 169 + # 2nd stdenv that contains our own rebuilt binutils and is used for 170 + # compiling our own Glibc. 171 + stage2 = stageFun { 172 gcc = wrapGCC { 173 + gcc = bootstrapTools; 174 + libc = stage1.pkgs.glibc; 175 + binutils = stage1.pkgs.binutils; 176 coreutils = bootstrapTools; 177 + name = "bootstrap-gcc-wrapper"; 178 }; 179 overrides = pkgs: { 180 + inherit (stage1.pkgs) perl binutils paxctl; 181 + # This also contains the full, dynamically linked, final Glibc. 182 }; 183 }; 184 185 186 + # Construct a third stdenv identical to the 2nd, except that this 187 + # one uses the rebuilt Glibc from stage2. It still uses the recent 188 + # binutils and rest of the bootstrap tools, including GCC. 189 + stage3 = stageFun { 190 gcc = wrapGCC { 191 + gcc = bootstrapTools; 192 + libc = stage2.pkgs.glibc; 193 + binutils = stage2.pkgs.binutils; 194 coreutils = bootstrapTools; 195 + name = "bootstrap-gcc-wrapper"; 196 }; 197 overrides = pkgs: { 198 + inherit (stage2.pkgs) binutils glibc perl; 199 # Link GCC statically against GMP etc. This makes sense because 200 # these builds of the libraries are only used by GCC, so it 201 # reduces the size of the stdenv closure. ··· 207 ppl = pkgs.ppl.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; }; 208 }; 209 extraAttrs = { 210 + glibc = stage2.pkgs.glibc; # Required by gcc47 build 211 }; 212 + extraPath = [ stage2.pkgs.paxctl ]; 213 }; 214 215 216 + # Construct a fourth stdenv that uses the new GCC. But coreutils is 217 + # still from the bootstrap tools. 218 + stage4 = stageFun { 219 + gcc = wrapGCC { 220 + gcc = stage3.pkgs.gcc.gcc; 221 + libc = stage3.pkgs.glibc; 222 + binutils = stage3.pkgs.binutils; 223 coreutils = bootstrapTools; 224 name = ""; 225 }; 226 + extraPath = [ stage3.pkgs.xz ]; 227 overrides = pkgs: { 228 + # Zlib has to be inherited and not rebuilt in this stage, 229 + # because gcc (since JAR support) already depends on zlib, and 230 + # then if we already have a zlib we want to use that for the 231 + # other purposes (binutils and top-level pkgs) too. 232 + inherit (stage3.pkgs) gettext gnum4 gmp perl glibc zlib; 233 }; 234 }; 235 236 237 + # Construct the final stdenv. It uses the Glibc and GCC, and adds 238 + # in a new binutils that doesn't depend on bootstrap-tools, as well 239 + # as dynamically linked versions of all other tools. 240 # 241 + # When updating stdenvLinux, make sure that the result has no 242 + # dependency (`nix-store -qR') on bootstrapTools or the first 243 + # binutils built. 244 stdenvLinux = import ../generic rec { 245 inherit system config; 246 ··· 253 ''; 254 255 initialPath = 256 + ((import ../common-path.nix) {pkgs = stage4.pkgs;}) 257 + ++ [stage4.pkgs.patchelf stage4.pkgs.paxctl ]; 258 259 + shell = stage4.pkgs.bash + "/bin/bash"; 260 261 + gcc = (wrapGCC rec { 262 + gcc = stage4.stdenv.gcc.gcc; 263 + libc = stage4.pkgs.glibc; 264 + inherit (stage4.pkgs) binutils coreutils; 265 + name = ""; 266 + }).override { inherit shell; }; 267 268 + inherit (stage4.stdenv) fetchurlBoot; 269 270 extraAttrs = { 271 + inherit (stage4.pkgs) glibc; 272 inherit platform bootstrapTools; 273 + shellPackage = stage4.pkgs.bash; 274 }; 275 276 overrides = pkgs: { 277 inherit gcc; 278 + inherit (stage4.pkgs) 279 + gzip bzip2 xz bash binutils coreutils diffutils findutils gawk 280 + glibc gnumake gnused gnutar gnugrep gnupatch patchelf 281 + attr acl paxctl zlib; 282 }; 283 }; 284
+3
pkgs/tools/compression/xz/default.nix
··· 10 11 doCheck = true; 12 13 meta = { 14 homepage = http://tukaani.org/xz/; 15 description = "XZ, general-purpose data compression software, successor of LZMA";
··· 10 11 doCheck = true; 12 13 + # In stdenv-linux, prevent a dependency on bootstrap-tools. 14 + preHook = "unset CONFIG_SHELL"; 15 + 16 meta = { 17 homepage = http://tukaani.org/xz/; 18 description = "XZ, general-purpose data compression software, successor of LZMA";
+3 -7
pkgs/top-level/all-packages.nix
··· 2627 2628 bashInteractive = appendToName "interactive" (callPackage ../shells/bash { 2629 interactive = true; 2630 - readline = readline63; # Includes many vi mode fixes 2631 }); 2632 2633 bashCompletion = callPackage ../shells/bash-completion { }; ··· 3684 suitesparse = null; 3685 openjdk = null; 3686 gnuplot = null; 3687 - readline = readline63; 3688 }; 3689 octaveFull = (lowPrio (callPackage ../development/interpreters/octave { 3690 fltk = fltk13; ··· 4372 gdb = callPackage ../development/tools/misc/gdb { 4373 guile = null; 4374 hurd = gnu.hurdCross; 4375 - readline = readline63; 4376 inherit (gnu) mig; 4377 }; 4378 ··· 6215 6216 raul = callPackage ../development/libraries/audio/raul { }; 6217 6218 - readline = readline6; # 6.2 works, 6.3 breaks python, parted 6219 - 6220 - readline4 = callPackage ../development/libraries/readline/readline4.nix { }; 6221 6222 readline5 = callPackage ../development/libraries/readline/readline5.nix { }; 6223 6224 - readline6 = callPackage ../development/libraries/readline/readline6.nix { }; 6225 6226 readline63 = callPackage ../development/libraries/readline/readline6.3.nix { }; 6227
··· 2627 2628 bashInteractive = appendToName "interactive" (callPackage ../shells/bash { 2629 interactive = true; 2630 }); 2631 2632 bashCompletion = callPackage ../shells/bash-completion { }; ··· 3683 suitesparse = null; 3684 openjdk = null; 3685 gnuplot = null; 3686 }; 3687 octaveFull = (lowPrio (callPackage ../development/interpreters/octave { 3688 fltk = fltk13; ··· 4370 gdb = callPackage ../development/tools/misc/gdb { 4371 guile = null; 4372 hurd = gnu.hurdCross; 4373 inherit (gnu) mig; 4374 }; 4375 ··· 6212 6213 raul = callPackage ../development/libraries/audio/raul { }; 6214 6215 + readline = readline6; 6216 + readline6 = readline63; 6217 6218 readline5 = callPackage ../development/libraries/readline/readline5.nix { }; 6219 6220 + readline62 = callPackage ../development/libraries/readline/readline6.nix { }; 6221 6222 readline63 = callPackage ../development/libraries/readline/readline6.3.nix { }; 6223