Fix: sessiond: report client list allocation failure as a fatal error
[lttng-tools.git] / src / bin / lttng-sessiond / sessiond-config.c
CommitLineData
e6142f2e 1/*
ab5be9fa 2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
e6142f2e 3 *
ab5be9fa 4 * SPDX-License-Identifier: GPL-2.0-only
e6142f2e 5 *
e6142f2e
JG
6 */
7
a3bc3918 8#include "version.h"
e6142f2e
JG
9#include "sessiond-config.h"
10#include <assert.h>
11#include "lttng-ust-ctl.h"
12#include <common/defaults.h>
13#include <limits.h>
e6142f2e
JG
14#include <ctype.h>
15#include <common/error.h>
16#include <common/utils.h>
4b082b12 17#include <common/path.h>
edf4b93e 18#include <common/compat/errno.h>
e6142f2e
JG
19#include <common/compat/getenv.h>
20
21static
22struct sessiond_config sessiond_config_build_defaults = {
23 .quiet = false,
24 .verbose = 0,
25 .verbose_consumer = 0,
26
2288467f 27 .agent_tcp_port = { .begin = DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN, .end = DEFAULT_AGENT_TCP_PORT_RANGE_END },
761ffce2
FD
28 .event_notifier_buffer_size_kernel = DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE,
29 .event_notifier_buffer_size_userspace = DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE,
e6142f2e
JG
30 .app_socket_timeout = DEFAULT_APP_SOCKET_RW_TIMEOUT,
31
32 .no_kernel = false,
33 .background = false,
34 .daemonize = false,
35 .sig_parent = false,
36
b53d4e59 37 .tracing_group_name.value = (char *) DEFAULT_TRACING_GROUP,
e6142f2e
JG
38 .kmod_probes_list.value = NULL,
39 .kmod_extra_probes_list.value = NULL,
40
41 .rundir.value = NULL,
42
43 .apps_unix_sock_path.value = NULL,
44 .client_unix_sock_path.value = NULL,
45 .wait_shm_path.value = NULL,
46 .health_unix_sock_path.value = NULL,
47 .lttng_ust_clock_plugin.value = NULL,
48 .pid_file_path.value = NULL,
49 .lock_file_path.value = NULL,
50 .agent_port_file_path.value = NULL,
51 .load_session_path.value = NULL,
52
53 .consumerd32_path.value = NULL,
54 .consumerd32_bin_path.value = NULL,
55 .consumerd32_lib_dir.value = NULL,
56 .consumerd32_err_unix_sock_path.value = NULL,
57 .consumerd32_cmd_unix_sock_path.value = NULL,
58
59 .consumerd64_path.value = NULL,
60 .consumerd64_bin_path.value = NULL,
61 .consumerd64_lib_dir.value = NULL,
62 .consumerd64_err_unix_sock_path.value = NULL,
63 .consumerd64_cmd_unix_sock_path.value = NULL,
64
65 .kconsumerd_path.value = NULL,
66 .kconsumerd_err_unix_sock_path.value = NULL,
67 .kconsumerd_cmd_unix_sock_path.value = NULL,
68};
69
70static
71void config_string_fini(struct config_string *str)
72{
73 config_string_set(str, NULL);
74}
75
76static
77void config_string_set_static(struct config_string *config_str,
78 const char *value)
79{
80 config_string_set(config_str, (char *) value);
81 config_str->should_free = false;
82}
83
84/* Only use for dynamically-allocated strings. */
85LTTNG_HIDDEN
86void config_string_set(struct config_string *config_str, char *value)
87{
88 assert(config_str);
89 if (config_str->should_free) {
90 free(config_str->value);
91 config_str->should_free = false;
92 }
93
94 config_str->should_free = !!value;
95 config_str->value = value;
96}
97
98LTTNG_HIDDEN
99int sessiond_config_apply_env_config(struct sessiond_config *config)
100{
101 int ret = 0;
102 const char *env_value;
103
104 env_value = getenv(DEFAULT_APP_SOCKET_TIMEOUT_ENV);
105 if (env_value) {
106 char *endptr;
107 long int_val;
108
109 errno = 0;
110 int_val = strtoul(env_value, &endptr, 0);
111 if (errno != 0 || int_val > INT_MAX ||
112 (int_val < 0 && int_val != -1)) {
113 ERR("Invalid value \"%s\" used for \"%s\" environment variable",
114 env_value, DEFAULT_APP_SOCKET_TIMEOUT_ENV);
115 ret = -1;
116 goto end;
117 }
118
119 config->app_socket_timeout = int_val;
120 }
121
122 env_value = lttng_secure_getenv("LTTNG_CONSUMERD32_BIN");
123 if (env_value) {
124 config_string_set_static(&config->consumerd32_bin_path,
125 env_value);
126 }
127 env_value = lttng_secure_getenv("LTTNG_CONSUMERD64_BIN");
128 if (env_value) {
129 config_string_set_static(&config->consumerd64_bin_path,
130 env_value);
131 }
132
133 env_value = lttng_secure_getenv("LTTNG_CONSUMERD32_LIBDIR");
134 if (env_value) {
135 config_string_set_static(&config->consumerd32_lib_dir,
136 env_value);
137 }
138 env_value = lttng_secure_getenv("LTTNG_CONSUMERD64_LIBDIR");
139 if (env_value) {
140 config_string_set_static(&config->consumerd64_lib_dir,
141 env_value);
142 }
143
144 env_value = lttng_secure_getenv("LTTNG_UST_CLOCK_PLUGIN");
145 if (env_value) {
146 config_string_set_static(&config->lttng_ust_clock_plugin,
147 env_value);
148 }
149
150 env_value = lttng_secure_getenv(DEFAULT_LTTNG_KMOD_PROBES);
151 if (env_value) {
152 config_string_set_static(&config->kmod_probes_list,
153 env_value);
154 }
155
156 env_value = lttng_secure_getenv(DEFAULT_LTTNG_EXTRA_KMOD_PROBES);
157 if (env_value) {
158 config_string_set_static(&config->kmod_extra_probes_list,
159 env_value);
160 }
161end:
162 return ret;
163}
164
165static
166int config_set_paths_root(struct sessiond_config *config)
167{
168 int ret = 0;
169
170 config_string_set(&config->rundir, strdup(DEFAULT_LTTNG_RUNDIR));
171 if (!config->rundir.value) {
172 ERR("Failed to set rundir");
173 ret = -1;
174 goto end;
175 }
176
177 config_string_set_static(&config->apps_unix_sock_path,
178 DEFAULT_GLOBAL_APPS_UNIX_SOCK);
179 config_string_set_static(&config->client_unix_sock_path,
180 DEFAULT_GLOBAL_CLIENT_UNIX_SOCK);
181 config_string_set_static(&config->wait_shm_path,
182 DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH);
183 config_string_set_static(&config->health_unix_sock_path,
184 DEFAULT_GLOBAL_HEALTH_UNIX_SOCK);
e6142f2e
JG
185end:
186 return ret;
187}
188
189static
190int config_set_paths_non_root(struct sessiond_config *config)
191{
192 int ret = 0;
193 const char *home_path = utils_get_home_dir();
194 char *str;
195
196 if (home_path == NULL) {
197 ERR("Can't get HOME directory for sockets creation.");
198 ret = -1;
199 goto end;
200 }
201
202 /*
203 * Create rundir from home path. This will create something like
204 * $HOME/.lttng
205 */
206 ret = asprintf(&str, DEFAULT_LTTNG_HOME_RUNDIR, home_path);
207 if (ret < 0) {
208 ERR("Failed to set rundir");
209 goto end;
210 }
211 config_string_set(&config->rundir, str);
212 str = NULL;
213
214 ret = asprintf(&str, DEFAULT_HOME_APPS_UNIX_SOCK, home_path);
215 if (ret < 0) {
216 ERR("Failed to set default home apps unix socket path");
217 goto end;
218 }
219 config_string_set(&config->apps_unix_sock_path, str);
220 str = NULL;
221
222 ret = asprintf(&str, DEFAULT_HOME_CLIENT_UNIX_SOCK, home_path);
223 if (ret < 0) {
224 ERR("Failed to set default home client unix socket path");
225 goto end;
226 }
227 config_string_set(&config->client_unix_sock_path, str);
228 str = NULL;
229
230 ret = asprintf(&str, DEFAULT_HOME_APPS_WAIT_SHM_PATH, getuid());
231 if (ret < 0) {
232 ERR("Failed to set default home apps wait shm path");
233 goto end;
234 }
235 config_string_set(&config->wait_shm_path, str);
236 str = NULL;
237
238 ret = asprintf(&str, DEFAULT_HOME_HEALTH_UNIX_SOCK, home_path);
239 if (ret < 0) {
240 ERR("Failed to set default home health UNIX socket path");
241 goto end;
242 }
243 config_string_set(&config->health_unix_sock_path, str);
244 str = NULL;
245
246 ret = 0;
247end:
248 return ret;
249}
250
251LTTNG_HIDDEN
252int sessiond_config_init(struct sessiond_config *config)
253{
254 int ret;
255 bool is_root = (getuid() == 0);
256 char *str;
257
258 assert(config);
259 memcpy(config, &sessiond_config_build_defaults, sizeof(*config));
260
261 if (is_root) {
262 ret = config_set_paths_root(config);
263 } else {
264 ret = config_set_paths_non_root(config);
265 }
2a9f757b 266 if (ret < 0) {
c9a2957d 267 goto error;
2a9f757b 268 }
e6142f2e
JG
269
270 /* 32 bits consumerd path setup */
271 ret = asprintf(&str, DEFAULT_USTCONSUMERD32_PATH,
272 config->rundir.value);
273 if (ret < 0) {
274 ERR("Failed to set 32-bit consumer path");
c9a2957d 275 goto error;
e6142f2e
JG
276 }
277 config_string_set(&config->consumerd32_path, str);
278 str = NULL;
279
280 ret = asprintf(&str, DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH,
281 config->rundir.value);
282 if (ret < 0) {
283 ERR("Failed to set 32-bit consumer error socket path");
c9a2957d 284 goto error;
e6142f2e
JG
285 }
286 config_string_set(&config->consumerd32_err_unix_sock_path, str);
287 str = NULL;
288
289 ret = asprintf(&str, DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH,
290 config->rundir.value);
291 if (ret < 0) {
292 ERR("Failed to set 32-bit consumer command socket path");
c9a2957d 293 goto error;
e6142f2e
JG
294 }
295 config_string_set(&config->consumerd32_cmd_unix_sock_path, str);
296 str = NULL;
297
298 /* 64 bits consumerd path setup */
299 ret = asprintf(&str, DEFAULT_USTCONSUMERD64_PATH,
300 config->rundir.value);
301 if (ret < 0) {
302 ERR("Failed to set 64-bit consumer path");
c9a2957d 303 goto error;
e6142f2e
JG
304 }
305 config_string_set(&config->consumerd64_path, str);
306 str = NULL;
307
308 ret = asprintf(&str, DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH,
309 config->rundir.value);
310 if (ret < 0) {
311 ERR("Failed to set 64-bit consumer error socket path");
c9a2957d 312 goto error;
e6142f2e
JG
313 }
314 config_string_set(&config->consumerd64_err_unix_sock_path, str);
315 str = NULL;
316
317 ret = asprintf(&str, DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH,
318 config->rundir.value);
319 if (ret < 0) {
320 ERR("Failed to set 64-bit consumer command socket path");
c9a2957d 321 goto error;
e6142f2e
JG
322 }
323 config_string_set(&config->consumerd64_cmd_unix_sock_path, str);
324 str = NULL;
325
326 /* kconsumerd consumerd path setup */
327 ret = asprintf(&str, DEFAULT_KCONSUMERD_PATH,
328 config->rundir.value);
329 if (ret < 0) {
330 ERR("Failed to set kernel consumer path");
c9a2957d 331 goto error;
e6142f2e
JG
332 }
333 config_string_set(&config->kconsumerd_path, str);
334 str = NULL;
335
4a08b740
JG
336 ret = asprintf(&str, DEFAULT_KCONSUMERD_ERR_SOCK_PATH,
337 config->rundir.value);
338 if (ret < 0) {
339 ERR("Failed to set kernel consumer error socket path");
c9a2957d 340 goto error;
4a08b740
JG
341 }
342 config_string_set(&config->kconsumerd_err_unix_sock_path, str);
343 str = NULL;
344
345 ret = asprintf(&str, DEFAULT_KCONSUMERD_CMD_SOCK_PATH,
346 config->rundir.value);
347 if (ret < 0) {
348 ERR("Failed to set kernel consumer command socket path");
c9a2957d 349 goto error;
4a08b740
JG
350 }
351 config_string_set(&config->kconsumerd_cmd_unix_sock_path, str);
352 str = NULL;
353
e6142f2e
JG
354 ret = asprintf(&str, "%s/%s", config->rundir.value,
355 DEFAULT_LTTNG_SESSIOND_PIDFILE);
356 if (ret < 0) {
357 ERR("Failed to set PID file path");
c9a2957d 358 goto error;
e6142f2e
JG
359 }
360 config_string_set(&config->pid_file_path, str);
361 str = NULL;
362
363 ret = asprintf(&str, "%s/%s", config->rundir.value,
364 DEFAULT_LTTNG_SESSIOND_LOCKFILE);
365 if (ret < 0) {
366 ERR("Failed to set lock file path");
c9a2957d 367 goto error;
e6142f2e
JG
368 }
369 config_string_set(&config->lock_file_path, str);
370 str = NULL;
371
372 ret = asprintf(&str, "%s/%s", config->rundir.value,
373 DEFAULT_LTTNG_SESSIOND_AGENTPORT_FILE);
374 if (ret < 0) {
375 ERR("Failed to set agent port file path");
c9a2957d 376 goto error;
e6142f2e
JG
377 }
378 config_string_set(&config->agent_port_file_path, str);
379 str = NULL;
380
381 /*
382 * Allow INSTALL_BIN_PATH to be used as a target path for the
383 * native architecture size consumer if CONFIG_CONSUMER*_PATH
384 * has not been defined.
385 */
386#if (CAA_BITS_PER_LONG == 32)
387 config_string_set_static(&config->consumerd32_bin_path,
388 INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE);
389 config_string_set_static(&config->consumerd32_lib_dir,
390 INSTALL_LIB_PATH);
391#elif (CAA_BITS_PER_LONG == 64)
392 config_string_set_static(&config->consumerd64_bin_path,
393 INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE);
394 config_string_set_static(&config->consumerd64_lib_dir,
395 INSTALL_LIB_PATH);
396#else
397#error "Unknown bitness"
398#endif
399 ret = 0;
c9a2957d
JG
400 return ret;
401error:
402 sessiond_config_fini(config);
e6142f2e
JG
403 return ret;
404}
405
406LTTNG_HIDDEN
407void sessiond_config_fini(struct sessiond_config *config)
408{
409 config_string_fini(&config->tracing_group_name);
410 config_string_fini(&config->kmod_probes_list);
411 config_string_fini(&config->kmod_extra_probes_list);
16ffecdb 412 config_string_fini(&config->rundir);
e6142f2e
JG
413 config_string_fini(&config->apps_unix_sock_path);
414 config_string_fini(&config->client_unix_sock_path);
415 config_string_fini(&config->wait_shm_path);
416 config_string_fini(&config->health_unix_sock_path);
417 config_string_fini(&config->lttng_ust_clock_plugin);
418 config_string_fini(&config->pid_file_path);
419 config_string_fini(&config->lock_file_path);
420 config_string_fini(&config->load_session_path);
421 config_string_fini(&config->agent_port_file_path);
422 config_string_fini(&config->consumerd32_path);
423 config_string_fini(&config->consumerd32_bin_path);
424 config_string_fini(&config->consumerd32_lib_dir);
425 config_string_fini(&config->consumerd32_err_unix_sock_path);
426 config_string_fini(&config->consumerd32_cmd_unix_sock_path);
427 config_string_fini(&config->consumerd64_path);
428 config_string_fini(&config->consumerd64_bin_path);
429 config_string_fini(&config->consumerd64_lib_dir);
430 config_string_fini(&config->consumerd64_err_unix_sock_path);
431 config_string_fini(&config->consumerd64_cmd_unix_sock_path);
432 config_string_fini(&config->kconsumerd_path);
433 config_string_fini(&config->kconsumerd_err_unix_sock_path);
434 config_string_fini(&config->kconsumerd_cmd_unix_sock_path);
435}
436
437static
438int resolve_path(struct config_string *path)
439{
440 int ret = 0;
441 char *absolute_path;
442
443 if (!path->value || path->value[0] == '/') {
444 goto end;
445 }
446
447 absolute_path = utils_expand_path(path->value);
448 if (!absolute_path) {
449 ret = -1;
450 goto end;
451 }
452
453 config_string_set(path, absolute_path);
454end:
455 return ret;
456}
457
458#define RESOLVE_CHECK(path_config_str) \
459 if (resolve_path(path_config_str)) \
460 return -1
461
462LTTNG_HIDDEN
463int sessiond_config_resolve_paths(struct sessiond_config *config)
464{
465 RESOLVE_CHECK(&config->apps_unix_sock_path);
466 RESOLVE_CHECK(&config->client_unix_sock_path);
467 RESOLVE_CHECK(&config->wait_shm_path);
468 RESOLVE_CHECK(&config->health_unix_sock_path);
469 RESOLVE_CHECK(&config->lttng_ust_clock_plugin);
470 RESOLVE_CHECK(&config->pid_file_path);
471 RESOLVE_CHECK(&config->lock_file_path);
472 RESOLVE_CHECK(&config->load_session_path);
473 RESOLVE_CHECK(&config->agent_port_file_path);
474 RESOLVE_CHECK(&config->consumerd32_path);
475 RESOLVE_CHECK(&config->consumerd32_bin_path);
476 RESOLVE_CHECK(&config->consumerd32_lib_dir);
477 RESOLVE_CHECK(&config->consumerd32_err_unix_sock_path);
478 RESOLVE_CHECK(&config->consumerd32_cmd_unix_sock_path);
479 RESOLVE_CHECK(&config->consumerd64_path);
480 RESOLVE_CHECK(&config->consumerd64_bin_path);
481 RESOLVE_CHECK(&config->consumerd64_lib_dir);
482 RESOLVE_CHECK(&config->consumerd64_err_unix_sock_path);
483 RESOLVE_CHECK(&config->consumerd64_cmd_unix_sock_path);
484 RESOLVE_CHECK(&config->kconsumerd_path);
485 RESOLVE_CHECK(&config->kconsumerd_err_unix_sock_path);
486 RESOLVE_CHECK(&config->kconsumerd_cmd_unix_sock_path);
487 return 0;
488}
489
490LTTNG_HIDDEN
491void sessiond_config_log(struct sessiond_config *config)
492{
493 DBG_NO_LOC("[sessiond configuration]");
a3bc3918
JR
494 DBG_NO_LOC("\tversion %s", VERSION);
495 if (GIT_VERSION[0] != '\0') {
496 DBG_NO_LOC("\tgit version %s", GIT_VERSION);
497 }
498 if (EXTRA_VERSION_NAME[0] != '\0') {
499 DBG_NO_LOC("\textra version name %s", EXTRA_VERSION_NAME);
500 }
501 if (EXTRA_VERSION_DESCRIPTION[0] != '\0') {
502 DBG_NO_LOC("\textra version description:\n\t%s", EXTRA_VERSION_DESCRIPTION);
503 }
7f5ed73a
JR
504 if (EXTRA_VERSION_PATCHES[0] != '\0') {
505 DBG_NO_LOC("\textra version patches:\n\t%s", EXTRA_VERSION_PATCHES);
506 }
2ca43cb1
JR
507 DBG_NO_LOC("\tverbose: %i", config->verbose);
508 DBG_NO_LOC("\tverbose consumer: %i", config->verbose_consumer);
509 DBG_NO_LOC("\tquiet mode: %s", config->quiet ? "True" : "False");
2288467f 510 if (config->agent_tcp_port.begin == config->agent_tcp_port.end) {
2ca43cb1 511 DBG_NO_LOC("\tagent_tcp_port: %i", config->agent_tcp_port.begin);
2288467f 512 } else {
2ca43cb1 513 DBG_NO_LOC("\tagent_tcp_port: [%i, %i]",
2288467f
JG
514 config->agent_tcp_port.begin,
515 config->agent_tcp_port.end);
516 }
2ca43cb1
JR
517 DBG_NO_LOC("\tapplication socket timeout: %i", config->app_socket_timeout);
518 DBG_NO_LOC("\tno-kernel: %s", config->no_kernel ? "True" : "False");
519 DBG_NO_LOC("\tbackground: %s", config->background ? "True" : "False");
520 DBG_NO_LOC("\tdaemonize: %s", config->daemonize ? "True" : "False");
521 DBG_NO_LOC("\tsignal parent on start: %s", config->sig_parent ? "True" : "False");
522 DBG_NO_LOC("\ttracing group name: %s", config->tracing_group_name.value ? : "Unknown");
523 DBG_NO_LOC("\tkmod_probe_list: %s", config->kmod_probes_list.value ? : "None");
524 DBG_NO_LOC("\tkmod_extra_probe_list: %s", config->kmod_extra_probes_list.value ? : "None");
525 DBG_NO_LOC("\trundir: %s", config->rundir.value ? : "Unknown");
526 DBG_NO_LOC("\tapplication socket path: %s", config->apps_unix_sock_path.value ? : "Unknown");
527 DBG_NO_LOC("\tclient socket path: %s", config->client_unix_sock_path.value ? : "Unknown");
528 DBG_NO_LOC("\twait shm path: %s", config->wait_shm_path.value ? : "Unknown");
529 DBG_NO_LOC("\thealth socket path: %s", config->health_unix_sock_path.value ? : "Unknown");
530 DBG_NO_LOC("\tLTTNG_UST_CLOCK_PLUGIN: %s", config->lttng_ust_clock_plugin.value ? : "None");
531 DBG_NO_LOC("\tpid file path: %s", config->pid_file_path.value ? : "Unknown");
532 DBG_NO_LOC("\tlock file path: %s", config->lock_file_path.value ? : "Unknown");
533 DBG_NO_LOC("\tsession load path: %s", config->load_session_path.value ? : "None");
534 DBG_NO_LOC("\tagent port file path: %s", config->agent_port_file_path.value ? : "Unknown");
535 DBG_NO_LOC("\tconsumerd32 path: %s", config->consumerd32_path.value ? : "Unknown");
536 DBG_NO_LOC("\tconsumerd32 bin path: %s", config->consumerd32_bin_path.value ? : "Unknown");
537 DBG_NO_LOC("\tconsumerd32 lib dir: %s", config->consumerd32_lib_dir.value ? : "Unknown");
538 DBG_NO_LOC("\tconsumerd32 err unix sock path:%s", config->consumerd32_err_unix_sock_path.value ? : "Unknown");
539 DBG_NO_LOC("\tconsumerd32 cmd unix sock path:%s", config->consumerd32_cmd_unix_sock_path.value ? : "Unknown");
540 DBG_NO_LOC("\tconsumerd64 path: %s", config->consumerd64_path.value ? : "Unknown");
541 DBG_NO_LOC("\tconsumerd64 bin path: %s", config->consumerd64_bin_path.value ? : "Unknown");
542 DBG_NO_LOC("\tconsumerd64 lib dir: %s", config->consumerd64_lib_dir.value ? : "Unknown");
543 DBG_NO_LOC("\tconsumerd64 err unix sock path:%s", config->consumerd64_err_unix_sock_path.value ? : "Unknown");
544 DBG_NO_LOC("\tconsumerd64 cmd unix sock path:%s", config->consumerd64_cmd_unix_sock_path.value ? : "Unknown");
545 DBG_NO_LOC("\tkconsumerd path: %s", config->kconsumerd_path.value ? : "Unknown");
546 DBG_NO_LOC("\tkconsumerd err unix sock path: %s", config->kconsumerd_err_unix_sock_path.value ? : "Unknown");
547 DBG_NO_LOC("\tkconsumerd cmd unix sock path: %s", config->kconsumerd_cmd_unix_sock_path.value ? : "Unknown");
e6142f2e 548}
This page took 0.094031 seconds and 4 git commands to generate.