-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: make shell commands more portable in firejail.vim #5577
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POSIX tr understands '\n', so use that instead of the less portable $'\n'. Commands used to search and replace: $ f=contrib/vim/syntax/firejail.vim; \ printf '%s\n' "$(sed -E \ "s/tr +\\\$'\\\\n'/tr '\\\\n'/g" "$f")" >"$f" Added on commit a1cc4a5 ("Add vim syntax and ftdetect files (netblue30#2679)", 2019-05-06).
It seems to be equivalent to just delimiting the beginning and the end of the line with `^foo$`. Also, put the regex mode (-E) first. Commands used to search and replace: $ f=contrib/vim/syntax/firejail.vim; \ printf '%s\n' "$(sed -E \ "s|grep -vEx '([^']+)'|grep -Ev '^\\1\$'|" "$f")" >"$f" Added on commit a1cc4a5 ("Add vim syntax and ftdetect files (netblue30#2679)", 2019-05-06).
Only a single script is passed by argument in each invocation. Added on commit a1cc4a5 ("Add vim syntax and ftdetect files (netblue30#2679)", 2019-05-06) and on commit d2e10f2 ("vim: update list of syscalls", 2021-05-29) / PR netblue30#4318.
To avoid depending on an extra package without need. Commands used to search and replace: $ f=contrib/vim/syntax/firejail.vim; \ printf '%s\n' "$(sed -E \ "s|rg -o '([^']+)' -r '\\\$1'|sed -En 's/.*\\1.*/\\\\1/p'|" "$f")" >"$f" Note: `sed -E` is not in POSIX.1-2017 (Issue 7), but it has been accepted into the upcoming POSIX standard version[1] and is supported by at least GNU, busybox and OpenBSD grep. Added on commit a1cc4a5 ("Add vim syntax and ftdetect files (netblue30#2679)", 2019-05-06). [1] https://www.austingroupbugs.net/view.php?id=528
reinerh
approved these changes
Jan 10, 2023
merged, thanks! |
kmk3
added a commit
to kmk3/firejail
that referenced
this pull request
Jan 28, 2023
Changes: * Use the commands from contrib/vim/syntax/firejail.vim to create makefile targets to generate syntax lists in contrib/syntax/lists * Add contrib/syntax/files/example.in as an example of how to generate syntax files * Generate and add the syntax lists, to make it easier to spot if they are properly updated when a new command is added or if their recipes also need changes * Add "syntax" and "contrib" makefile targets Note: The generation commands are executed mostly silently to avoid generating too much noise when also making other targets. Note2: In some generation commands, a `$$` escape is used to pass `$` to the shell, to avoid being interpreted by make as the start of a macro. Note3: `@make_input@` is used in example.in to make it clear that the file is generated (and that it is generated by make rather than configure), similarly to how `@configure_input@` is used in configure input files. See also apparmor.vim: $ head -n 2 /usr/share/vim/vimfiles/syntax/apparmor.vim " generated from apparmor.vim.in by create-apparmor.vim.py " do not edit this file - edit apparmor.vim.in or create-apparmor.vim.py instead Environment: apparmor 3.1.2-1 on Artix Linux. Relates to netblue30#2679 netblue30#5502 netblue30#5577 netblue30#5612.
kmk3
added a commit
to kmk3/firejail
that referenced
this pull request
Jan 28, 2023
Changes: * Generate firejail.vim from firejail.vim.in * Generate firejail-profile.lang from firejail-profile.lang.in * Update the manual syntax file steps on the new command checklist on CONTRIBUTING.md to use `make syntax` instead Relates to netblue30#2679 netblue30#5502 netblue30#5577 netblue30#5612.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added on commit a1cc4a5 ("Add vim syntax and ftdetect files (#2679)",
2019-05-06).
See also commit d2e10f2 ("vim: update list of syscalls", 2021-05-29) /
PR #4318.
Cc: @laomaiweng @reinerh (from #2679 and #4318)