This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Saturday 07 September 2013 11:45:45 Patrick "P. J." McDermott wrote:
> +# The following command substitution is needed to make ldd work in
> +# SELinux environments where the executed program might not have
> +# permissions to write to the console/tty. The extra "x" character
> +# prevents the shell from trimming trailing newlines from command
> +# substitution results.
> +try_trace() {
> + output=$(eval $add_env '"$@"'; rc=$?; printf 'x'; exit $rc)
> + rc=$?
> + printf '%s' "${output%x}"
> + return $rc
> +}
not really a new issue, but doesn't this also need to handle stderr ?
simply adding 2>&1 for the eval statement seems sufficient
i dislike the missing `local` decls for output and rc. but those aren't
exactly specified in POSIX (even if every reasonable shell supports it). maybe
do a double sub-shell instead ?
try_trace() {
(
output=$(.....)
rc=$?
printf ....
exit $rc
)
}
-mike
Attachment:
signature.asc
Description: This is a digitally signed message part.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |