aboutsummaryrefslogtreecommitdiff
path: root/nix
Commit message (Collapse)AuthorAge
* daemon: Make 'profiles/per-user' non-world-writable.Ludovic Courtès2019-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixes <https://bugs.gnu.org/37744>. Reported at <https://www.openwall.com/lists/oss-security/2019/10/09/4>. Based on Nix commit 5a303093dcae1e5ce9212616ef18f2ca51020b0d by Eelco Dolstra <edolstra@gmail.com>. * nix/libstore/local-store.cc (LocalStore::LocalStore): Set 'perUserDir' to #o755 instead of #o1777. (LocalStore::createUser): New function. * nix/libstore/local-store.hh (LocalStore): Add it. * nix/libstore/store-api.hh (StoreAPI): Add it. * nix/nix-daemon/nix-daemon.cc (performOp): In 'wopSetOptions', add condition to handle "user-name" property and honor it. (processConnection): Add 'userId' parameter. Call 'store->createUser' when userId is not -1. * guix/profiles.scm (ensure-profile-directory): Note that this is now handled by the daemon. * guix/store.scm (current-user-name): New procedure. (set-build-options): Add #:user-name parameter and pass it to the daemon. * tests/guix-daemon.sh: Test the creation of 'profiles/per-user' when listening on a TCP socket. * tests/store.scm ("profiles/per-user exists and is not writable") ("profiles/per-user/$USER exists"): New tests.
* daemon: Remove traces of 'NIX_ROOT_FINDER'.Ludovic Courtès2019-10-16
| | | | | | | | This is a followup to 2e3e5d21988fc2cafb2a9eaf4b00976ea425629d. * build-aux/test-env.in: Remove mentions of 'NIX_ROOT_FINDER'. * nix/libstore/gc.cc (LocalStore::collectGarbage): Adjust comment accordingly.
* daemon: Strictly respect timeouts for 'guix offload'.Ludovic Courtès2019-09-28
| | | | | | | | | | | | | Until now it was up to 'guix offload' to honor timeouts. Unfortunately it would sometimes fail to do that, for example due to the libssh bug at <https://bugs.libssh.org/T33>. With this change, 'guix offload' is automatically killed by the daemon when one of the timeouts expires. Thus, data transfers performed by 'guix offload' now count as part of the timeouts, rather than just actual build time. * nix/libstore/build.cc (DerivationGoal::tryBuildHook): Pass true as the 'respectTimeouts' argument to 'childStarted'.
* daemon: Include 'config.h' in 'nix-daemon.cc'.Timothy Sample2019-09-16
| | | | * nix/nix-daemon/nix-daemon.cc: Include 'config.h'.
* daemon: Remove 'NIX_LIBEXEC_DIR'.Ludovic Courtès2019-09-08
| | | | | | | | * nix/libstore/globals.hh (Settings)[nixLibexecDir]: Remove. * nix/libstore/globals.cc (Settings::processEnvironment): Remove reference to 'nixLibexecDir'. * nix/local.mk (libstore_a_CPPFLAGS): Remove -DNIX_LIBEXEC_DIR flag. * build-aux/pre-inst-env.in: Remove references to 'NIX_LIBEXEC_DIR'.
* daemon: Run 'guix substitute' directly and assume a single substituter.Ludovic Courtès2019-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The daemon had a mechanism that allows it to handle a list of substituters and try them sequentially; this removes it. * nix/scripts/substitute.in: Remove. * nix/local.mk (nodist_pkglibexec_SCRIPTS): Remove. * config-daemon.ac: Don't output 'nix/scripts/substitute'. * nix/libstore/build.cc (SubstitutionGoal)[subs, sub, hasSubstitute]: Remove. [tryNext]: Make private. (SubstitutionGoal::SubstitutionGoal, SubstitutionGoal::init): Remove now unneeded initializers. (SubstitutionGoal::tryNext): Adjust to assume a single substituter: call 'amDone' upfront when we couldn't find substitutes. (SubstitutionGoal::tryToRun): Adjust to run 'guix substitute' via 'settings.guixProgram'. (SubstitutionGoal::finished): Call 'amDone(ecFailed)' upon failure instead of setting 'state' to 'tryNext'. * nix/libstore/globals.hh (Settings)[substituters]: Remove. * nix/libstore/local-store.cc (LocalStore::~LocalStore): Adjust to handle a single substituter. (LocalStore::startSubstituter): Remove 'path' parameter. Adjust to invoke 'settings.guixProgram'. Don't refer to 'run.program', which no longer exists. (LocalStore::querySubstitutablePaths): Adjust for 'runningSubstituters' being a singleton instead of a list. (LocalStore::querySubstitutablePathInfos): Likewise, and remove 'substituter' parameter. * nix/libstore/local-store.hh (RunningSubstituter)[program]: Remove. (LocalStore)[runningSubstituters]: Remove. [runningSubstituter]: New field. [querySubstitutablePathInfos]: Remove 'substituter' parameter. [startSubstituter]: Remove 'substituter' parameter. * nix/nix-daemon/guix-daemon.cc (main): Remove references to 'settings.substituters'. * nix/nix-daemon/nix-daemon.cc (performOp): Ignore the user's "build-use-substitutes" value when 'settings.useSubstitutes' is false.
* daemon: Run 'guix offload' directly.Ludovic Courtès2019-09-08
| | | | | | | | | | | | | | | * nix/scripts/offload.in: Remove. * nix/local.mk (nodist_pkglibexec_SCRIPTS) [BUILD_DAEMON_OFFLOAD]: Remove 'scripts/offload'. * config-daemon.ac: Don't output 'nix/scripts/offload'. * build-aux/pre-inst-env.in: Don't set 'NIX_BUILD_HOOK'. * nix/libstore/build.cc (HookInstance::HookInstance): Run 'guix offload'. (DerivationGoal::tryBuildHook): Remove reference to 'NIX_BUILD_HOOK'. * nix/nix-daemon/guix-daemon.cc (main) [HAVE_DAEMON_OFFLOAD_HOOK]: Don't set 'NIX_BUILD_HOOK'. * nix/nix-daemon/nix-daemon.cc (performOp) [!HAVE_DAEMON_OFFLOAD_HOOK]: Leave 'settings.useBuildHook' unchanged.
* daemon: Run 'guix perform-download' directly.Ludovic Courtès2019-09-08
| | | | | | | | * nix/scripts/download.in: Remove. * nix/local.mk (nodist_pkglibexec_SCRIPTS): Remove 'scripts/download'. * config-daemon.ac: Don't output 'nix/scripts/download'. * nix/libstore/builtins.cc (builtinDownload): Invoke 'guix perform-download' directly.
* daemon: Run 'guix authenticate' directly.Ludovic Courtès2019-09-08
| | | | | | | | | * nix/scripts/authenticate.in: Remove. * nix/local.mk (nodist_pkglibexec_SCRIPTS): Remove scripts/authenticate. * config-daemon.ac: Don't output 'nix/scripts/authenticate'. * nix/libstore/local-store.cc (runAuthenticationProgram): Run 'guix authenticate'.
* daemon: Invoke 'guix gc --list-busy' instead of 'list-runtime-roots'.Ludovic Courtès2019-09-08
| | | | | | | | | | | | | | | | | | | | | | | * nix/scripts/list-runtime-roots.in: Remove. * guix/store/roots.scm (%proc-directory): New variable. (proc-file-roots, proc-exe-roots, proc-cwd-roots) (proc-fd-roots, proc-maps-roots, proc-environ-roots) (referenced-files, canonicalize-store-item, busy-store-items): New procedures, taken from 'list-runtime-roots.in'. * nix/libstore/globals.hh (Settings)[guixProgram]: New field. * nix/libstore/globals.cc (Settings::processEnvironment): Initialize 'guixProgram'. * nix/libstore/gc.cc (addAdditionalRoots): Drop code related to 'NIX_ROOT_FINDER'. Run "guix gc --list-busy". * nix/local.mk (nodist_pkglibexec_SCRIPTS): Remove 'scripts/list-runtime-roots'. * config-daemon.ac: Don't output nix/scripts/list-runtime-roots. * build-aux/pre-inst-env.in: Don't set 'NIX_ROOT_FINDER'. Set 'GUIX'. * doc/guix.texi (Invoking guix gc): Document '--list-busy'. * guix/scripts/gc.scm (show-help, %options): Add "--list-busy". (guix-gc)[list-busy]: New procedure. Handle the 'list-busy' action.
* daemon: Don't reply on 'st_blocks'.Eelco Dolstra2019-08-30
| | | | | | | | | Ported by Ludovic Courtès <ludo@gnu.org> from <https://github.com/NixOS/nix/commit/a2c4fcd5e9782dc8d2998773380c7171ee53b813>. * nix/libstore/gc.cc (LocalStore::removeUnusedLinks): Use 'st.st_size' instead of 'st.st_blocks * 512'. * nix/libutil/util.cc (_deletePath): Likewise.
* daemon: Replace "illegal" by "invalid" in error messages.Ludovic Courtès2019-06-13
| | | | | | | * nix/libstore/build.cc (parseReferenceSpecifiers): Replace "illegal" by "invalid". * nix/libstore/globals.cc (Settings::pack): Likewise. * nix/libstore/store-api.cc (checkStoreName): Likewise.
* Remove traces of "GuixSD".Ludovic Courtès2019-03-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gnu/bootloader/extlinux.scm (extlinux-configuration-file): Remove mentions of "GuixSD". * gnu/bootloader/grub.scm (install-grub-efi): Likewise. * gnu/build/vm.scm (make-iso9660-image): Change default #:volume-id to "Guix_image". (initialize-hard-disk): Search for the "Guix_image" label. * gnu/ci.scm (system-test-jobs, tarball-jobs): Remove "GuixSD". * gnu/installer/newt/welcome.scm (run-welcome-page): Likewise. * gnu/packages/audio.scm (supercollider)[description]: Likewise. * gnu/packages/curl.scm (curl): Likewise. * gnu/packages/emacs.scm (emacs): Likewise. * gnu/packages/gnome.scm (network-manager): Likewise. * gnu/packages/julia.scm (julia): Likewise. * gnu/packages/linux.scm (alsa-plugins): Likewise. (powertop, wireless-regdb): Likewise. * gnu/packages/package-management.scm (guix): Likewise. * gnu/packages/polkit.scm (polkit): Likewise. * gnu/packages/tex.scm (texlive-bin): Likewise. * gnu/services/base.scm (file-systems->fstab): Likewise. * gnu/services/cups.scm (%cups-activation): Likewise. * gnu/services/mail.scm (%dovecot-activation): Likewise. * gnu/services/messaging.scm (prosody-configuration)[log]: Likewise. * gnu/system/examples/vm-image.tmpl (vm-image-motd): Likewise. * gnu/system/install.scm (installation-os)[file-systems]: Change root file system label to "Guix_image". * gnu/system/mapped-devices.scm (check-device-initrd-modules): Remove "GuixSD". * gnu/system/vm.scm (system-docker-image): Likewise. (system-disk-image)[root-label]: Change to "Guix_image". * gnu/tests/install.scm (run-install): Remove "GuixSD". * guix/modules.scm (guix-module-name?): Likewise. * nix/libstore/optimise-store.cc: Likewise.
* daemon: Emit a 'build-succeeded' event in check mode.Ludovic Courtès2019-02-06
| | | | | | | | | | | Until now, something like "guix build sed -v1 --check" would not get a 'build-succeeded' event, which in turn meant that the spinner would not be erased upon build completion. * nix/libstore/build.cc (DerivationGoal::registerOutputs): When 'buildMode' is bmCheck and 'settings.printBuildTrace' emit a "@ build-succeeded" trace upon success. * tests/store.scm ("build-succeeded trace in check mode"): New test.
* daemon: Add "/guix" to default 'nixLibexecDir'.Ludovic Courtès2019-02-04
| | | | | | | | | | | | | This makes it easier to run the uninstalled daemon. * nix/local.mk (libstore_a_CPPFLAGS): Append "/guix" to NIX_LIBEXEC_DIR. * build-aux/pre-inst-env.in (NIX_LIBEXEC_DIR): Adjust comment. * nix/libstore/builtins.cc (builtinDownload): Remove SUBDIR and its use. * nix/libstore/local-store.cc (runAuthenticationProgram): Ditto. * nix/libstore/gc.cc (addAdditionalRoots): Remove "/guix" prefix. * nix/nix-daemon/guix-daemon.cc (main): Ditto.
* daemon: Remove the 'NIX_SUBSTITUTERS' environment variable.Ludovic Courtès2019-02-04
| | | | | | | | * nix/libstore/globals.cc (Settings:update): Remove changes to 'substituters'. * nix/nix-daemon/guix-daemon.cc (main): Set 'settings.substituters' directly instead of changing the 'NIX_SUBSTITUTERS' environment variable. * build-aux/pre-inst-env.in: Remove reference to 'NIX_SUBSTITUTERS'.
* daemon: Remove unused 'NIX_DATA_DIR' environment variable.Ludovic Courtès2019-02-04
| | | | | | | * nix/libstore/globals.hh (Settings)[nixDataDir]: Remove. * nix/libstore/globals.cc (Settings:processEnvironment): Remove setting of 'nixDataDir'. * nix/local.mk (libstore_a_CPPFLAGS): Remove '-DNIX_DATA_DIR'.
* daemon: Rename 'NIX_STATE_DIR' and 'NIX_DB_DIR' environment variables.Ludovic Courtès2019-02-04
| | | | | | | | | | | | | | | | | Fixes <https://bugs.gnu.org/22459>. Reported by Jeff Mickey <j@codemac.net>. * guix/config.scm.in (%state-directory): Change NIX_STATE_DIR to GUIX_STATE_DIRECTORY. (%store-database-directory): Change NIX_DB_DIR to GUIX_DATABASE_DIRECTORY. * nix/libstore/globals.cc (Settings::processEnvironment): Likewise. * guix/self.scm (make-config.scm): Likewise. * build-aux/build-self.scm (make-config.scm): Likewise. * build-aux/test-env.in: Likewise. * tests/derivations.scm ("derivation #:leaked-env-vars"): Likewise. * tests/guix-build.sh (GUIX_DAEMON_SOCKET): Likewise. * tests/guix-daemon.sh (socket): Likewise.
* daemon: Use unbranded phrases in comments and messages.Ludovic Courtès2018-12-16
| | | | | | | | * nix/libstore/build.cc, nix/libstore/globals.cc, nix/libstore/gc.cc, nix/libstore/local-store.cc, nix/libstore/optimise-store.cc, nix/libstore/store-api.cc, nix/libutil/archive.cc, nix/nix-daemon/nix-daemon.cc: Replace "Nix store" by "store", and "Nix daemon" by "build daemon".
* daemon: Ignore '--keep-failed' for TCP/IP clients.Ludovic Courtès2018-11-24
| | | | | | * nix/nix-daemon/nix-daemon.cc (performOp) <wopSetOptions>: When 'isRemoteConnection' is true, set 'settings.keepFailed' to zero. * doc/guix.texi (Common Build Options): Document this behavior.
* daemon: Install 'authenticate' script under LIBEXECDIR/guix.Ludovic Courtès2018-11-14
| | | | | | | | | | | | | | | | That way it is handled in the same way as other helper scripts. * nix/scripts/guix-authenticate.in: Rename to... * nix/scripts/authenticate.in: ... this. * config-daemon.ac: Adjust accordingly. * nix/local.mk (libstore_a_CPPFLAGS): Remove -DOPENSSL_PATH. (nodist_libexec_SCRIPTS): Remove. (nodist_pkglibexec_SCRIPTS): New variable. * nix/nix-daemon/guix-daemon.cc (main): Remove 'setenv' call for "PATH". * nix/libstore/local-store.cc (runAuthenticationProgram): New function. (LocalStore::exportPath, LocalStore::importPath): Use it instead of 'runProgram' and OPENSSL_PATH.
* daemon: Support multiplexed build output.Ludovic Courtès2018-10-15
| | | | | | | | | | | | | | | | | | | | | | | | | | This allows clients to tell whether output comes from the daemon or, if it comes from a builder, from which builder it comes. The latter is particularly useful when MAX-BUILD-JOBS > 1. * nix/libstore/build.cc (DerivationGoal::tryBuildHook) (DerivationGoal::startBuilder): Print the child's PID in "@ build-started" traces. (DerivationGoal::handleChildOutput): Define 'prefix', pass it to 'writeToStderr'. * nix/libstore/globals.cc (Settings:Settings): Initialize 'multiplexedBuildOutput'. (Settings::update): Likewise. * nix/libstore/globals.hh (Settings)[multiplexedBuildOutput]: New field. Update 'printBuildTrace' documentation. * nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0.163. * nix/nix-daemon/nix-daemon.cc (performOp) <wopSetOptions>: Special-case "multiplexed-build-output" and remove "use-ssh-substituter". * guix/store.scm (set-build-options): Add #:multiplexed-build-output? and honor it. (%protocol-version): Bump to #x163. * tests/store.scm ("multiplexed-build-output"): New test. fixlet
* daemon: Remove unused 'Settings' fields.Ludovic Courtès2018-10-02
| | | | | | | * nix/libstore/globals.hh (Settings)[sshSubstituterHosts] [useSshSubstituter, logServers, enableImportNative]: Remove fields. * nix/libstore/globals.cc (Settings::Settings, Settings::update): Remove references to these.
* daemon: Remove "case hack" for nars.Ludovic Courtès2018-10-02
| | | | | | | This code has never been of any use in Guix. * nix/libutil/archive.cc (useCaseHack): Remove. (parse): Keep only the alternate branch in "if (useCaseHack)".
* perform-download: Optionally report a "download-progress" trace.Ludovic Courtès2018-09-27
| | | | | | | | | | | | * guix/scripts/perform-download.scm (perform-download): Add #:print-build-trace? and pass it to 'url-fetch'. (guix-perform-download): Define 'print-build-trace?' and pass it to 'perform-download'. * guix/build/download.scm (ftp-fetch): Add #:print-build-trace? and honor it. (url-fetch): Likewise. * nix/libstore/builtins.cc (builtinDownload): Set _NIX_OPTIONS environment variable.
* Add (guix status) and use it for pretty colored output.Ludovic Courtès2018-09-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * guix/progress.scm (progress-reporter/trace): New procedure. (%progress-interval): New variable. (progress-reporter/file): Use it. * guix/scripts/build.scm (set-build-options-from-command-line): Pass #:print-extended-build-trace?. (%default-options): Add 'print-extended-build-trace?'. (guix-build): Parameterize CURRENT-TERMINAL-COLUMNS. Use 'build-status-updater'. * guix/scripts/environment.scm (%default-options): Add 'print-extended-build-trace?'. (guix-environment): Wrap body in 'with-status-report'. * guix/scripts/pack.scm (%default-options): Add 'print-build-trace?' and 'print-extended-build-trace?'. (guix-pack): Wrap body in 'with-status-report'. * guix/scripts/package.scm (%default-options, guix-package): Likewise. * guix/scripts/system.scm (%default-options, guix-system): Likewise. * guix/scripts/pull.scm (%default-options, guix-pull): Likewise. * guix/scripts/substitute.scm (progress-report-port): Don't call STOP when TOTAL is zero. (process-substitution): Add #:print-build-trace? and honor it. (guix-substitute)[print-build-trace?]: New variable. Pass #:print-build-trace? to 'process-substitution'. * guix/status.scm: New file. * guix/store.scm (set-build-options): Add #:print-extended-build-trace?; pass it into PAIRS. (%protocol-version): Bump. (protocol-version, nix-server-version): New procedures. (current-store-protocol-version): New variable. (with-store, build-things): Parameterize it. * guix/ui.scm (build-output-port): Remove. (colorize-string): Export. * po/guix/POTFILES.in: Add guix/status.scm. * tests/status.scm: New file. * Makefile.am (SCM_TESTS): Add it. * nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x162. * nix/libstore/build.cc (DerivationGoal::registerOutputs) (SubstitutionGoal::finished): Print a "@ hash-mismatch" trace before throwing.
* build: Remove leftover reference to nix/libstore/schema.sql.Ludovic Courtès2018-06-22
| | | | | | | This is a followup to 3931c76154d4f418d5ea9acc5e47bf911d371c24. Reported by Julien Lepiller. * nix/local.mk (EXTRA_DIST): Remove schema.sql.
* Remove 'guix-register' and its traces.Ludovic Courtès2018-06-14
| | | | | | | | | | | | | | | | | | | * Makefile.am (SH_TESTS): Remove tests/guix-register.sh. * build-aux/pre-inst-env.in (GUIX_REGISTER): Remove. * gnu/build/install.scm (directives): Remove outdated comment. * gnu/build/vm.scm (root-partition-initializer): Update comment. * gnu/packages/package-management.scm (guix-register): Remove. * guix/config.scm.in (%sbindir, %guix-register-program): Remove. * guix/scripts/system.scm (install): Adjust docstring. * guix/self.scm (make-config.scm): Remove #:guix. Do not generate %sbindir and %guix-register-program. (specification->package): Remove "guix". * nix/guix-register/guix-register.cc: Remove. * nix/libstore/store-api.cc (decodeValidPathInfo): Remove. * nix/libstore/store-api.hh (decodeValidPathInfo): Remove declaration. * nix/local.mk (sbin_PROGRAMS, guix_register_SOURCES) (guix_register_CPPFLAGS, guix_register_LDFLAGS): Remove. * tests/guix-register.sh: Remove.
* database: 'with-database' can now initialize new databases.Ludovic Courtès2018-06-14
| | | | | | | | | | | | | * nix/libstore/schema.sql: Rename to... * guix/store/schema.sql: ... this. * Makefile.am (nobase_dist_guilemodule_DATA): Add it. * nix/local.mk (%D%/libstore/schema.sql.hh): Adjust accordingly. * guix/store/database.scm (sql-schema): New variable. (sqlite-exec, initialize-database, call-with-database): New procedures. (with-database): Rewrite in terms of 'call-with-database'. * tests/store-database.scm ("new database"): New test. * guix/self.scm (compiled-guix)[*core-modules*]: Add 'schema.sql' to #:extra-files.
* build: Do not add all of $(BUILT_SOURCES) to $(CLEANFILES).Ludovic Courtès2018-06-08
| | | | | | | Reported by Gábor Boskovits <boskovits@gmail.com>. Fixes <https://bugs.gnu.org/31700>. * nix/local.mk (CLEANFILES): Add nothing but schema.sql.hh.
* daemon: Allow building for armhf-linux on aarch64-linux.Efraim Flashner2018-05-17
| | | | | | | | | | * nix/libstore/build.cc (canBuildLocally): Allow building armhf-linux builds on aarch64-linux. (DerivationGoal::runChild) Throw error if attempting to build for armhf-linux on an unsupported platform. * doc/guix.texi (Invoking guix build): Document how to build natively for armhf-linux on aarch64-linux. Add note that on some aarch64 machines this is unsupported.
* guix-daemon: Disable garbage collection for remote connections.Roel Janssen2018-04-19
| | | | | | | | * nix/nix-daemon/nix-daemon.cc (isRemoteConnection): New variable. (performOp): For wopCollectGarbage, throw an error when isRemoteConnection is set. (acceptConnection): Set isRemoteConnection when connection is not AF_UNIX. * tests/guix-daemon.sh: Add a test for the new behavior.
* daemon: Remove unused schema upgrade code.Ludovic Courtès2018-03-30
| | | | | | | | * nix/libstore/local-store.cc (LocalStore): Remove upgrade code. (LocalStore::queryValidPathsOld, LocalStore::queryPathInfoOld) (LocalStore::upgradeStore6, makeMutable) (LocalStore::upgardeStore7): Remove. * nix/libstore/local-store.hh: Adjust accordingly.
* daemon: Remove dead code.Ludovic Courtès2018-03-30
| | | | | | | | | | | * nix/libstore/globals.cc (Settings::loadConfFile, Settings::unpack): Remove. * nix/libstore/globals.hh: Adjust accordingly. * nix/libstore/misc.cc (queryMissing): Remove. * nix/libstore/misc.hh: Adjust accordingly. * nix/libstore/store-api.cc (followLinksToStore) (followLinksToStorePath, computeStorePathForHash): Remove. * nix/libstore/store-api.hh: Adjust accordingly.
* daemon: Always try to execute the builder regardless of the platform.Ludovic Courtès2018-01-11
| | | | | * nix/libstore/build.cc (runChild): Move platform check after 'execve' call. Check specifically for ENOEXEC.
* daemon: Make libbz2 an optional dependency.Ludovic Courtès2018-01-07
| | | | | | | | | | | | | | * config-daemon.ac: Don't bail out when libbz2 is missing. Define 'HAVE_LIBBZ2' Automake conditional. * nix/libstore/build.cc: Wrap relevant bits in '#if HAVE_BZLIB_H'. * nix/libstore/globals.cc (Settings::Settings): 'logCompression' defaults to COMPRESSION_GZIP when HAVE_BZLIB_H is false. * nix/libstore/globals.hh (CompressionType): Make 'COMPRESSION_BZIP2' conditional on HAVE_BZLIB_H. * nix/local.mk (guix_register_LDADD, guix_daemon_LDADD): Add -lbz2 only when HAVE_LIBBZ2. * nix/nix-daemon/guix-daemon.cc (parse_opt): Ignore "bzip2" when not HAVE_BZLIB_H.
* daemon: Add gzip log compression.Ludovic Courtès2018-01-07
| | | | | | | | | | | | | | | | | | | | * nix/nix-daemon/guix-daemon.cc (GUIX_OPT_LOG_COMPRESSION): New macro. (options): Mark "disable-log-compression" as hidden and add "log-compression". (parse_opt): Handle GUIX_OPT_LOG_COMPRESSION. * nix/libstore/build.cc (DerivationGoal): Add 'gzLogFile'. (openLogFile): Initialize it when 'logCompression' is COMPRESSION_GZIP. (closeLogFile, handleChildOutput): Honor 'gzLogFile'. * nix/libstore/globals.hh (Settings)[compressLog]: Remove. [logCompression]: New field. (CompressionType): New enum. * nix/libstore/globals.cc (Settings::Settings): Initialize it. (update): Remove '_get' call for 'compressLog'. * nix/local.mk (guix_daemon_LDADD, guix_register_LDADD): Add -lz. * guix/store.scm (log-file): Handle '.gz' log files. * tests/guix-daemon.sh: Add test with '--log-compression=gzip'. * doc/guix.texi (Invoking guix-daemon): Adjust accordingly. * config-daemon.ac: Check for libz and zlib.h.
* list-runtime-root: Fix off-by-one in 'strip-drop' call.Ludovic Courtès2017-12-31
| | | | | | | | | Fixes <https://bugs.gnu.org/29862>. Reported by Danny Milosavljevic <dannym@scratchpost.org>. * nix/scripts/list-runtime-roots.in (canonicalize-store-item): Define 'store' with a trailing "/". Have the 'string-prefix?' call match the 'string-drop' call.
* list-runtime-roots: Ignore ESRCH while reading from /proc.Ludovic Courtès2017-11-26
| | | | | | | Fixes <https://bugs.gnu.org/29368>. Reported by Martin Castillo <castilma@uni-bremen.de>. * nix/scripts/list-runtime-roots.in (referenced-files): Ignore ESRCH.
* list-runtime-roots: Ignore PIDs we cannot access.Ludovic Courtès2017-11-12
| | | | | | | | This allows running as non-root. Fixes a regression introduced in b8f59cdc20e9d83ce63523ef917e95fcee07f134. * nix/scripts/list-runtime-roots.in (referenced-files): Handle EACCES in addition to ENOENT.
* list-runtime-roots: Canonicalize store items.Ludovic Courtès2017-11-12
| | | | | | | | | | Looking at 'addAdditionalRoots' in libstore/gc.cc, it looks like it should always have been this way. In practice it probably doesn't make much of a difference. * nix/scripts/list-runtime-roots.in (canonicalize-store-item): New procedure. <top level>: Use it.
* list-runtime-roots: Do not use 'lsof'.Ludovic Courtès2017-11-12
| | | | | | | | | This makes things a bit faster (0.8s instead of 1.4s on my laptop). * nix/scripts/list-runtime-roots.in (lsof-roots): Remove. (proc-fd-roots): Return the empty list when 'scandir' returns #f. (referenced-files): New procedure. Use it at the top level.
* nix: Remove unused function.Andy Wingo2017-08-18
| | | | | * nix/libutil/util.hh: * nix/libutil/util.cc (decodeOctalEscaped): Remove unused and buggy function.
* Simplify remouting with MS_PRIVATE in sandbox buildJörg Thalheim2017-08-18
| | | | also fix race condition if mounts are added after mountinfo is read.
* daemon: Ensure the child stack is aligned on a 16-byte boundary.Mark H Weaver2017-08-07
| | | | | * nix/libstore/build.cc (DerivationGoal::startBuilder): When calling 'clone', ensure that the stack is aligned on a 16-byte boundary.
* daemon: On aarch64, use increments of 16 on the stack.Efraim Flashner2017-08-05
| | | | | * nix/libstore/build.cc (DerivationGoal::startBuilder): When on aarch64, when calling clone(), increment the stack by 16.
* Revert "daemon: Ensure proper alignment on the stack."Mark H Weaver2017-08-05
| | | | This reverts commit ab4ccc8fcfaf2215d4b33b1376147e4c2c70426a.
* daemon: Flush the sink upon 'exportPath' errors.Jan Nieuwenhuizen2017-07-17
| | | | | | | | | | | | | | | | | Prior to this change, errors such as wrong permissions on /etc/guix/signing-key.sec would give: guix-daemon: nix/libutil/serialise.cc:15: virtual nix::BufferedSink::~BufferedSink(): Assertion `!bufPos' failed. This patch correctly propagates the error to the client and thus changes that to: error: build failed: file `/etc/guix/signing-key.sec' should be secret (inaccessible to everybody else)! * nix/nix-daemon/nix-daemon.cc (performOp): Wrap 'exportPath' call in 'try' block. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* daemon: Allow compilation with GCC 4.9.Ludovic Courtès2017-07-10
| | | | | | | | Reported by Ricardo Wurmus. * nix/nix-daemon/nix-daemon.cc (acceptConnection): Remove intermediate 'inaddr' variables that relied on implicit casts. This fixes compilation with GCC 4.9.
* daemon: Set TCP_NODELAY and TCP_QUICKACK on remote sockets.Ludovic Courtès2017-06-22
| | | | | * nix/nix-daemon/nix-daemon.cc (acceptConnection): Set TCP_NODELAY and TCP_QUICKACK on REMOTE.