Detect empty executable files in operations
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 219
- PR merge metrics
- No merged PRs in 30d
Description
Operation command is executed as shell script.
https://ytsaurus.tech/docs/en/user-guide/data-processing/operations/operations-options#user_script_options
Posix shell has a confusing behavior for non-binary executable files without "#!" -- it silently executes them as a script:
https://linux.die.net/man/1/bash
> If this execution fails because the file is not in executable format, and the file is not a directory, it is assumed to be a shell script, a file containing shell commands.
I.e. any empty file always executes successfully.
It seems the only way to avoid that confusion is an adding sanity check for executable files in "file_paths":
https://ytsaurus.tech/docs/en/user-guide/data-processing/operations/operations-options#files
For now "size > 0" should be enough.
But we could check file magic as well - might be useful for cross-arch cross-os operations.
Contributor guide
Assessment
This issue has not been assessed yet.