-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
custom_target replaces back-slashes with slashes in the command arguments #1564
Comments
... or maybe meson should do a single layer of unescaping by itself, like python, so that it's possible to embed newlines and tabs in strings. Meaning that if I want to pass |
See #737. |
As the link indicates this is a thorny problem because we need to support Windows natively. Sadly there does not seem to be a way to pass all possible characters through both shell and The recommended way is to instead write your pipelines in standalone scripts and running those from Meson. Granted this is some amount of work beforehand but it is beneficial in several ways:
|
Honestly the piece of code that does that is wrong and we should remove it, but we just need to figure out why GStreamer needs it on Windows and fix whatever is broken in that regard. Some of that will be on the GStreamer end, but I suspect some of that is bugs in Meson too. |
To clarify: yes, we should pass all special characters through all shells and systems properly. Not doing that is a bug. However in practice this is is a really thorny problem and it is unlikely to ever work 100% reliably. Standalone scripts that are just invoked are always reliable, can be tested in isolation and are easy to convert to a different language (e.g. from Awk to Python or what have you) should the need arise. |
This is also a problem when using the redirect symbol on Unix >. Here is an example: This will call arm-none-eabi-gcc with quotes around the redirect symbol '>'.
|
Also, don't do |
I think we should try removing that snippet and see what breaks. It will only get harder to remove it as time goes on. |
I'll get to the bottom of why this was needed in gstreamer this week. FTR, the first step is setting up cerbero which is a massive yak-shave unless you've done it before. |
This is no longer required since we always use `/` as the path separator for file arguments on Windows now. The only effect this now has is to mangle the string args people pass to custom targets. Closes #1564
This is no longer required since we always use `/` as the path separator for file arguments on Windows now. The only effect this now has is to mangle the string args people pass to custom targets. Closes #1564
Re-apply mesonbuild#737; revert mesonbuild#780. Fixes mesonbuild#1564.
So, I already knew Meson required wrappers to be written:
Now this list is extended with:
This is outright ridiculous. I think Meson should come with a BIG BOLD CAPITALIZED FLASHING SIDE SCROLLING WARNING that using it requires writing TONS of code, and it can only possibly make sense for your project if the amount of code you WILL have to write (and debug, and test) in order to accommodate all the quirks and deficiencies and opinionatednesses of Meson is less than say 15% of the actual codebase you want to build with it. |
Re-apply mesonbuild#737; revert mesonbuild#780. Fixes mesonbuild#1564.
Re-apply mesonbuild#737; revert mesonbuild#780. Fixes mesonbuild#1564.
Re-apply mesonbuild#737; revert mesonbuild#780. Fixes mesonbuild#1564.
I want to avoid having to build the .o file before extracting malloc.o from libc.a. To parse the source file, we need a clear marker, which I also used to avoid having to have duplicate declarations. Because of Meson is incapable of using backslashes in custom_target() commands (see [1]), I had to write a shell script to execute sed, so I decided to move the ar x command there too. [1] mesonbuild/meson#1564 Signed-off-by: Thiago Macieira <[email protected]>
I want to avoid having to build the .o file before extracting malloc.o from libc.a. To parse the source file, we need a clear marker, which I also used to avoid having to have duplicate declarations. Because of Meson is incapable of using backslashes in custom_target() commands (see [1]), I had to write a shell script to execute sed, so I decided to move the ar x command there too. [1] mesonbuild/meson#1564 Signed-off-by: Thiago Macieira <[email protected]>
I want to avoid having to build the .o file before extracting malloc.o from libc.a. To parse the source file, we need a clear marker, which I also used to avoid having to have duplicate declarations. Because of Meson is incapable of using backslashes in custom_target() commands (see [1]), I had to write a shell script to execute sed, so I decided to move the ar x command there too. [1] mesonbuild/meson#1564 Signed-off-by: Thiago Macieira <[email protected]>
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved.
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b) (cherry picked from commit ded73e6)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b) (cherry picked from commit ded73e6)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b) (cherry picked from commit ded73e6) (cherry picked from commit d31ac84)
I added the filtering in 752fedbea7c02c82287c7ff2a4139f528b3f7ba8 as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b013bbc8c6290348f701ddb862928cc1a0)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b) (cherry picked from commit ded73e6) (cherry picked from commit d31ac84)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b) (cherry picked from commit ded73e6) (cherry picked from commit d31ac84) (cherry picked from commit f924288)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b) (cherry picked from commit ded73e6) (cherry picked from commit d31ac84) (cherry picked from commit f924288)
I added the filtering in 752fedbea7c02c82287c7ff2a4139f528b3f7ba8 as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b013bbc8c6290348f701ddb862928cc1a0) (cherry picked from commit ded73e68fcbfbf82beba15a8f0280e5c010c8bde) (cherry picked from commit d31ac846b22dc7d1245b4df01a1868866b529447) (cherry picked from commit f9242887943fa2e7345f915fbfacd235d67dbed7)
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved.
I added the filtering in 752fedb as a way to reduce the number of items in the tables. I thought it's "obvious", but it might not be so. One immediate problem is that the filter is broken, because on arm64, os.uname().machine returns "aarch64", so we incorrectly filter out the arm syscalls (there is just one: arm_fadvise64_64). Of course we could fix the filter, but I think it's better to nuke it altogether. The filter on applies to 1 arm syscall and 5 s390 syscalls, and we have 500+ other syscalls, so this "optimization" doesn't really matter. OTOH, if we get the filter wrong, the result is bad. And also, the existence of the filter at all creates problems for cross-builds. I wanted to get rid of 'generate-syscall-list.py', but we need to generate a backslash in the output. mesonbuild/meson#1564 makes this very very hard, since any attempt to put a backslash an inline argument results in the backslash being replaces by a forward slash, which doesn't quite have the same meaning. So let's use a standalone script until mesonbuild/meson#1564 is resolved. (cherry picked from commit 58fcc6b) (cherry picked from commit ded73e6) (cherry picked from commit d31ac84) (cherry picked from commit f924288) (cherry picked from commit b23b268)
Could there at least be an option to I have a meson configuration where I use a Using a wrapper script doesn't really solve the problem, because the backslash is part of the input. I suppose I could make a script the handles the full loop, but then the targets are less granular. |
https://sr.ht/~lattis/muon/ doesn't have this issue. Which is a |
Muon also doesn't support features needed to compile major projects such as GTK. |
If meson is going to corrupt the input to custom_target, can this gotcha at least be documented in the manual? |
We just ran into this in Postgres. Really unfortunate for a build tool not to do what the developer asks of it. |
meson makes the backslashes in text2macro.pl's --strip argument into forward slashes, effectively disabling comment stripping. That hasn't caused us issues before, but it breaks the test case for b7e3a52. We don't really need the pattern to be adjustable, so just hard-wire it into the script instead. Context: mesonbuild/meson#1564 Security: CVE-2024-10979
meson makes the backslashes in text2macro.pl's --strip argument into forward slashes, effectively disabling comment stripping. That hasn't caused us issues before, but it breaks the test case for b7e3a52. We don't really need the pattern to be adjustable, so just hard-wire it into the script instead. Context: mesonbuild/meson#1564 Security: CVE-2024-10979
meson makes the backslashes in text2macro.pl's --strip argument into forward slashes, effectively disabling comment stripping. That hasn't caused us issues before, but it breaks the test case for b7e3a52. We don't really need the pattern to be adjustable, so just hard-wire it into the script instead. Context: mesonbuild/meson#1564 Security: CVE-2024-10979
meson makes the backslashes in text2macro.pl's --strip argument into forward slashes, effectively disabling comment stripping. That hasn't caused us issues before, but it breaks the test case for b7e3a52. We don't really need the pattern to be adjustable, so just hard-wire it into the script instead. Context: mesonbuild/meson#1564 Security: CVE-2024-10979
meson makes the backslashes in text2macro.pl's --strip argument into forward slashes, effectively disabling comment stripping. That hasn't caused us issues before, but it breaks the test case for b7e3a52a8. We don't really need the pattern to be adjustable, so just hard-wire it into the script instead. Context: mesonbuild/meson#1564 Security: CVE-2024-10979 (cherry picked from commit 4cd4f3b97492c1b38115d0563a2e55b136eb542a)
Not sure about the details, but at least
\t
becomes/t
and\\
becomes\
:This makes it quite hard to write regexps and printf lines and such.
#1512 is probably related.
The text was updated successfully, but these errors were encountered: