As seen in #16837, the sed
calls in depends
fail silently, and can result in silent, unwanted regressions when packages are updated.
It seems that a possible solution might be something like the following: https://askubuntu.com/a/1036918
As seen in #16837, the sed
calls in depends
fail silently, and can result in silent, unwanted regressions when packages are updated.
It seems that a possible solution might be something like the following: https://askubuntu.com/a/1036918
+1 for improving robustness here. Silently failing errors are horrible for troubleshooting.
Edit: #16837 (review) illustrates, again, why this is important
I spent some time looking at this today. Would it be ok if we required gnu sed
in depends (there is some precedent as we require glibtoolize
elsewhere in the build system)? Otherwise I’m not sure that the suggested approach would work out of the box on macOS (BSD sed).
I did have a look at the approach in https://stackoverflow.com/a/28966696, but that seemed a bit messy. Will revisit later on.
Doesn’t sed -i
already rely on GNU sed? I don’t remember seeing it in BSDs.
Apparently it does, just checked on FreeBSD at least and
0 -i extension
1 Edit files in-place similarly to -I, but treat each file
2 independently from other files. In particular, line numbers in
3 each file start at 1, the "$" address matches the last line of
4 the current file, and address ranges are limited to the current
5 file. (See Sed Addresses.) The net result is as though each file
6 were edited by a separate sed instance.
Couldn’t we mock (or wrap) sed
while doing depends? That way we can control the exit code.
A wrapper that does the following, should be good enough:
0 - check that ${file}_BACKUP does not exist
1 - run replacement with unmodified sed on $file, additionally passing `--in-place=_BACKUP`
2 - assert that $file differs from $file_BACKUP
3 - delete $file_BACKUP
Couldn’t we mock (or wrap)
sed
while doing depends? That way we can control the exit code.A wrapper that does the following, should be good enough:
0 - check that ${file}_BACKUP does not exist 1 - run replacement with unmodified sed on $file, additionally passing `--in-place=_BACKUP` 2 - assert that $file differs from $file_BACKUP 3 - delete $file_BACKUP
How would we make that wrapper accessible in the Makefile? Somethine like SHELL = /usr/bin/env PATH=$(CURDIR)/wrappers:${PATH} sh
?
sed
usage is basically contained to qt (1 in libxcb that we ), and is non-trivial to remove.
dongcarl
laanwj
fanquake
MarcoFalke
Labels
Build system