ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] A: trap shell builtin (was: [SCM] packages/make-initrd: heads/master)
  @ 2010-02-18 13:42 ` Dmitry V. Levin
  0 siblings, 0 replies; only message in thread
From: Dmitry V. Levin @ 2010-02-18 13:42 UTC (permalink / raw)
  To: Alexey Gladkov; +Cc: ALT Devel discussion list

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

On Thu, Feb 18, 2010 at 04:05:28PM +0300, Alexey Gladkov wrote:
> Update of /people/legion/packages/make-initrd.git
[...]
> --- a/make-initrd.in
> +++ b/make-initrd.in
> @@ -1,4 +1,25 @@
>  #!/bin/sh -efu
>  
> +PROG="${0##*/}"
> +TEMPDIR=
> +term_handler() {
> +	local rc=$?
> +	[ -z "$TEMPDIR" ] || rm -rf -- "$TEMPDIR"
> +	exit $rc
> +}
> +
> +exit_handler() {
> +	local rc=$?
> +	trap - EXIT
> +	[ -z "$TEMPDIR" ] || rmdir -- "$TEMPDIR" 2>/dev/null ||:
> +	exit $rc
> +}
> +
> +
> +TEMPDIR="$(mktemp -d "@TMPDIR@/$PROG.XXXXXXXXX")"
> +trap term_handler HUP INT QUIT TERM
> +trap exit_handler EXIT

Это уже совсем старые грабли: term_handler устанавливает случайный код
возврата и удаляет $TEMPDIR дважды.

Подробнее на эту тему см.
http://lists.gnu.org/archive/html/bug-gnulib/2010-01/msg00361.html
http://lists.gnu.org/archive/html/bug-gnulib/2010-01/msg00377.html

There is an interesting reading about portability issues related to
shell "trap" builtin:
http://www.gnu.org/software/hello/manual/autoconf/Limitations-of-Builtins.html#trap


-- 
ldv

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-02-18 13:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-18 13:42 ` [devel] A: trap shell builtin (was: [SCM] packages/make-initrd: heads/master) Dmitry V. Levin

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git