diff --git a/src/Intrinsic.c b/src/Intrinsic.c --- a/src/Intrinsic.c +++ b/src/Intrinsic.c @@ -1345,21 +1345,99 @@ FillInLangSubs(Substitution subs, XtPerDisplay pd) } /* - * default path used if environment variable XFILESEARCHPATH - * is not defined. Also substitued for %D. - * The exact value should be documented in the implementation - * notes for any Xt implementation. + Return the default search path for the function + XtResolvePathname to use if XFILESEARCHPATH is + not defined. + + It returns the combination the set of values which are the 6 "stems" below, + prepended with "/run/current-system/profile", and $GUIX_PROFILE and + "$HOME/.guix-profile" + + These values provide the default paths where Guix/GuixSD can expect + to find resources for installed packages. */ static const char * -implementation_default_path(void) +guix_default_path(void) { -#if defined(WIN32) - static char xfilesearchpath[] = ""; + static const char *search_path_default_stem[] = { + "/lib/X11/%L/%T/%N%C%S", + "/lib/X11/%l/%T/%N%C%S", + "/lib/X11/%T/%N%C%S", + "/lib/X11/%L/%T/%N%S", + "/lib/X11/%l/%T/%N%S", + "/lib/X11/%T/%N%S" + }; + +#define SIZEOF_STEMS (strlen (search_path_default_stem[0]) \ + + strlen (search_path_default_stem[1]) \ + + strlen (search_path_default_stem[2]) \ + + strlen (search_path_default_stem[3]) \ + + strlen (search_path_default_stem[4]) \ + + strlen (search_path_default_stem[5])) + + + int i; + const char *current_profile = "/run/current-system/profile"; + char *home = getenv ("HOME"); + char *guix_profile = getenv ("GUIX_PROFILE"); + + size_t bytesAllocd = SIZEOF_STEMS + 1; + + /* This function is evaluated multiple times and the calling + code assumes that it is idempotent. So we must not allow + (say) a changed environment variable to cause it to return + something different. */ + static char *path = NULL; + if (path) + return path; + + bytesAllocd += 6 * (1 + strlen (current_profile)); + + if (guix_profile != NULL) + { + bytesAllocd += SIZEOF_STEMS; + bytesAllocd += 6 * (1 + strlen (guix_profile)); + } - return xfilesearchpath; -#else - return XFILESEARCHPATHDEFAULT; -#endif + if (home != NULL) + { + bytesAllocd += SIZEOF_STEMS; + bytesAllocd += 6 * (1 + strlen(home) + strlen ("/.guix-profile")); + } + + path = XtMalloc(bytesAllocd); + if (path == NULL) _XtAllocError(NULL); + + memset (path, 0, bytesAllocd); + + for (i = 0 ; i < 6 ; ++i) + { + strcat (path, current_profile); + strcat (path, search_path_default_stem[i]); + strcat (path, ":"); + } + + if (guix_profile != NULL) + for (i = 0 ; i < 6 ; ++i) + { + strcat (path, guix_profile); + strcat (path, search_path_default_stem[i]); + strcat (path, ":"); + } + + if (home != NULL) + for (i = 0 ; i < 6 ; ++i) + { + strcat (path, home); + strcat (path, "/.guix-profile"); + strcat (path, search_path_default_stem[i]); + strcat (path, ":"); + } + + /* Remove final : */ + path[strlen(path) - 1] = '\0'; + + return path; } @@ -1388,7 +1466,7 @@ XtResolvePathname(Display *dpy, { XtPerDisplay pd; static const char *defaultPath = NULL; - const char *impl_default = implementation_default_path(); + const char *impl_default = guix_default_path(); int idef_len = (int) strlen(impl_default); char *massagedPath; int bytesAllocd, bytesLeft; /a>...* gnu/services/mcron.scm (mcron-shepherd-services): Use match-record. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Bruno Victal 2023-03-21services: mcron: Restyle mcron-configuration....* doc/guix.texi (Scheduled Job Execution): Sync doc with source. * gnu/services/mcron.scm (mcron-configuration): Restyle. [log-format]: Fix incorrectly formatted text. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Bruno Victal 2022-11-17Revert "services: configuration: Revert to a working ‘guix home’."...This reverts commit 39e4e00f75be8055300cb0afffb8bd4b4d35f2cc, with fixes for the guix home issues reported and another one found while reconfiguring berlin in the subsequent commit. Maxim Cournoyer 2022-11-13services: configuration: Revert to a working ‘guix home’....This reverts commit 543d971ed2a1d9eb934af1f51930741d7cc4e7ef, and its dependent commit 9b21cd2e9a614f1937769caf3917a791b151d841, which appear to have triggered a recent wave of ‘guix home’ regressions involving (services (list (service home-bash-service-type))): In gnu/home/services/shells.scm: 504:7 3 (home-bash-extensions #<<home-bash-configuration> package: #<package bash@5.1.8 gnu/packages/ba…> …) In unknown file: 2 (append #<<location> file: "…" line: 14 column: 12> ()) In ice-9/boot-9.scm: 1685:16 1 (raise-exception _ #:continuable? _) 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure append: Wrong type argument in position 1 (expecting empty list): #<<location> file: "…" line: 14 column: 12> I should love to dive in & fix this rather than revert, but urgently need sleep. Tobias Geerinckx-Rice 2022-11-15services: mcron: Add log? and log-format fields to mcron-configuration....* gnu/services/mcron.scm (list-of-gexps?): New predicate. (mcron-configuration): Rewrite using define-configuration. [log?, log-format]: New fields. (mcron-shepherd-services): Invoke mcron with the --log and --log-format arguments when log? is #t, (generate-doc): New procedure. * doc/guix.texi (Scheduled Job Execution): Update doc. (Mcron Home Service): Likewise. * gnu/home/services/mcron.scm: Keep in sync with the above changes to gnu/services/mcron.scm. Maxim Cournoyer