| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
- For example, mangle "#!/usr/bin/env -S vd" to "#!/usr/bin/vd"
- Fixes: rhbz#2265038
Signed-off-by: Jani Välimaa <wally@mageia.org>
|
| |
|
|
|
|
| |
(rhbz#1998924)
|
|
|
|
|
|
|
|
|
|
|
| |
If the file we are trying to mangle a shebang in has
0 lines (as reported by `wc`) `read` command fails
to read the first line and the script fails silently.
Text files without newlines should not be executable as there
is no way for them to contain a shebang.
Signed-off-by: Jani Välimaa <wally@mageia.org>
|
|
|
|
|
|
|
|
|
| |
At least building texlive-texmf fails without this because brp-mangle-shebangs has -e in its shebang.
-e Exit immediately if a command exits with a non-zero status.
$ read shebang_line < BUILD/texlive-20190410-texmf/texmf-dist/doc/generic/pst-mirror/createEPS/test.sh
$ echo $?
1
|
|
|
|
|
|
|
| |
Run "stat" to get mtime, and "touch -d $saved_mtime"
only if we indeed modify file's shebang.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
trim() {
printf '%s' "$*"
}
...
read shebang_line < "$f" || :
orig_shebang=$(trim $(echo "$shebang_line" | grep -Po "#!\K.*" || echo))
The "trimming", i.e. replacement of multiple spaces and removal of leading
and trailing spaces, is achieved because "trim $(cmd)" construct has an
unquoted $(), which is subject to word splitting.
This works, yes. BUT.
It is also subject to glob expansion - any ?s and *s will be attempted
to be expanded as well - definitely NOT what we want!
This change replaces this trick with code which avoids the expansion issue,
and which does not spawn any subprocesses for string manipulations -
this is ~3 times faster (fork+execs are expensive).
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
|
|
| |
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
| |
|
| |
|
|
- fix /bin -> /usr/bin
- resolve "env foobar" -> "foobar"
install it in /usr/lib/rpm/redhat to make clear from where it comes
|