aboutsummaryrefslogtreecommitdiff
path: root/src/util.lisp
Commit message (Collapse)AuthorAge
* MULTIPLE-VALUE-MAPCAN: don't return spurious 2nd value & some testsSean Whitton2022-06-27
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* convert some internal shell snippets to single linesSean Whitton2022-06-27
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* MULTIPLE-VALUE-MAPCAN: rework for less list traversal in many casesSean Whitton2022-06-27
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* factor out PROG-CHANGESSean Whitton2022-06-14
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* run tests with temporary gpg homeDavid Bremner2022-05-05
| | | | | | | | | | | The big picture change here is the introduction of a custom test runner which allows setting up and tearing down various data sources (or other resources) for the test suite. In order to parse the output of gpg, provide a new exported function CONSFIGURATOR:STRIP-PREFIX. Signed-off-by: David Bremner <david@tethera.net>
* rename RETURN-EXIT -> EXIT-CODE-TO-RETVALSean Whitton2022-04-02
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* rename SYSTEMD-{-USER -> USER-INSTANCE-ARGS} & stop using &restSean Whitton2022-04-02
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* replace some Scheme-style namesSean Whitton2022-04-01
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add VALID-HOSTNAME-PDavid Bremner2022-03-22
| | | | | | | Initial intended application is checking data source IDEN1. This could be done as a one-liner with a more complex regex, but that seems harder to debug. Signed-off-by: David Bremner <david@tethera.net>
* REINIT-FROM-SIMPLE-PRINT: don't call REINITIALIZE-INSTANCESean Whitton2022-03-13
| | | | | | This makes us more like MAKE-LOAD-FORM-SAVING-SLOTS. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* MAPC-OPEN-{INPUT,OUTPUT}-STREAMS: don't use &restSean Whitton2022-03-12
| | | | | | This brings these functions closer to MAPC. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* rename DEFINE-PRINT-OBJECT-FOR-STRUCTLIKE & REINIT-STRUCTLIKESean Whitton2022-03-12
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* update my copyright yearsSean Whitton2022-03-12
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* replace ESCAPE-SH-TOKEN and ESCAPE-SH-COMMAND with new SH-ESCAPESean Whitton2022-03-11
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* drop SYSTEM and add simpler code in a FLET where it's neededSean Whitton2022-03-11
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add "local" and "remote" to the names of some exported symbolsSean Whitton2022-03-09
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* rename PLIST-TO-CMD-ARGS -> PLIST->LONG-OPTIONSSean Whitton2022-03-09
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* rename MEMSTRING= -> MEMSTR=Sean Whitton2022-03-09
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* drop unused function SYMBOL-NAMEDSean Whitton2022-03-09
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* replace usages of NOOP & drop the functionSean Whitton2022-03-09
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* define +ALPHANUM+ at compile time tooSean Whitton2021-11-28
| | | | | | | Necessary because we use #.(length +alphanum+) later in the file. Reported-by: Yehouda Harpaz <yeh@lispworks.com> Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* replace usage of UIOP version comparison utilities with our ownSean Whitton2021-11-28
| | | | | | | | | DATA.GIT-SNAPSHOT generates version numbers like 2342423.ab09890f2bcd where only the first, purely numerical component is intended for comparison, and the second component is just additional information. UIOP's utilities don't give the correct answers for cases like that; e.g. (uiop:version<= "1.a" "0") => T. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* LINES: support trimming the linesSean Whitton2021-11-20
| | | | | | TRIMFUN will typically be STRING-TRIM, STRING-LEFT-TRIM or STRING-RIGHT-TRIM. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add RANDOM-ALPHANUMERICSean Whitton2021-11-11
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* use higher-numbered codes for change status, 1 for unhandled errorsSean Whitton2021-11-08
| | | | | | | | When SBCL fails to start up, such as when previously-loaded shared libraries cannot be found while trying to reinvoke a dumped image, it exits 1. We must avoid erroneously interpreting this as a successful attempt to make changes. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add Linux namespace-entering connectionsSean Whitton2021-11-08
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* :SETUID: pass target uid to POSIX-LOGIN-ENVIRONMENT for correct PATHSean Whitton2021-11-01
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* basic systemctl(1) properties: add USER argument for --userSean Whitton2021-10-28
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* :CHROOT.FORK: unshare mount namespace before making temporary mountsSean Whitton2021-10-23
| | | | | | | | | This avoids some cases of interference between the deployment of the chroot and other system activity. For example, before this change, the :ALWAYS-DEPLOYS option to LIBVIRT:KVM-BOOTS-CHROOT{,-FOR} could interact with Virtiofs in such a way as to break the running VM. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* be more specific regarding POSIX and the creation of temporary dirsSean Whitton2021-10-23
| | | | | | POSIX lacks 'mktemp -d' but it does have mkdtemp(3). Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add wrappers of some system functions to manipulate POSIX.1e ACLsSean Whitton2021-10-23
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add SKIP-SEQUENCE, ABORTED-CHANGE, ESEQPROPS-UNTILSean Whitton2021-10-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We establish a SKIP-PROPERTY restart for each sequencing combinator, such that in addition to skipping over individual property applications, it is possible to abandon the whole sequence. However, that restart discards information about whether or not a change was made by the property applications of the abandoned sequence prior to the property application interrupted by an error. The new SKIP-SEQUENCE restart preserves this information by returning from the DOLIST in APPLY-AND-PRINT. The implementation of the SKIP-SEQUENCE restart must take into account the fact that the property application interrupted by the error might have made a change prior to failing. In particular, the new restart must not cause the sequencing combinator to return :NO-CHANGE unless it can infer that the property application interrupted by an error made no change. To achieve this, capture whether the interrupted property application made a change by introducing a distinction between plain FAILED-CHANGE and a new condition class, ABORTED-CHANGE. These changes permit the implementation of a new combinator, ESEQPROPS-UNTIL, which invokes SKIP-SEQUENCE when a given condition is signalled. The new combinator is like SEQPROPS in that it allows for continuing the deployment despite a signalling of FAILED-CHANGE, but it is like ESEQPROPS in not attempting to apply succeeding propapps. It also offers finer-grained control over what kinds of failures are to be tolerated than does SEQPROPS. When the condition is ABORTED-CHANGE or a subclass, ESEQPROPS-UNTIL returns information about whether or not a change was made by the property applications of the abandoned sequence prior to the property application that was interrupted, enabling useful combinations with ON-CHANGE. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add DEFINE-ERROR-RETVAL-CFUN, CHROOT, CLEARENVSean Whitton2021-10-21
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* use CFFI, mostly via Osicat, for all syscalls/libc except fork(2)Sean Whitton2021-09-09
| | | | | | | | | | Also replace some calls to chmod(1) with calls to chmod(2). Using CFFI rather than implementation-specific wrappers should be better for portability. Also with this commit we stop hard coding types like uid_t as :UNSIGNED-INT, which was less portable. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* fix portability of mkfifo(3) wrapper to FreeBSDHendur Saga2021-08-12
| | | | Signed-off-by: Hendur Saga <hendursaga@yahoo.com>
* return type in FOREIGN-FUNCALL of geteuid(2) is unsignedSean Whitton2021-07-24
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* WITH-DEPLOYMENT-REPORT: use &BODY not &RESTSean Whitton2021-07-24
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* UNWIND-PROTECT-IN-PARENT -> UNWIND-PROTECTSean Whitton2021-07-24
| | | | | | No longer needed thanks to f4e9170e73cb4bcfa7328422b4ff4f72d1339dd0. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* new approach to calling fork(2) in remote Lisp imagesSean Whitton2021-07-24
| | | | | | | | | | | Drop CAN-PROBABLY-FORK because we now only try to fork(2) in contexts in which there shouldn't ever be any other threads running, apart from Lisp implementation finaliser threads and the like. We no longer need to RESET-DATA-SOURCES before CONTINUE-DEPLOY* because we now only fork(2) in contexts in which *NO-DATA-SOURCES* is t. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* DEFINE-PRINT-OBJECT-FOR-STRUCTLIKE: include slots without initargsSean Whitton2021-07-23
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* DEFINE-PRINT-OBJECT-FOR-STRUCTLIKE: respect *READ-EVAL*Sean Whitton2021-07-23
| | | | | | | In accordance with the "Notes" section of the standard's description of *READ-EVAL*. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add mkfifo(3) wrapper & utilsSean Whitton2021-07-23
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* LINES: split on CRLF tooSean Whitton2021-07-10
| | | | | | Prompted by apt-get(8) output containing some lines ending CRLF. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* signal SKIPPED-PROPERTIES & factor out interpreting exit codesSean Whitton2021-07-10
| | | | | | | | | | | | Unconditionally signalling FAILED-CHANGE does not make sense because perhaps the type of condition C is not a subtype of SIMPLE-CONDITION. Moreover, when we invoke the SKIP-PROPERTY restart we do not actually pass the condition. For simplicity, and since all we need is notification that a SKIP-PROPERTY restart was invoked, instead define and signal a special-purpose condition. Additionally, use an exit code to pass the signal between Lisp images. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add INSTALLER:CLEANLY-INSTALLED-ONCE & some utilsSean Whitton2021-07-10
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* UNWIND-PROTECT-IN-PARENT: drop pointless resignalSean Whitton2021-07-06
| | | | | | The handler declines to handle the signal and so it continues to propagate. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add POSIX-LOGIN-ENVIRONMENT and use in :SETUID connectionSean Whitton2021-07-06
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add NETWORK:{CLEAN-/ETC/NETWORK/INTERFACES,PRESERVE-STATIC-ONCE}Sean Whitton2021-07-06
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* ESCAPE-SH-COMMAND: fix parameter nameSean Whitton2021-06-25
| | | | | | No functional change. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* attempt to fix PATHNAME-FILE for pathnames with no directorySean Whitton2021-06-25
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>