[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tools: fix oom setting of xenstored


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 19 Oct 2021 09:55:58 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0oQ4ASkT19buSsEkCIuyMxR9FGf/D3eiJozGaAgNrf0=; b=PfNbqBCXR17Di38f27JQ3DZ+Lk42IcLko5iuYR52bPe3n/PwHhwEXs0MFBw7YbmAAXzjP5E0MwOF2rw6x6lymHyTlo5ZGAyjxRc/+rSt5HG0H3R877Qa/uWKSur2PfPr+Os9zz8XLFoCFI6FFxJCXSq2F+luJGZB4Jqi8VrgoIddcZ79hPFbapwSQIhBEFpJx8UxiX8jcp/gC+0i+Ns8cV4CtImueS4zti/SzQPOoPeiGpO9jb/ad7lA9BkftAjG9Gr53Xd1KykMPwGNNF+JIaI/Ggwo4ASjLD4oIrvs0Wc490a46RhT5lSwtTKyzBSJGOTKAkTRtP1doqIqneSFig==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M4Ob9U4H0rniGHlPsKOP3FHf4+h3HjyimIDCIDtQ2ak9WPPmVrlCnSty0yNfTQW50giO9eIjrjjxJtdlpy0zdKuEAGVKubDYSH6zArGyNi3DP1Jh3Rp9yP41HVU8MSyLxDVcs4T+0EUTSjLD5zagltGySTyt2TqLHkH1ZFH2I9WoWzMjQdv7lBmPwUXabcolcuMHp15ZOmaEKSkztfHKNosWBqq1x+1/nIfHrohWQuYlu0Hd/ThNp0yqfqvq92ZKJ7ZwgoaKFmeEAfneASPgINQw326PuWP8OMaUOIqfbmBQdXARcmiX5Xn7h+Qmnl04mX6hENkYZpFrxy4XJrwBTA==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 19 Oct 2021 07:56:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.10.2021 09:31, Juergen Gross wrote:
> On 19.10.21 08:54, Jan Beulich wrote:
>> On 19.10.2021 06:41, Juergen Gross wrote:
>>> --- a/tools/hotplug/Linux/launch-xenstore.in
>>> +++ b/tools/hotplug/Linux/launch-xenstore.in
>>> @@ -60,7 +60,7 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . 
>>> @CONFIG_DIR@/@CONFIG_LEAF
>>>             echo "No xenstored found"
>>>             exit 1
>>>     }
>>> -   [ -z "$XENSTORED_OOM_MEM_THRESHOLD" ] || XENSTORED_OOM_MEM_THRESHOLD=50
>>> +   [ -z "$XENSTORED_OOM_MEM_THRESHOLD" ] && XENSTORED_OOM_MEM_THRESHOLD=50
>>
>> Is resilience against "set -e" being in effect of interest? If so I
>> think this would want to be
> 
> I don't think set -e would have a negative effect on above line. The
> bash man-page tells me that:
> 
>    The shell does not exit if the command that fails is part of the
>    command list immediately following a while or until keyword, part of
>    the test following the if, ...
> 
> And I believe that "[ ... ]" is treated like an "if".

I don't think so - "[ ... ]" is an equivalent of "test ...", i.e.
unrelated to whether that's an operand of "if". The question is
what effect && has, i.e. the behavior is due to what you've
hidden by using ... in your quotation: "..., and is not a part of
an AND or OR list, ...".

I think I recall constructs like the one you use not working with
"set -e" on at least some bash versions, though. Apparently this
was due to a bash bug then (or I'm misremembering, but that's not
overly likely since some of my long used scripts specifically
avoid using && in such situations).

> A short test
> showed that bash indeed does not exit in this case:
> 
>    ( set -e; [ -z "" ] && xx=okay; echo $xx; )
> 
> This will print "okay", so bash didn't exit.

Of course, because the left side of && succeeds. You'd need

   ( set -e; [ -z "xxx" ] && xx=okay; echo xx=$xx; )

and observe "xx=" getting printed. Which indeed I do observe on
the one bash version I've tried to double check. But that one's
surely newer than what I think I saw such problems on.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.