aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/aux-files/pack-audit.c
blob: 374787e8b9c00ed2b9265f569010601f46f8fb74 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* GNU Guix --- Functional package management for GNU
   Copyright (C) 2020 Ludovic Courtès <ludo@gnu.org>

   This file is part of GNU Guix.

   GNU Guix is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or (at
   your option) any later version.

   GNU Guix is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.  */

/* This file implements part of the GNU ld.so audit interface.  It is used by
   the "fakechroot" engine of the 'guix pack -RR' wrappers to make sure the
   loader looks for shared objects under the "fake" root directory.  */

#define _GNU_SOURCE 1

#include <link.h>

#include <error.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

/* The pseudo root directory and store that we are relocating to.  */
static const char *root_directory;
static char *store;

/* The original store, "/gnu/store" by default.  */
static const char original_store[] = "@STORE_DIRECTORY@";

/* Like 'malloc', but abort if 'malloc' returns NULL.  */
static void *
xmalloc (size_t size)
{
  void *result = malloc (size);
  assert (result != NULL);
  return result;
}

unsigned int
la_version (unsigned int v)
{
  if (v != LAV_CURRENT)
    error (1, 0, "cannot handle interface version %u", v);

  root_directory = getenv ("FAKECHROOT_BASE");
  if (root_directory == NULL)
    error (1, 0, "'FAKECHROOT_BASE' is not set");

  store = xmalloc (strlen (root_directory) + sizeof original_store);
  strcpy (store, root_directory);
  strcat (store, original_store);

  return v;
}

/* Return NAME, a shared object file name, relocated under STORE.  This
   function is called by the loader whenever it looks for a shared object.  */
char *
la_objsearch (const char *name, uintptr_t *cookie, unsigned int flag)
{
  char *result;

  if (strncmp (name, original_store,
	       sizeof original_store - 1) == 0)
    {
      size_t len = strlen (name) - sizeof original_store
	+ strlen (store) + 1;
      result = xmalloc (len);
      strcpy (result, store);
      strcat (result, name + sizeof original_store - 1);
    }
  else
    result = strdup (name);

  return result;
}
tml/guix-devel/2018-01/msg00114.html>. * gnu/services.scm (missing-target-error): New procedure. (service-back-edges): Use it. (instantiate-missing-services): New procedure. * gnu/system.scm (operating-system-services): Call 'instantiate-missing-services'. * tests/services.scm ("instantiate-missing-services") ("instantiate-missing-services, no default value"): New tests. * gnu/services/version-control.scm (cgit-service-type)[extensions]: Add FCGIWRAP-SERVICE-TYPE. * gnu/tests/version-control.scm (%cgit-os): Remove NGINX-SERVICE-TYPE and FCGIWRAP-SERVICE-TYPE instances. * doc/guix.texi (Log Rotation): Remove 'mcron-service-type' in example. (Miscellaneous Services): Remove 'nginx-service-type' and 'fcgiwrap-service-type' in Cgit example. Ludovic Courtès 2018-01-21tests: Cgit test waits for /var/run/shepherd/socket....Previously tests sometimes start before the shepherd was listening, leading to test failures. * gnu/tests/version-control.scm (run-cgit-test)[test]: Add "shepherd socket ready" test. Rename to two "service running" tests for clarity. Ludovic Courtès 2017-12-18services: nginx: Replace 'http-port' and 'https-port' with 'listen'....* doc/guix.texi (Web Services, Version Control Services): Update accordingly. * gnu/services/certbot.scm (certbot-nginx-server-configurations): Likewise. * gnu/services/version-control.scm (%cgit-configuration-nginx): Likewise. * gnu/services/web.scm (<nginx-server-configuration>, emit-nginx-server-config): Likewise. * gnu/tests/version-control.scm (%cgit-configuration-nginx, %git-nginx-configuration): Likewise. * gnu/tests/web.scm (%nginx-servers, %php-fpm-nginx-server-blocks): Likewise. Clément Lassieur 2017-11-28tests: Add 'git-http' test....* gnu/tests/version-control.scm (%git-nginx-configuration) (%git-http-os, %test-git-http): New variables. (run-git-http-test): New procedure. Ludovic Courtès 2017-11-28tests: cgit: Add a file to the test repository....* gnu/tests/version-control.scm (README-contents): New variable. (%make-git-repository): Add a 'README' file to the repo. (%test-repository-service): New variable. (%cgit-os): Use it. (run-cgit-test): Test /test/tree/README and /test/tree/does-not-exist. Ludovic Courtès 2017-10-03gnu: services: Add cgit....* gnu/services/version-control.scm (<cgit-configuration-file>, <cgit-configuration>): New record types. (cgit-configuration-robots-string, cgit-activation, cgit-configuration-nginx-config): New procedures. (%cgit-configuration-nginx, cgit-service-type): New variables. * gnu/tests/version-control.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * doc/guix.texi (Version Control): Document the cgit service. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Oleg Pykhalov