FS#27313 - [pkgtools] pkgfile-hook hooks should not execute when piped or in a subshell
Attached to Project:
Community Packages
Opened by Simon Gomizelj (simongmzlj) - Monday, 28 November 2011, 19:53 GMT
Last edited by Jelle van der Waa (jelly) - Saturday, 17 November 2012, 14:53 GMT
Opened by Simon Gomizelj (simongmzlj) - Monday, 28 November 2011, 19:53 GMT
Last edited by Jelle van der Waa (jelly) - Saturday, 17 November 2012, 14:53 GMT
|
Details
Description:
pkgfile-hook.{zsh,bash} should not run when part of a pipe or subshell. The hook's message gets piped around and this can lead to some unexpected behaviour. Better to no do anything. The following snippet is sufficient to check: local pid ppid pgrp session tty_nr tpgid # do not run when within a pipe or subshell [[ ! -t 1 ]] && return 127 read pid cmd state ppid pgrp session tty_nr tpgid rest < /proc/self/stat [[ $$ -eq $tpgid ]] && return 127 Should work for both bash and zsh. Additional info: * pkgtools 23-2 Steps to reproduce: With a package that you don't have installed (for examples sake, emacs), run: $ emacs > dump. Dump will now contain pkgfile-hook's generated message. $ emacs & Makes a mess of the terminal. |
This task depends upon
Closed by Jelle van der Waa (jelly)
Saturday, 17 November 2012, 14:53 GMT
Reason for closing: Won't fix
Additional comments about closing: This bugreport is reported against the old pkgfile package, the new one is rewritten in C
Saturday, 17 November 2012, 14:53 GMT
Reason for closing: Won't fix
Additional comments about closing: This bugreport is reported against the old pkgfile package, the new one is rewritten in C