From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] tst_test: using SIGTERM to terminate process
Date: Mon, 31 May 2021 14:54:39 +0200 [thread overview]
Message-ID: <YLTcjz4SoLJXPMTg@yuki> (raw)
In-Reply-To: <af8480e6-2020-d21d-bfe7-d9a4d28e0733@jv-coder.de>
Hi!
> >> But one more strange thing here.
> >> I wonder why this even works. $pid is used in _tst_kill_test and defined
> >> in _tst_setup_timer as a local variable.
> >> It looks like it is inherited through the call chain and since it is
> >> copied to the background process, it cannot be manipulated by the tests.
> >> Still I would vote for changing this at some point, because it is highly
> >> confusing.
> > That's actually a correct and well defined behavior, if you call a
> > function g from function f the function g has access to the variables
> > local to f.
> >
> > And yes it's confusing, but the alternative is having another global
> > variable which I do not think is much better than this.
> Hm shell code has more strange behavior than I would have ever expected...
Strongly agree here, to be honest if there was as better scripting
language that would be widely avaiable I would have switched long time
ago...
> But at least Li and myself did not know that and even while you know
> about this "feature", you think it is strange.
> I would rather like to be explicit and use a global variable (what harm
> is it really?) instead of confusing the next one looking at this piece
> of code....
If you really think global variable would be better, then go ahead and
send a patch, I do not have a strong feelings about this particular
detail.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2021-05-31 12:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 12:26 [LTP] [PATCH 1/2] tst_test: discard the stderr output Li Wang
2021-05-18 12:26 ` [LTP] [PATCH 2/2] tst_test: using SIGTERM to terminate process Li Wang
2021-05-19 6:46 ` Joerg Vehlow
2021-05-19 8:52 ` Li Wang
2021-05-31 12:35 ` Cyril Hrubis
2021-05-31 13:16 ` Joerg Vehlow
2021-05-31 12:54 ` Cyril Hrubis [this message]
2021-06-01 4:23 ` Joerg Vehlow
2021-05-31 12:49 ` Cyril Hrubis
2021-05-31 13:20 ` Joerg Vehlow
2021-05-31 12:57 ` Cyril Hrubis
2021-06-01 2:08 ` Li Wang
2021-06-01 4:03 ` Petr Vorel
2021-05-18 13:50 ` [LTP] [PATCH 1/2] tst_test: discard the stderr output Cyril Hrubis
2021-05-18 14:35 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YLTcjz4SoLJXPMTg@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).